
link3_off=new Image;
link3_off.src="/images/3.gif";
link3_on=new Image;
link3_on.src="/images/33.gif";

link3_open=new Image;
link3_open.src="/images/33.gif";

link31_off=new Image;
link31_off.src="/images/l1.gif";
link31_on=new Image;
link31_on.src="/images/l11.gif";

link32_off=new Image;
link32_off.src="/images/l2.gif";
link32_on=new Image;
link32_on.src="/images/l22.gif";

///// Used in the Menu
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function swap2(img1, img2, LayerName)
{
	if (LayerName.style.display=='none')
		{
			document.images[img1].src=eval(img2+".src");		
		}		
	//document.images[img1].src=eval(img2+".src");
}

function ShowLayer(LayerName, img0)
{
	if (LayerName.style.display=='none')
		{
		LayerName.style.display='';
		document.images[img0].src=eval(img0+"_on.src");
		}
	else
		{
		LayerName.style.display='none';
		document.images[img0].src=eval(img0+"_off.src");		
		}	
}


///// Site Functions
function SetFocus(Cntrl)
{
	var Control = document.getElementById(Cntrl);
	if (window.event.keyCode == 13)	
		Control.focus(Cntrl);
}



function getConfirm(msg)
{
	return confirm(Msg);
}

function PopupDialog(Path,Height,Width,Winname)
	{	
		var result
		result = window.showModalDialog(Path,Winname,"dialogHeight:"+Height+"px;dialogWidth:"+Width+"px;center:yes;edge:raised;resizable:no;scroll:yes;help:no;status:no");
		return (result);
	}
function PopupWin(Path,Height,Width)
	{
		window.open(Path,"new_page","Height="+Height+",width="+Width+",left="+((screen.width/2)-(Width/2))+",top="+((screen.height/2)-(Height/2))+",resizable=no,scrollbars=no,toolbar=no,status=no,directories=no,menubar=no,copyhistory=no,location=no");
	   //window.showModalDialog(Path,"","dialogHeight:"+Height+"px;dialogWidth:"+Width+"px;center:yes;edge:raised;resizable:no;scroll:no;help:no;status:no");
	}
	function PopupWin1(Path,Height,Width,Title)
	{
		window.open(Path,Title,"Height="+Height+",width="+Width+",left="+((screen.width/2)-(Width/2))+",top="+((screen.height/2)-(Height/2))+",resizable=no,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,copyhistory=no,location=no");
	   //window.showModalDialog(Path,"","dialogHeight:"+Height+"px;dialogWidth:"+Width+"px;center:yes;edge:raised;resizable:no;scroll:no;help:no;status:no");
	}
	
	function ViewImage(ImageName,Height,Width)
	{
		//alert(ImageName);
		var winl = ((screen.width/2)-(Width/2));
		var wint = ((screen.height/2)-(Height/2));
		//alert(DetArr.length+DetArr[0]+DetArr[1]+DetArr[2]);
		winprops = 'height='+Height+',width='+Width+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,toolbar=no,status=no,directories=no,menubar=no,copyhistory=no,location=no';
		var msgWindow = window.open('','',winprops);
		msgWindow.document.open();
		msgWindow.document.write('<title>مرحبا بك في تربية نت</title><body bgcolor="#f6f8f4" onBlur="self.close()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width=100% height=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=middle align=center><IMG BORDER="0" SRC="' + ImageName + '"></td></tr></table></body>');
		msgWindow.document.close();
	}
	function ViewFlash(ImageName)
	{
		//alert(ImageName);
		//Width = 
		//var winl = ((screen.width/2)-(Width/2));
		//var wint = ((screen.height/2)-(Height/2));
		//alert(DetArr.length+DetArr[0]+DetArr[1]+DetArr[2]);'height='+Height+',width='+Width+',top='+wint+',left='+winl+',
		winprops = 'resizable=no,scrollbars=no,toolbar=no,status=no,directories=no,menubar=no,copyhistory=no,location=no';
		var msgWindow = window.open('','',winprops);
		msgWindow.document.open();
		
		ImgBnr	= "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"  ID=\"Object1\" VIEWASTEXT>";
										ImgBnr	+= "<param name=\"movie\" value=\""+ImageName+"\">";
										ImgBnr	+= "<param name=\"quality\" value=\"high\">";
										ImgBnr	+= "<embed src=\""+ImageName+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" ></embed>";
										ImgBnr	+= "</object>";
		
		msgWindow.document.write('<title>مرحبا بك في تربية نت</title><body bgcolor="#f6f8f4" onBlur="self.close()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width=100% height=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=middle align=center>' + ImgBnr + '</td></tr></table></body>');
		msgWindow.document.close();
	}
	function IsValidEmail(Email)
	{
		var regex = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ ;//  /^[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,3}$/
		//alert(Email + "\n" + regex.test(Email));
		if (!regex.test(Email)) 
			return (false);
		else
			return (true);   

	}
	
	
	function IsValidUrl(Url)
	{

		var regex = /^https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?$/ ;
		if (!regex.test(Url)) 
			return (false);
		else
			return (true);   

	}
	
	
	
	
	/*function IsValidEmail(Email)
	{
		var regex = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ ;//  /^[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,3}$/
		//alert(Email + "\n" + regex.test(Email));
		if (!regex.test(Email)) 
			return (false);
		else
			return (true);   

	}*/
	
	function ChangePage(id)
	{
		// save the page clicked
		document.all.PageNumber.value = id;
		// call the __doPostBack function to post back the form and execute the PageClick event
		__doPostBack('PageClick','');
	}
	
	function ChangePage()
	{
		// save the page clicked
		document.all.PageNumber.value = document.FrmTrby.PagesDisplay.options[document.FrmTrby.PagesDisplay.selectedIndex].value;
		// call the __doPostBack function to post back the form and execute the PageClick event
		__doPostBack('PageClick','');
	}
	
	function GetNavigation(Type,ID)
	{
		switch(Type)
		{
			case 1:
				window.location = "/Articles/ArticleDetailes.aspx?ArtId="+ID;
				break;
			case 2:
				window.location = "/Articles/FeedbackDetailes.aspx?FdbId="+ID;
				break;
			case 3:
				window.location = "/Articles/ArticleDetailes.aspx?ArtId="+ID;
				break;
			case 4:
				window.location = "/SpSections/ArticleDetailes.aspx?ArtId="+ID;
				break;
			case 5:
				window.location = "/SpSections/FeedbackDetailes.aspx?FdbId="+ID;
				break;
			case 6:
				window.location = "/SpSections/ArticleDetailes.aspx?ArtId="+ID;
				break;
			case 7:
				window.location = "/Questions/ViewQuestions.aspx?QId="+ID;
				break;
			case 8:
				window.location = "/Publishes/Detailes.aspx?BkId="+ID;
				break;
			case 9:
				window.location = "/Library/Detailes.aspx?BkId="+ID;
				break;
			case 10:
				window.location = "/Experiance/ViewExperiences.aspx?ExpId="+ID;
				break;
			case 11:
				window.location = "/Cases/default.aspx?CasId="+ID;
				break;
			case 12:
				window.location = "/LinksCenter/ViewSite.aspx?LinkId="+ID;
				break;
			case 13:
				window.location = "/Participation/View.aspx?PrtcpId="+ID;
				break;
		}
	}