function search()
{
	var q= document.getElementById('search_txt').value;
	var type= document.getElementById('type').value;
	if(q.trim() =="")
	{
		alert ("الرجاء إدخال النص المراد البحث عنه");
	}
	else
	{
		q.replace('"','&quot;');
		var url = base_url+"search?q="+decodeURI(q)+"&type="+type;
		window.open(url,"_self")	
	}
}
function MM_openPopupS(url)
{
	window.open(url,'popup','scrollbars=yes,width=850,height=700');
}
function MM_openPopup(url)
{
	
	window.open(url,'','resizable=yes,scrollbars=yes,toolbar=yes,status=yes,menubar=yes,location=yes,width='+screen.availWidth+',height='+screen.availHeight);
	window.close();
}
function change_vedio(swf,prm,img,full) {
	if(full != 0 )
	{

	var FU = { 
			movie:swf,id:"flvplayer",name:"flvplayer",width:"318",height:"258",majorversion:"8",build:"0",bgcolor:"#FFFFFF",wmode:"opaque",flashvars:"file="+prm+"&image="+img+"&lightcolor=0x557722&backcolor=0x000000&frontcolor=0xCCCCCC&displaywidth=318&autostart=true&fsreturnpage="+full
	 };
	}
	else
	{
		var FU = { 
			movie:swf,id:"flvplayer",name:"flvplayer",width:"318",height:"258",majorversion:"8",build:"0",bgcolor:"#FFFFFF",wmode:"opaque",flashvars:"file="+prm+"&image="+img+"&lightcolor=0x557722&backcolor=0x000000&frontcolor=0xCCCCCC&displaywidth=318&autostart=true"
	 }
	}
	UFO.create(	FU, "player2");

	
};

function activateField(newVideosListID)
{
	document.getElementById('newVideosList1').style.backgroundColor='';
	document.getElementById('newVideosList2').style.backgroundColor='';
	document.getElementById('newVideosList3').style.backgroundColor='';
	document.getElementById('newVideosList4').style.backgroundColor='';
	document.getElementById(newVideosListID).style.backgroundColor='#f0f0f0';

}
function searchKey(evt)
{
	if(evt ==13)
	{
		search();
	}
}
var counter = 0;
var newshomePageIDs ="";
 var timerID = 0;
var tStart  = null;
function updateTimer() {


   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }

   if(!tStart)
      tStart   = new Date();

   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();
 
   tDate.setTime(tDiff);

	arrays = newshomePageIDs.split(',');
	if(parseInt(tDate.getSeconds()))
	{
		var sec = document.getElementById('hs').value;
		var min = document.getElementById('hm').value;
		var hour = document.getElementById('hh').value;
		if((sec-1)>0)
		{
			sec = sec-1;
			if(sec <10)
			{
				document.getElementById('hs').value = "0"+sec;
			}
			else
			{
				document.getElementById('hs').value = sec;
			}
			
		}
		else
		{
			if((min-1)>0)
			{
				document.getElementById('hs').value = 59;
				min = min -1;
				if(min <10)
				{
					document.getElementById('hm').value = "0"+min;
				}
				else
				{
					document.getElementById('hm').value= min;
				}
				
			}
			else
			{
				if((hour-1)>0)
				{
					document.getElementById('hs').value = 59;
					document.getElementById('hm').value= 59;
					hour = hour -1;
					if(hour <10)
					{
						document.getElementById('hh').value=hour;
					}
					else
					{
						document.getElementById('hh').value=hour;
					}
				}
				else
				{
					top.location=top.loaction;
				}
			}
		}
	}
   
   timerID = setTimeout('updateTimer()', 1000);
}
String.prototype.trim = function() {
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};
function logout(location){
	if (confirm('هل انت متاكد بانك تريد الخروج ؟')) {
		
		AJAXGet(base_url+"logout.php?location="+location,loginHandler,false,false);
	}

}
function logout2(location){
	if (confirm('هل انت متاكد بانك تريد الخروج ؟')) {
		window.location= location;
		//AJAXGet(base_url+"logout.php?location="+location,logoutHandler,false,false);
	}

}
function loginHandler(sText){
	
	if(sText)
	{
		top.location = sText;
	}
	
}
