//var imgpreload=new Array()
//for (i=0;i<=slideurl.length;i++) {
//	imgpreload=new Image()
//	imgpreload.src="images/NewsPics/Medium/Pic_4678.jpg"
//}
var ieversion = 0;
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
	ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
}

function OpenPic(FilePath)
{	
w_height=605
LeftPosition	= (screen.availWidth) ? (screen.availWidth-500)/2 : 0;  //screen.width-700
TopPosition		= (screen.availHeight) ? (screen.availHeight-550)/2 : 0;

Picwind=window.open("commonIncludes/openpic.asp?FilePath="+FilePath,"Picwin"," dependent=no ,menubar=no,toolbar=no,scrollbars=no, directories=no, left="+LeftPosition+" , top="+TopPosition+" ,height= 550 , width=500"); 
Picwind.focus()
}

function PopUp(Url,WinName,Width,Height)
{
LeftPosition	= (screen.availWidth) ? (screen.availWidth-Width)/2 : 0;  //screen.width-700
TopPosition		= (screen.availHeight) ? (screen.availHeight-Height)/2 : 0;

PopUpWind = window.open(Url,WinName,'menubar=no,scrollbars=no,toolbar=no,directories=no,left='+LeftPosition+' , top='+TopPosition+', width='+ Width +',height=' + Height)
PopUpWind.focus()
}

function PopUp2(Url,WinName,Width,Height)
{
LeftPosition	= (screen.availWidth) ? (screen.availWidth-Width)/2 : 0;  //screen.width-700
TopPosition		= (screen.availHeight) ? (screen.availHeight-Height)/2 : 0;

PopUpWind = window.open(Url,WinName,'menubar=no,scrollbars=yes,toolbar=no,directories=no,left='+LeftPosition+' , top='+TopPosition+', width='+ Width +',height=' + Height)
PopUpWind.focus()
}

function OpenComment(Url,WinName,Width,Height)
{
LeftPosition	= (screen.availWidth) ? (screen.availWidth-Width)/2 : 0;  //screen.width-700
TopPosition		= (screen.availHeight) ? (screen.availHeight-Height)/2 : 0;

PopUpWind = window.open(Url,WinName,'menubar=no,scrollbars=yes,toolbar=no,directories=no, screenx=300, left='+LeftPosition+' , top='+TopPosition+', width='+ Width +',height=' + Height)
PopUpWind.focus()
}


function SendStory(NewsID)
{	
	LeftPosition	= (screen.availWidth) ? (screen.availWidth-400)/2 : 0;  //screen.width-700
	TopPosition		= (screen.availHeight) ? (screen.availHeight-350)/2 : 0;
	SendStorywind=window.open("commonIncludes/SendStory.asp?NewsID="+NewsID,"SendStorywin"," dependent=no ,menubar=no,toolbar=no,scrollbars=no, directories=no, left="+LeftPosition+" , top="+TopPosition+" ,height= 350 , width=400"); 
	SendStorywind.focus()
}



function openCustomWindow(url,w,h,tit) 
{
	var goURL					= url;		// URL		
	var valWidth				= w;		//  Width				
	var valHeight				= h;		//  Height
	var nameWindow				= "SeoulCasinoWindow"	
	var windowCERRARa			= "/Images/CustomWindow/close_a.gif";	// Image Out
	var windowCERRARd			= "/Images/CustomWindow/close_d.gif";	// 
	var windowCERRARo			= "/Images/CustomWindow/close_o.gif";	// Image Over
	var windowTIT				=  tit;		 // Title
	var windowBORDERCOLOR		= "#000000"; // Border Color
	var windowBORDERCOLORsel	= "#ffffff"; //  Border Color	
	var windowTITBGCOLOR		= "#666666"; // bgcolor
	var windowTITBGCOLORsel		= "#666666"; //  bgcolor

	openchromeless(goURL, nameWindow, valWidth, valHeight, windowCERRARa, windowCERRARd, windowCERRARo, windowTIT, windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel);
}


function openchromeless(theURL, wname, W, H, windowCERRARa, windowCERRARd, windowCERRARo, windowTIT, windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel) 
{
	var windowW = W;
	var windowH = H;
	var windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
	var windowY = Math.ceil( (window.screen.height - windowH) / 2 );

	if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4) isie=true
	else isie=false

	if (isie) { H=H+20+2; W=W+2; }

	var s = ",width="+W+",height="+H;

	if (isie) 
	{
		alert("hi")
		var parameters = escape( theURL+"|"+windowCERRARa+"|"+windowCERRARd+"|"+windowCERRARo+"|"+windowTIT+"|"+windowBORDERCOLOR+"|"+windowBORDERCOLORsel+"|"+windowTITBGCOLOR+"|"+windowTITBGCOLORsel)

		splashWin = window.open( "" , wname, "fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0"+s)

		splashWin.resizeTo( Math.ceil( 200 )       , Math.ceil( 300 ) )
		splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) )
/*
		splashWin.document.open("text/html", "replace");
		splashWin.document.write("<html><style type='text/css'>\n");
		splashWin.document.write("body { border: 1px solid #000000; overflow: hidden; margin: 0pt;}");
		splashWin.document.write("#stillloadingDiv 	{ position: absolute; left: 0px; top: 0px; width: 100%px; height: 19px; z-index: 1; background-color: #C0C0C0; layer-background-color: #C0C0C0; clip:rect(0,100%,19,0);}");
		splashWin.document.write("</style>\n");
		splashWin.document.write("<body onload=\"top.document.location.replace('/CustomWindow/CustomWindow.asp?"+parameters+"')\" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no'>");
		splashWin.document.write("<div id=stillloadingDiv><table width=100% height=22 cellspacing=0 cellpadding=0><tr><td align=left valign=middle width=100%><FONT size=1 face=verdana color=#000000>&nbsp;&nbsp;c o n t a c t i n g . . .</font></td></tr></table></div>");
		splashWin.document.write("</body></html>");
		splashWin.document.close();*/
	}
	else    
		var splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s, true) ;

	splashWin.focus();
}
	function Switch2Tabs(ID1,img1,Div1,ID2,img2,Div2)
	{
			//alert(ID1+'-'+img1+'-'+Div1+'-'+ID2+'-'+img2+'-'+Div2)
			
			ControlSource_1 = document.getElementById(ID1)
			ControlSource_1.src=img1
			
			DivSource_1 = document.getElementById(Div1)
			DivSource_1.style.display="block"
			DivSource_1.style.visibility= "visible"
			
			ControlSource_2 = document.getElementById(ID2)
			ControlSource_2.src=img2
			
			DivSource_2 = document.getElementById(Div2)
			DivSource_2.style.display="none"
			DivSource_2.style.visibility= "hidden"
	}
		function Switch3Tabs(ID1,img1,Div1,ID2,img2,Div2,ID3,img3,Div3)
	{
			//alert(ID1+','+img1+','+Div1+','+ID2+','+img2+','+Div2+','+ID3+','+img3+','+Div3)
			//alert(Div1+','+Div2+','+Div3)
			
			ControlSource_1 = document.getElementById(ID1)
			ControlSource_1.src=img1
			
			DivSource_1 = document.getElementById(Div1)
			DivSource_1.style.display="block"
			DivSource_1.style.visibility= "visible"
			
			
			ControlSource_2 = document.getElementById(ID2)
			ControlSource_2.src=img2
			
			DivSource_2 = document.getElementById(Div2)
			DivSource_2.style.display="none"
			DivSource_2.style.visibility= "hidden"
			
			
			ControlSource_3 = document.getElementById(ID3)
			ControlSource_3.src=img2
			
			DivSource_3 = document.getElementById(Div3)
			DivSource_3.style.display="none"
			DivSource_3.style.visibility= "hidden"
	}
	function SwitchTabs(id,tabsNum)
	{
		for(i=1;i<=tabsNum;i++)
		{
			ControlSource = document.getElementById("tabButton"+i)
			var imgsrc = ControlSource.src
				var k = imgsrc.indexOf('_off')
				if (k== -1)
				{
					imgsrc = (imgsrc.substring(0,imgsrc.lastIndexOf(".")))+"_off.gif"
					ControlSource.src= imgsrc
				}
			
			DivSource = document.getElementById("TabDiv"+i)
			DivSource.style.display="none"
			DivSource.style.visibility= "hidden"
			
		}
			
			ControlSource = document.getElementById("tabButton"+id)
			var imgsrc = ControlSource.src
				imgsrc = (imgsrc.substring(0,imgsrc.lastIndexOf("_off")))+".gif"
			ControlSource.src= imgsrc
						
			DivSource = document.getElementById("TabDiv"+id)
			DivSource.style.display="block"
			DivSource.style.visibility= "visible"
	}
	
	
	function SwitchTabsBG(id,tabsNum)
	{
		for(i=1;i<=tabsNum;i++)
		{
			ControlSource = document.getElementById("tabButton"+i)
			if (ieversion >= 5)
				var imgsrc = ControlSource.background
			else
				var imgsrc = ControlSource.style.backgroundImage
			
			//var imgsrc = ControlSource.background
			
				var k = imgsrc.indexOf('_Off')
				
				if (k== -1)
				{
					
					imgsrc = (imgsrc.substring(0,imgsrc.lastIndexOf(".")))+"_Off.gif"
				if (ieversion >= 5)
					ControlSource.background = imgsrc
				else
					ControlSource.style.backgroundImage = imgsrc
					
				}
		
			DivSource = document.getElementById("TabDiv"+i)
			DivSource.style.display="none"
			DivSource.style.visibility= "hidden"
			ControlSource.style.color="#FFFFFF"
			
		}
			
			ControlSource = document.getElementById("tabButton"+id)
			if (ieversion >= 5)
				var imgsrc = ControlSource.background
			else
				var imgsrc = ControlSource.style.backgroundImage
			
				imgsrc = (imgsrc.substring(0,imgsrc.lastIndexOf("_Off")))+".gif"
			
			if (ieversion >= 5)
				ControlSource.background = imgsrc
			else
				ControlSource.style.backgroundImage = imgsrc
						
			DivSource = document.getElementById("TabDiv"+id)
			DivSource.style.display="block"
			DivSource.style.visibility= "visible"
			ControlSource.style.color="#800000"
	}
	
	
	function checkmail(str_email)
	{
		if(str_email.length==0) 
		{
			alert("You entered nothing!");
		}
		else if(str_email.indexOf("@")==-1) 
		{
			alert("Your email address does not contain \"@\"");
		}
		else if(str_email.indexOf(".")==-1) 
		{
			alert("Your email address does not contain \".\"");
		}
		else if(str_email.lastIndexOf(".") < str_email.indexOf("@")) 
		{
			alert("The last \".\" occurs before the \"@\"");
		}
		/*else 
		{
			alert("I ain't finished with you yet...");
		}*/
	}
	function checkURL(str)
	{
		
		url = 'http://'+str
		PopUP="MyPopUP"
		document.getElementById("checkURL").href='javascript:PopUp("'+url+'","'+PopUP+'",300,300)'
		//document.getElementById("checkURL").onclick='javascript:PopUp("http://"+str,"WinName",300,300)'
	}
	function CheckNum(id) 
	{
		
		var x = document.getElementById(id).value
		//ask_teenz.age.value
			if (isNaN(x))
			{
				alert("يجب ادخال رقم")
				 document.getElementById(id).focus()
				 document.getElementById(id).value=''
			}
		
		
	}
	function DeleteCheck()
{	
	if (confirm('هل انت متاكد من الحذف'))
	{
		return true;
	}
	else
	{
		return false;
	}
}




function swap(direction,ID)
	{
		SelControl =  document.getElementById(ID)
		SelIndex =SelControl.selectedIndex
		if(SelIndex==-1)
			{
				alert('اختر اولا')
				return false
			}
		SelValue = SelControl.options[SelIndex].value
		Seltext = SelControl.options[SelIndex].text
		if (direction=='up' && SelIndex>0)	
		{
			SelValueTemp = SelControl.options[SelIndex-1].value
			SeltextTemp = SelControl.options[SelIndex-1].text
			SelControl.options[SelIndex-1].selected=true
				
			SelControl.options[SelIndex].value = SelValueTemp
			SelControl.options[SelIndex].text=SeltextTemp
			
			SelControl.options[SelIndex-1].value = SelValue
			SelControl.options[SelIndex-1].text=Seltext
		}
		if (direction=='down' && SelIndex!=SelControl.length-1)
		{
			SelValueTemp = SelControl.options[SelIndex+1].value
			SeltextTemp = SelControl.options[SelIndex+1].text
			
				
			SelControl.options[SelIndex].value = SelValueTemp
			SelControl.options[SelIndex].text=SeltextTemp
			
			SelControl.options[SelIndex+1].value = SelValue
			SelControl.options[SelIndex+1].text=Seltext
			SelControl.options[SelIndex+1].selected=true
		}
		
	}
	
	
	
	
	
		function AddtoSel(Sel1,Sel2)
		{
			alert(Sel1+'-'+Sel2)
			Source1 = document.getElementById(Sel1)
			Source2 = document.getElementById(Sel2)
			//if (Source1 && Source2)
			//{
				
				if (Source1.options.selectedIndex == 0 )
					{
						alert('اختر اولا')
						return false
					}
				
				text_Source1 =Source1(Source1.selectedIndex).text
				value_Source1 =Source1(Source1.selectedIndex).value
				
				for(i=0;i<Source2.length;i++)
				{
					//alert(PersonID+'---'+MovieRoleID)
					if(Source2.options[i].value == value_Source1)
						{
							alert('دخل ابل كدا')
							return false
						}
				}
				i = Source2.length
				Source2.options[i]=new Option(text_Source1,value_Source1,true)
			//}
			return true
		}
		
		
function MovieRate(Rate,MovieID,ImgName)	
	{

		CookieFlag = document.getElementById("MovieCookieFlag"+MovieID).value
		if(CookieFlag==0)
			{
				document.getElementById("RateFrame").src="RateMovie.asp?MovieID="+MovieID+"&Rate="+Rate+"&ImgName="+ImgName
				document.getElementById("MovieCookieFlag"+MovieID).value=1
			}
		else
			alert('لقد تم تقيمك للفيلم من قبل')
	}
function VoteSong(SongID)	
	{

		CookieFlag = document.getElementById("SongCookieFlag"+SongID).value
		if(CookieFlag==0)
			{
				document.getElementById("VoteFrame").src="SongVote.asp?SongID="+SongID
				document.getElementById("SongCookieFlag"+SongID).value=1
			}
		else
			alert('تم ترشيحك للاغنية من قبل')
	}
		
		
		
		
		
function HighlightRate(ImgName,id,picSrcArr)
	{
		for(i=1;i<=5;i++)
		{
			document.getElementById(ImgName+i).src=picSrcArr[0]
		}
		for(i=1;i<=id;i++)
		{
			document.getElementById(ImgName+i).src=picSrcArr[2]
		}
	}
function NoHighlightRate(ImgName,Stars,picSrcArr)
	{
		//alert(document.getElementById(Stars))
		StarsOn = document.getElementById(Stars).value
		for(i=1;i<=5;i++)
		{
			if (i<=StarsOn)
				Src = picSrcArr[1]
			else
				Src = picSrcArr[0]
			document.getElementById(ImgName+i).src=Src
		}
	}	
	


var curpos=600
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1

var ie4=document.all
var dom=document.getElementById
var plusflag=0

function rotateimage(ImgSrc,Index,src)
	{
		
		//alert(ImgSrc.style.filters.alpha.opacity)
		//alert(ImgSrc.style.zIndex)
			//ImgSrc.style.filters.alpha.opacity+=10
			if(plusflag==0)
				curpos-=15
			else
				curpos+=15	
			
			ImgSrc.filters.alpha.opacity=curpos
			//ImgSrc.style.filter = 'alpha(opacity='+curpos+')'
		
		
		
		if (curpos==0)
		{	
			plusflag=1
			//alert(Index)
			//alert(document.getElementById("PicSrcArrSize"+Index))
			//alert("ss")
			PicSrcArrSize = parseInt(document.getElementById("PicSrcArrSize"+Index).value)
			
			
			
			PicIndexSrc = document.getElementById("PicIndex"+Index)
			PicIndex = parseInt(PicIndexSrc.value)
			
			
			var srctext = document.getElementById("PicSrcArr"+Index).value
			
			var PicArr = srctext.split(",")
			
			
			PicIndex=PicIndex+1
			//alert(PicIndex)
			if(PicIndex<PicSrcArrSize)
			{
					PicIndexSrc.value = PicIndex+1
			}
			else
			{
					PicIndex=0
					PicIndexSrc.value= PicIndex
			}	
			
			ImgSrc.src=src+PicArr[PicIndex]
		}
		else if(curpos==600)
			plusflag=0
	}
	
	
	function DoHighLight(Text,id,langid)
	{
		document.getElementById(Text+"3"+id+langid).style.backgroundColor='#000000'
		document.getElementById(Text+id+langid).style.backgroundColor='#000000'
	}
	function LooseHighLight(Text,id,langid)
	{
		document.getElementById(Text+id+langid).style.backgroundColor=''
		document.getElementById(Text+"3"+id+langid).style.backgroundColor=''
	}
	
	/*window.onload = function() {
	document.onselectstart = function() {return false;} // ie
	document.onmousedown = function() {return false;} // mozilla
	}*/
