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_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_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 print_function(str,style,TitleVars)
{ 
	var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
		disp_setting+="scrollbars=yes,width=600, height=700, left=100, top=100";
	var content_value = (document.getElementById("printText").innerHTML);

	var docprint=window.open("","",disp_setting);

	docprint.document.open();
	docprint.document.write('<html><head><title>Jamalouki</title></head><link rel="stylesheet" type="text/css" media="screen" href="styles/'+style+'" />');
	docprint.document.write('<body onLoad="self.print(); self.close();" style="margin:0px;padding:20px;background:#ffffff; direction:rtl;" >');
	docprint.document.write('<object id="FlashID3" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="250" height="84"><param name="movie" value="swf/logo.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="flashvars" value="mycolor='+str+'"/><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><object type="application/x-shockwave-flash" data="swf/logo.swf" width="250" height="84"><param name="flashvars" value="mycolor='+str+'"/><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p></div></object></object>');
	docprint.document.write('<br>');
	docprint.document.write('<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="200" height="32"><param name="movie" value="swf/title.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="flashvars" value="'+TitleVars+'"/><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><object type="application/x-shockwave-flash" data="swf/title.swf" width="200" height="32"><param name="flashvars" value="'+TitleVars+'"/><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p></div></object></object>');
	docprint.document.write('<div  class="text">'+content_value+'</div>');
	docprint.document.write('</body></html>');
	docprint.document.close(); 
 	docprint.focus();
}
/*<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="250" height="84" title="Logo">
  <param name="flashvars" value="mycolor='+str+'">
  <param name="quality" value="high">
  <param name="flashvars" value="swf/logo.swf">
  <embed src="swf/logo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="84" flashvars="mycolor='+str+'"></embed>
</object>*/
function slideDiv(div_id){
	//alert(div_id);
	$("#"+div_id).animate("left:100px");
}


function showHideTables(x)
{
	var m=MM_findObj("box"+x);
	for(var i=1; i<=2; i++){
	MM_findObj("box"+i).style.display='none';
	}
	m.style.display='';
}
function showHideBoxes(x)
{
	var m=MM_findObj("boxes"+x);
	for(var i=1; i<=2; i++){
	MM_findObj("boxes"+i).style.display='none';
	}
	m.style.display='';
}
/**********************************************************************************************/
function OpenEmail(URL){
     OpenWnd('Forward.aspx?pageid=271&URL='+URL, 'Email',550,530, 'no');
}

function OpenWnd(mypage, myname, w, h, scroll)

{
      var winl = (screen.width - w) / 2;
      var wint = (screen.height - h) / 2;
      winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=No'
      win = window.open(mypage, myname, winprops)
      if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}
function ResetForm(){
form1.reset()
}



function toggleBlock(d, i)
{
	var e = MM_findObj(d);
	var f = MM_findObj(i);
	if (d == "table1"){
		
		e.style.display = "block";
		MM_findObj("Image1").src = "images/mainpage/pic1on.gif";
		f.style.display = "none";
		MM_findObj("Image2").src = "images/mainpage/pic2.gif";
	} else {
		e.style.display = "block";
		MM_findObj("Image1").src = "images/mainpage/pic1.gif";
		f.style.display = "none";
		MM_findObj("Image2").src = "images/mainpage/pic2on.gif";
	}
}

/***Collapse side menus functions*/
var slide_speed = 500;

function collapseToggle(div_id) 
{
	var visible = $("#"+div_id).css("display")=="block" ? 1 : 0;
	if(visible) {
		$("#"+div_id).slideUp(slide_speed);
		prev_div_id = "";
	} else {
		// hide prev div
		if(typeof prev_div_id != "undefined") {
			if(prev_div_id != div_id) {
				$("#"+prev_div_id).slideUp(slide_speed);
			}
		}
		
		prev_div_id = div_id
		$("#"+div_id).slideDown(slide_speed);	
	}
}

/***Comments functions*/
function ShowCommentBox(){

	var n=MM_findObj('CommentBox');

	n.style.display='';

	}

function HideCommentBox(){

	var n=MM_findObj('CommentBox');

	n.style.display='none';

	}

function galleryText(x,maxnumber)
{
	var m=MM_findObj("GALL"+x);
	for(var i=1; i<=maxnumber; i++){
	MM_findObj("GALL"+i).style.display='none';
	}
	m.style.display='';
}

function ValidateJoinNewsletter(source, args){
	if(MM_findObj("UcHeader1_txtEmail").value=="" || MM_findObj("UcHeader1_txtEmail").value=="join our mailing list" || IsValidEmailAddress(MM_findObj("UcHeader1_txtEmail")) == false )
		args.IsValid=false;
	else
		args.IsValid=true;
	}
function IsValidEmailAddress(txt){
	if(txt.value !=""){ 
		var goodEmail = txt.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmail){
			return true;
		} else {
			return false;
		}
	}
}
