var nMainMenuCurrPage=0, nLastMenuID=0;
var arrMenuWidth=[0,132,91,85,188,128,73,98];
var arrMenuLeftPoz=[0,5,132,218,298,481,604,672];
var oMenuIimer;

if(sCurrLang=="he"){
	arrMenuWidth=[0,110,110,80,140,132,93,125];
	arrMenuLeftPoz=[0,660,555,480,345,218,130,10];	
}

function fMainMenuBG(nMenuID, bOver){
	if(!bWebsiteLoaded) return;
	oMenuIimer=null;
	var obj=document.getElementById("oSelectedMenu");
	if(bOver){
		obj.style.width=arrMenuWidth[nMenuID] +"px";
		obj.style.left=arrMenuLeftPoz[nMenuID] +"px";		
		obj.style.display="block";		
		nLastMenuID=nMenuID;
	}
	else{
		if(nLastMenuID!=nMainMenuCurrPage) obj.style.display="none";
	}
}

function fMainMenuRestart(){
	if(nLastMenuID!=nMainMenuCurrPage) oMenuIimer=setTimeout(fMainMenuRestartPoz,1000);
}

function fMainMenuRestartPoz(){
	if(!oMenuIimer) return;
	if(nMainMenuCurrPage){
		oMenuIimer=null;
		var obj=document.getElementById("oSelectedMenu");
		obj.style.width=arrMenuWidth[nMainMenuCurrPage] +"px";
		obj.style.left=arrMenuLeftPoz[nMainMenuCurrPage] +"px";		
		obj.style.display="block";		
		nLastMenuID=nMainMenuCurrPage;
	}
}

function fSlideTitle(txt){
	var obj=document.getElementById("oSlideTitle")
	if(txt)
		obj.outerHTML='<marquee id="oSlideTitle" style="width:90px; height:20px;" width="90" height="20" direction="up" behavior="slide" scrollamount="5" scrolldelay="10">'+ txt +'</marquee>';
	else
		obj.innerHTML="";
}

		var oScrollThumbsTimer;
		function fScrollThumbs(bMove, nDirection){
			if(bMove)
				oScrollThumbsTimer=setInterval("fDoScroll("+ nDirection +")", 40)
			else
				clearInterval(oScrollThumbsTimer);
		}

		function fDoScroll(nDirection){
			var obj=document.getElementById("oConnectedUsers");
			obj.scrollTop=(nDirection==1 ? obj.scrollTop+1 : obj.scrollTop-1);
		}





// <script type="text/javascript">
//	fWriteFlashObject(nID, sUrl, nWidth, nHeight, sBG, bTransparent, sCssClass, bLiveCon)
// </script>

function fWriteFlashObject(sID, sUrl, nWidth, nHeight, sBG, bTransparent, sCssClass, bLiveCon){
	var sSSL=(location.href.indexOf("https")>=0 ? "s" : "");
	document.write('<object id="'+ sID +'" width="'+ nWidth +'" height="'+ nHeight +'" class="'+ sCssClass +'" swLiveConnect="'+ (bLiveCon ? 'true' : 'false') +'" codebase="http"+ sSSL +"://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">')
	document.write('<param name="movie" value="'+ sUrl +'">')
	if(bTransparent) document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="'+ sBG +'" />');
	document.write('<param name="quality" value="high">');
	document.write('<embed id="'+ sID +'" src="'+ sUrl +'" width="'+ nWidth +'" height="'+ nHeight +'" class="'+ sCssClass +'" bgcolor="'+ sBG +'" '+ (bTransparent ? 'wmode="transparent"' : '') +' quality="high"  TYPE="application/x-shockwave-flash" PLUGINSPAGE="http"+ sSSL +"://www.macromedia.com/go/getflashplayer"></embed>')
	document.write('</object>');
}

function fWriteFlashToObject(sObjName, sID, sUrl, nWidth, nHeight, sBG, bTransparent, sCssClass){
	var str=""
	str+='<object id="'+ sID +'" width="'+ nWidth +'" height="'+ nHeight +'" class="'+ sCssClass +'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'
	str+='<param name="movie" value="'+ sUrl +'">'
	if(bTransparent) str+='<param name="wmode" value="transparent" />'
	str+='<param name="bgcolor" value="'+ sBG +'" />'
	str+='<param name="quality" value="high">'
	str+='<embed id="'+ sID +'" src="'+ sUrl +'" width="'+ nWidth +'" height="'+ nHeight +'" class="'+ sCssClass +'" bgcolor="'+ sBG +'" '+ (bTransparent ? 'wmode="transparent"' : '') +' quality="high"  TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed>'
	str+='</object>'

	document.getElementById(sObjName).innerHTML=str;
}


function fWriteMovieObject(sUrl){
	if(!sUrl) return false;
	var nHeight=0, sExt=sUrl.substr(sUrl.length-3, sUrl.length);
	if(sExt=="wma" || sExt=="mp3")
		nHeight=150
	else{
		if(sExt=="wmv")
			nHeight=320
		else
			return false;
	}

	document.write('<object width="320" height="'+ nHeight +'" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">')
		document.write('<param name="url" value="'+ sUrl +'">')
		document.write('<param name="uimode" value="full">');
		document.write('<param name="autostart" value="-1">');
		document.write('<param name="rate" value="1">');
		document.write('<param name="balance" value="0">');
		document.write('<param name="currentPosition" value="-1">');
		document.write('<param name="defaultFrame" value>');
		document.write('<param name="playCount" value="1">');
		document.write('<param name="currentMarker" value="0">');
		document.write('<param name="invokeURLs" value="-1">');
		document.write('<param name="baseURL" value>');
		document.write('<param name="volume" value="50">');
		document.write('<param name="mute" value="0">');
		document.write('<param name="stretchToFit" value="0">');
		document.write('<param name="windowlessVideo" value="0">');
		document.write('<param name="enabled" value="-1">');
		document.write('<param name="enableContextMenu" value="-1">');
		document.write('<param name="fullScreen" value="0">');
		document.write('<param name="SAMIStyle" value>');
		document.write('<param name="SAMILang" value>');
		document.write('<param name="SAMIFilename" value>');
		document.write('<param name="captioningID" value>');
		document.write('<param name="enableErrorDialogs" value="0">');
		document.write('<embed width="320" height="320" src="'+ sUrl +'" filename="'+ sUrl +'" autostart="True" showcontrols="True" showstatusbar="True" showdisplay="True" autorewind="True"></embed> ');
	document.write('</object>');
}


function fSoundFinished(fileurl){
//	alert( "fSoundFinished(" + fileurl + ")" );//
}

function fFlashSound(sObjName, sSoundFile, nWidth, nHeight, sOnpic, sOffpic, nVol){
	var obj=document.getElementById(sObjName)
	if(!sSoundFile || !obj) return;
	if(!sOnpic) sOnpic="/images/soundon.png"
	if(!sOffpic) sOffpic="/images/soundoff.png"
	if(!nVol) nVol=30
	var sFlashVars='onpic='+sOnpic+'&offpic='+sOffpic+'&file='+sSoundFile+'&sndvol='+nVol

	if(!nWidth) nWidth=1
	if(!nHeight) nHeight=1

	var sSSL=(location.href.indexOf("https")>=0 ? "s" : "");
	var str="";
	str+='<object class="clsFlashSound" id="oFlashSound" width="'+ nWidth +'" height="'+ nHeight +'" swLiveConnect="true" codebase="http"+ sSSL +"://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'
	str+='<param name="movie" value="/flash/sound2.swf">'
	str+='<param name="FlashVars" value="'+sFlashVars+'">'
	str+='<param name="scale" value="noscale" />'
	str+='<param name="salign" value="lt" />'
	str+='<param name="wmode" value="transparent" />'
	str+='<param name="bgcolor" value="#ffffff" />'
	str+='<param name="quality" value="high">'
//	str+='<embed id="oFlashSound" class="clsFlashSound" src="/flash/sound2.swf" FlashVars="'+sFlashVars+'" width="'+ nWidth +'" height="'+ nHeight +'" scale="noscale" salign="lt" bgcolor="" '+ wmode="transparent" quality="high"  TYPE="application/x-shockwave-flash" PLUGINSPAGE="http"+ sSSL +"://www.macromedia.com/go/getflashplayer"></embed>'
	str+='</object>'

	obj.innerHTML=str;
}



// THIS FUNCTION GENERATES FAKE <A HREF="MAILTO:..."> TAG
function fPrintEmailLink(sUserName, sDomain, linkText, linkTitle, cssClass, sSubject, sBody){
	var sQS=""
	if(!sUserName || !sDomain) return false;
	var sLinkText=linkText||null, sLinkTitle=linkTitle||null, sCssClass=cssClass||null;
	if(!sLinkText) sLinkText=sUserName +"@"+ sDomain;

	if(sSubject || sBody) sQS+="?";
	if(sSubject) sQS+="subject="+ sSubject;
	if(sSubject && sBody) sQS+="&";
	if(sBody) sQS+="body="+ sBody;

	if(sLinkTitle) sLinkTitle=" title='"+ sLinkTitle +"'"
	if(sCssClass) sCssClass=" class='"+ sCssClass +"'"

	document.write("<a "+ sLinkTitle +" "+ sCssClass +" href='m&#97;ilto:"+ sUserName +"&#64;"+ sDomain + sQS +"'>"+ sLinkText +"</a>")
}

var nLastQnaClicked;
function fQuestions(qID){
	if(nLastQnaClicked && nLastQnaClicked!=qID){
		document.getElementById("oQuestion"+ nLastQnaClicked).className="clsIndexItem clsHideInPrint";
		document.getElementById("oAnswer"+ nLastQnaClicked).style.display="none";
		document.getElementById("oShowQuestionBtn"+ nLastQnaClicked).style.display="inline";
		document.getElementById("oHideQuestionBtn"+ nLastQnaClicked).style.display="none";
	}

	if(document.getElementById("oAnswer"+ qID).style.display=="block"){
		document.getElementById("oQuestion"+ qID).className="clsIndexItem clsHideInPrint";
		document.getElementById("oAnswer"+ qID).style.display="none";
		document.getElementById("oShowQuestionBtn"+ qID).style.display="inline";
		document.getElementById("oHideQuestionBtn"+ qID).style.display="none";
	}
	else{
		document.getElementById("oQuestion"+ qID).className="clsIndexItem";
		document.getElementById("oAnswer"+ qID).style.display="block";
		document.getElementById("oShowQuestionBtn"+ qID).style.display="none";
		document.getElementById("oHideQuestionBtn"+ qID).style.display="inline";
	}

	nLastQnaClicked=qID;
}

function PopUp(url, width, height){
	window.open(url,null,"width="+(width||500)+", height="+(height||300)+", scrollbars=yes, resizable=no")
}

function fPopupImage(url){
	if(url) window.open("imgPopUp.asp?url="+ url,"winPopupImage","width=5,height=5,resizable=yes")
}

function fSendToFriend(isEng){
	window.open((isEng?"/English":"") + "/Send2Friend.asp?title="+ document.title, "winSendToFriend", "width=400,height=390");
}

function fPrintPage(){
	window.open('/print.asp', 'winPrint', 'width=700, height=400, scrollbars=yes');
}

