eft_m = 0;
eft_m_qadeem = 0;
eft_adad = mokh.length;
$(function(){
	//////////////////
	var sor = new Image();
	sor.src = "mokh_tash.gif";
	$("#zr_mokh_tali").click(function(){
		eft_tali();
	})
	$("#zr_mokh_sabeq").click(function(){
		eft_sabeq();
	})
	$("#zr_mokh_eqaf_tash").toggle(function(){
		eft_eqaf();
		$(this).children("img").attr("src",_HPT+'/sowar/'+'mokh_tash.gif');
		$(this).attr('title','تشغيل');
	},function(){
		eft_tali();
		$(this).children("img").attr("src",_HPT+'/sowar/'+'mokh_eqaf.gif');
		$(this).attr('title','إيقاف');
	})
	//////////////
	var mokh_sora = ''
	for(var a=0 ; a < eft_adad ; a++){
		if(a==0) mokh_sora = 'mokh_ic_nashet.gif';
		else mokh_sora = 'mokh_ic.gif';
		$("#mokh_anaser").append('<a href="javascript:eft_enteqal('+a+')" title="'+mokh[a].split('__')[2]+'"><img src="'+_HPT+'/sowar/'+mokh_sora+'" id="mokh_ic_'+a+'"></a>');
	}
	//////////////
	/////////////////////////////////////
	$("#_ma3ash,#_nozha").hover(function(){$(this).oneTime(120,function(){ezherQaema(this)})},function(){$(this).oneTime(150 , function(){ekhfyQaema_wakt()})});
	///////////////////////////////////////
    $("[title]").hover(function(){ezherEnwan(this)} , function(){ekhfyEnwan()});
	//////////////////////////////////////
    qaema2_tataharak = false;
	$("#_majala").data("nashet",true);
	$("#q_doaa,#q_hekma,#q_wajeb").css("opacity",0);
	$("#_doaa,#_hekma,#_wajeb").css("opacity",.3);
	$("#_majala,#_doaa,#_hekma,#_wajeb").click(function(){
		if(qaema2_tataharak) return;
		var $this = $(this);
		if($this.data("nashet")) return;
		var $qaema = $("#q"+this.id);
		$("#_majala,#_doaa,#_hekma,#_wajeb").each(function(){
			if(! $(this).data("nashet")) return true;
			$(this).data("nashet",false);
			//$(this).css({background:"#ffffff"});
			$(this).css({opacity:.3});
			$(this).css({border:"none"});
			qaema2_tataharak = true;
			$("#q"+this.id).animate({opacity:0} ,50,'linear', function(){
				$(this).css("display","none");
				$(this).removeClass('nashet');
				$qaema.css("display","block");
				//$qaema.css("width","0px");
				$qaema.animate({opacity:1},600,'linear',function(){qaema2_tataharak=false});
			})
		});
        $this.data("nashet",true);
		$qaema.addClass('nashet');
		//$this.css({background:"#fcfcfc"});
		$this.css({opacity:1});
		$this.css({border:"1px solid #F9F9F9"});
		$this.css({borderRight:"none"});
	})
	var anaser = ["#_majala","#_doaa","#_hekma","#_wajeb"];
	//$(anaser[Math.round(Math.random()*(anaser.length-1))]).click();
	$("#_doaa").click();
	/////////////////////////////

	$("#qy_majala").mouseover(function(){
		$this = $(this);
		//alert($this.children(".nashet").height());
		if($this.children(".nashet").height() > $this.height()){
			//alert(1);
			var $qaema = $("#qy_majala_mokamel");
			var $qaema2 = $("#qy_majala_mokamel2");
        	var makan = $this.offset();
			//makan.top += 15;

			//var farq = document.documentElement.scrollWidth - document.documentElement.clientWidth;
			//makan.left -= farq;
			//if(makan.left <= - farq) makan.left = - farq;
			///////////
			//$qaema.css("width" , "400px");
			$qaema.css("top" , makan.top+"px");
			$qaema.css("left" , makan.left+"px");
			$qaema.html($this.children(".nashet").html());

			$qaema2.css("top" , makan.top-10+"px");
			$qaema2.css("left" , makan.left-10+"px");
			$qaema2.css("opacity" , "0");
			$qaema2.height($qaema.height());
			$qaema2.show();

			$qaema.fadeIn(100);

		}
	})
	$("#qy_majala_mokamel2").mouseout(function(){
		$("#qy_majala_mokamel2").hide();
		$("#qy_majala_mokamel").fadeOut(100);
	});

	//////////////////////
	$("#h_bahth").click(function(){
		if(! $(this).data('tm')){
			$(this).data('tm' , true);
			this.value='';
		}
	})
////////////////////////////////////////////
    tagheez_akhbar();
	akhbar();
	$("#akhbar").everyTime(10000,function(){akhbar()})
	$("#akhbar").hover(function(){$(this).stopTime()} , function(){akhbar();$(this).everyTime(10000,function(){akhbar()})})


});



$(window).load(function(){
	$("#mokhtarat").oneTime(10000 , function(){
		eft_tali();
	});

	//return; // يرجى حذف هذا الامر لتفعيل الاعلانات
     hatE3lan(1);
	 hatE3lan(2);
	 //eftetahya_sawtya(); // يمكن ازالة التهميش لتفعيل الافتتاحية الصوتية
});

