﻿/*
$(document).ready(function(){
	
	$('#navigation li').hover(
		function() {
			$(this).find('ul').show();
		},
		function() {
			$(this).find('ul').hide();
		}
	);
	
	$("#slider ul").jcarousel({
		scroll: 1,
		wrap: 'both',
		auto: 5,
		initCallback: mycarousel_initCallback,
		itemVisibleInCallback: mycarousel_visibleCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
    
    $('.tabs .head li a').click(function() {
    	
    	var href = $(this).attr('href');
    	$('.tabs .head li a').removeClass('active');
    	$(this).addClass('active');
    	$('.tabs .tab').hide();
    	$(href).show();
    	
    	return false;
    });
    
	//$("#top-info").replaceWith("<div id='top-info'>" + dd + "</div>")
	//$(".ms-WPHeader").replaceWith("<div></div>")
	    
});

$(document).ready(function(){
	$(".vertical-slider ul").jcarousel({
		vertical: true,
		scroll: 1,
		wrap: 'both',
		auto: 5,
		initCallback: verticalCarousel_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
});

function verticalCarousel_initCallback(carousel) {
	$('.slide-bottom').bind('click', function() {
		carousel.next();
		return false;
	});
	
	$('.slide-top').bind('click', function() {
		carousel.prev();
		return false;
	});

};

function mycarousel_initCallback(carousel) {
	$('#slider .controls .next').bind('click', function() {
		carousel.next();
		return false;
	});
	
	$('#slider .controls .prev').bind('click', function() {
		carousel.prev();
		return false;
	});

	$("#slider .slide-navigation a").click(function(){
		var stitle = parseInt($(this).html());
		carousel.scroll(stitle);
		return false;
	});

};
function mycarousel_visibleCallback(carousel, li, index, state) {
	$('#slider .slide-navigation a').removeClass('active');
	$('#slider .slide-navigation a').eq(index-1).addClass('active');
};
*/


$( document ).ready( function(){

	$('.time').replaceWith("<p class='time'>" + dd + "</p>")
	
	$('#ctl00_g_645a9dd7_e910_4401_9cc2_bdfd5d1bce3f_S46463769_InputKeywords').attr('title', 'أدخل كلمات البحث')
	
	check_tabs();
	$('#main-nav ul li').hover(function () {
		$(this).addClass('hover');
		$(this).find('.drop-down').css('visibility', 'visible');
	}, function () {
		$(this).removeClass('hover');
		$(this).find('.drop-down').css('visibility', 'hidden');
	});
	
	if($('.big-col .slider ul').length > 0)
	{
	$('.big-col .slider ul').jcarousel({
		vertical: true,
		scroll: 1,
		auto: 5,
		wrap: 'both'
	});
	}
	
	if($('.news-slider ul').length > 0)
	{
	$('.news-slider ul').jcarousel({
		scroll: 1,
		auto: 5,
		wrap: 'both',
		initCallback: mycarousel_initCallback,
		itemVisibleInCallback: mycarousel_itemVisibleInCallback
	});
	}
	
	$('.tabbed-box #tabs li a').live('click', function () {
		var href = $(this).attr('href');
		var tabs_holder = $(this).parents('.tabbed-box:eq(0)').find('.tabs-content:eq(0)');
		$(this).parents('ul:eq(0)').find('a').removeClass('active');
		$(this).addClass('active');
		tabs_holder.find('.tabs').hide();
		tabs_holder.find(href).show();
		return false;
	})
});
function mycarousel_initCallback(carousel) {
	$('#mycarousel-next').bind('click', function() {
		carousel.next();
		return false;
	});
	
	$('#mycarousel-prev').bind('click', function() {
		carousel.prev();
		return false;
	}); 
	
	$(".numb-nav a").bind("click", function() {
		carousel.scroll(jQuery.jcarousel.intval($(this).text()));
		$(".numb-nav a").removeClass("active"); //Remove any "active" class
		$(this).addClass("active");
        return false;	
	});
};
function mycarousel_itemVisibleInCallback(carousel, item, index, state) { 
	$('.numb-nav a').removeClass('active');
	$('.numb-nav a').each(function() {
		var rel = $(this).text();
		if (rel == index) {
			$(this).addClass('active');
		};
	})
 }
function check_tabs() {
	var href = $('#tabs li a.active').attr('href');
	$(href).show();
};
