$(document).ready(function(){
	
	var pic1= new Image; pic1.src="http://www.faressoft.org/images/banner/button.png";
	var pic2= new Image; pic2.src="http://www.faressoft.org/images/banner/1.png"; 
	var pic3= new Image; pic3.src="http://www.faressoft.org/images/banner/3.png"; 
	var pic5= new Image; pic5.src="http://www.faressoft.org/images/banner/2.png"; 
	var pic6= new Image; pic6.src="http://www.faressoft.org/images/banner/4.png";
	
	$("#TBantextbox").val("");
	
	$("img").each(function() {
		if ($(this).width() >= 636) {
			$(this).width(636);
			$(this).wrap('<a href="' + $(this).attr("src") + '" alt="" style="margin:0 auto;" target="_blank"></a>');
		}
	})
	
	$(window).load(function(){
		$("img").each(function() {
			if ($(this).width() >= 636) {
				$(this).width(636);
				$(this).wrap('<a href="' + $(this).attr("src") + '" alt="" style="margin:0 auto;" target="_blank"></a>');
			}
		})
	})
	
	$("#semail img").click(function() {	

	})
	
	$(".attSecondSpan").hover(function() {
		$(this).css("background-color","#9FB9CA").css("border","3px #879AA8 solid");
		$(".attachmentsDemo", this).css("background-position","right top");
		$(".attachmentsDownload", this).css("background-position","right top");
	}, function() {
		$(this).css("background-color","transparent").css("border","3px #E4E4E4 solid");
		$(".attachmentsDemo", this).css("background-position","right bottom");
		$(".attachmentsDownload", this).css("background-position","right bottom");
	});

	$("#search-textbox").val("أكتب عبارة البحث هنا ...");

	$("#search-textbox").focus(function(){
		if($(this).val()=="أكتب عبارة البحث هنا ...") $(this).val("");
	});
	
	$("#search-textbox").focusout(function(){
		if ($(this).val()=="") $(this).val("أكتب عبارة البحث هنا ...");
	});
	
	var t;
	var blueBarTabsTO = 7000;
	
	function blueTabs() {
		if ($(".blue-sbar-box .most-popular").css("display")=="inline-block") {
			hideAllTab();
			$(".blue-sbar-box .lastest").css("display","inline-block");
			$('.side-bar-blue .tab2').addClass("active");
			t =setTimeout(blueTabs,blueBarTabsTO);
		} else if ($(".blue-sbar-box .lastest").css("display")=="inline-block") {
			hideAllTab();
			$(".blue-sbar-box .comments").css("display","inline-block");
			$('.side-bar-blue .tab3').addClass("active");
			t =setTimeout(blueTabs,blueBarTabsTO);
		} else if ($(".blue-sbar-box .comments").css("display")=="inline-block") {
			hideAllTab();
			$(".blue-sbar-box .tags").css("display","inline-block");
			$('.side-bar-blue .tab4').addClass("active");
			t =setTimeout(blueTabs,blueBarTabsTO);
		} else if ($(".blue-sbar-box .tags").css("display")=="inline-block") {
			hideAllTab();
			$(".blue-sbar-box .most-popular").css("display","inline-block");
			$('.side-bar-blue .tab1').addClass("active");
			t =setTimeout(blueTabs,blueBarTabsTO);
		}
	}
	
	function hideAllTab() {
		$(".blue-sbar-box .blue-tab").css("display","none");
		$(".blue-sbar-box .tags").css("display","none");
		$('.side-bar-blue .tab1').removeClass("active");
		$('.side-bar-blue .tab2').removeClass("active");
		$('.side-bar-blue .tab3').removeClass("active");
		$('.side-bar-blue .tab4').removeClass("active");	
	}
	
	$(".tab1").click(function(){
		clearTimeout(t); hideAllTab();
		$(".blue-sbar-box .most-popular").css("display","inline-block");
		$('.side-bar-blue .tab1').addClass("active");
		t =setTimeout(blueTabs,blueBarTabsTO);
	});
	
	$(".tab2").click(function(){
		clearTimeout(t); hideAllTab();
		$(".blue-sbar-box .lastest").css("display","inline-block");
		$('.side-bar-blue .tab2').addClass("active");
		t =setTimeout(blueTabs,blueBarTabsTO);
	});
	
	$(".tab3").click(function(){
		clearTimeout(t); hideAllTab();
		$(".blue-sbar-box .comments").css("display","inline-block");
		$('.side-bar-blue .tab3').addClass("active");
		t =setTimeout(blueTabs,blueBarTabsTO);
	});
	
	$(".tab4").click(function(){
		clearTimeout(t); hideAllTab();
		$(".blue-sbar-box .tags").css("display","inline-block");
		$('.side-bar-blue .tab4').addClass("active");
		t =setTimeout(blueTabs,blueBarTabsTO);
	});
	
	t =setTimeout(blueTabs,blueBarTabsTO);
	
	
		
});
