jQuery(function($){

	/*--- [start] equal height columns with jquery---*/
	function equalHeight(group) {
		var tallest = 0;
		group.each(function() {
			var thisHeight = $(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
		});
		group.height(tallest);
	}
	
	$(document).ready(function() {
		equalHeight($('div.cl'));
		equalHeight($('div.mt'));
		equalHeight($('div.fc'));
	});
	/*--- [end] equal height columns with jquery---*/


	/*--- [start] cookie position for works ---*/
	
	$('div.work_click').click(function(){
		$('#work_global').toggleClass('change');
	});
	
	
	$('div.cl_left').click(function(){
		$.cookie('work_global', 'list');
		window.location.reload();
	});
	
	$('div.cl_right').click(function(){
		$.cookie('work_global', 'table');
		window.location.reload();
	});


	// COOKIES
	// Left column state
	var work_global = $.cookie('work_global');
	
	// Set the user's selection for the left column
	if (work_global == 'table') {
		$('.work_global').addClass('table');
		$('.cl_right').addClass('cl_right_active');
	} else {
		$('.work_global').addClass('list');
		$('.cl_left').addClass('cl_left_active');
	}
	
	
	$('div.paging ul li').hover(function(){
		$(this).addClass('hover');
		$(this).children('ul').fadeIn('fast');
		}, function(){
			$(this).removeClass('hover');
			$(this).children('ul').fadeOut('fast');
		}
	);


	$("#slider").faded({
		speed: 300,
		crossfade: false,
		bigtarget: false,
		loading: true,
		autoplay: 5000,
		autorestart: 10000,
		autopagination:true
	});

	$(".block").bind("showBlock", function(){
		$(this).find('.block-shadow').animate({bottom:'-20px'}, "fast")
	});
	$(".block").bind("hideBlock", function(){
		$(this).find('.block-shadow').animate({bottom:'-200px'}, "slow")
	})
	$(".block:first").trigger('showBlock');

	$(".cbox").colorbox({
		rel: 'صورة الموضوع'
	});
	
	$(".post-attachments a").colorbox({
		rel: 'الصور الملحقة'
	});
	
	$("a[rel^=colorbox]").colorbox();

	$(".date-pick").datepicker({
		buttonImage: '/wp-content/themes/theme1157/images/cal.png',
        buttonImageOnly: true,
        changeMonth: true,
        changeYear: true,
        showOn: 'both',
        onSelect: function(dateText, inst){
        	window.location = '/?date=' + dateText
        }
	});
	
	$(".icon_cal").click(function(e){
		e.preventDefault();
		$(".date-pick").datepicker('show');
	})

	$(".other-cats area").hover(function(e){
		coord = $(this).attr('coords').split(',')[1];
		r = $(".hoverAnchor").css({top:coord+'px'}).attr('href', $(this).attr('href'));
	}, function(e){
		
	})
	
	








































});
