//
//<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
//<meta http-equiv="Content-Language" content="he"><meta name="robots" content="noindex,nofollow">
//**************************************************************************************************************
//                                      Generic Fuctions
//**************************************************************************************************************

/////////////////////////////////////////////////////////////////////////////
function frm_validation(formName, formField, thanksDetails)
/////////////////////////////////////////////////////////////////////////////
{	
	var msg, i;	
	i =0;
	msg = "";
	//////mandatory field check//////////
	for (var mandatoryCount in formField)
	{
	   if (formField[mandatoryCount].mand=='yes'){		  
			if (this[formName][formField[mandatoryCount].name].value==""){
				msg = msg  + formField[mandatoryCount].alertIt + "is a mandatory field!";
				i++;
				alert (msg);
				this[formName][formField[mandatoryCount].name].focus();
				window.event.cancelBubble=true;
				window.event.returnValue=0;
				return false;				
			}
		}
		
	}	
	//////field type check/////////////
	for (var typeCount in formField) {
		if(this[formName][formField[typeCount].name].value!="" || formField[typeCount].type=='compare'){
			    if(formField[typeCount].type=='number'){				
						if (!(isANumber(this[formName][formField[typeCount].name].value, formField[typeCount].alertIt))) {
						i++;
						this[formName][formField[typeCount].name].focus();
						this[formName][formField[typeCount].name].select();
						window.event.cancelBubble=true;
						window.event.returnValue=0;
						return false;
						}				
				}else if(formField[typeCount].type=='email'){					
					if (!(emailCheck(this[formName][formField[typeCount].name].value))) {
					i++;
					this[formName][formField[typeCount].name].focus();
					this[formName][formField[typeCount].name].select();
					window.event.cancelBubble=true;
					window.event.returnValue=0;
					return false;
					}
				}else if(formField[typeCount].type=='url'){
					if (!(urlCheck(this[formName][formField[typeCount].name].value))) {
					i++;
					this[formName][formField[typeCount].name].focus();
					this[formName][formField[typeCount].name].select();
					window.event.cancelBubble=true;
					window.event.returnValue=0;
					return false;
					}
				}else if(formField[typeCount].type=='pass'){					
					if (!(passCheck(this[formName][formField[typeCount].name].value, formField[typeCount].passVal))) {
					i++;
					this[formName][formField[typeCount].name].focus();
					this[formName][formField[typeCount].name].select();
					window.event.cancelBubble=true;
					window.event.returnValue=0;
					return false;					
					}	
				}else if(formField[typeCount].type=='select'){					
					if (!(selectCheck(this[formName][formField[typeCount].name].value, formField[typeCount].selectValueCheck))) {
					i++;
					this[formName][formField[typeCount].name].focus();					
					window.event.cancelBubble=true;
					window.event.returnValue=0;
					return false;
					}
				}else if(formField[typeCount].type=='radio'){					
					if (!(radioCheck(this[formName][formField[typeCount].name], formField[typeCount].alertIt))) {
					i++;					
					window.event.cancelBubble=true;
					window.event.returnValue=0;
					return false;
					}
				}else if (formField[typeCount].type=='compare'){
					//alert(this[formName][formField[typeCount].compareObject[0].name].value)
					var compareValue=0
					var compareArray=[];
					for (var compareCount in formField[typeCount].compareObject){
						if(this[formName][formField[typeCount].compareObject[compareCount].name].value!=''){
							compareValue+=1;							
						}
						compareArray[compareCount]=formField[typeCount].compareObject[compareCount].alertIt
					}					
					if (compareValue==0){
						alert("One of the following fields is mandatory: " + compareArray)
						i++;
						this[formName][formField[typeCount].compareObject[0].name].focus();						
						window.event.cancelBubble=true;
						window.event.returnValue=0;
						return false;
					}else{
						for (var compareTypeCount in formField[typeCount].compareObject){
						 if(this[formName][formField[typeCount].compareObject[compareTypeCount].name].value!='') {
							//alert(formField[typeCount].compareObject[compareTypeCount].type)
							if(formField[typeCount].compareObject[compareTypeCount].type=="email"){
								if (!(emailCheck(this[formName][formField[typeCount].compareObject[compareTypeCount].name].value))) {
								i++;
								this[formName][formField[typeCount].compareObject[compareTypeCount].name].focus();
								this[formName][formField[typeCount].compareObject[compareTypeCount].name].select();
								window.event.cancelBubble=true;
								window.event.returnValue=0;
								return false;
								}
							}else if(formField[typeCount].compareObject[compareTypeCount].type=="url"){
								if (!(urlCheck(this[formName][formField[typeCount].compareObject[compareTypeCount].name].value))) {
								i++;
								this[formName][formField[typeCount].compareObject[compareTypeCount].name].focus();
								this[formName][formField[typeCount].compareObject[compareTypeCount].name].select();
								window.event.cancelBubble=true;
								window.event.returnValue=0;
								return false;
								}
							}
						  }
						}
					}					
					//alert(this[formName][[formField[typeCount].compareObject1].name])
					//if(this[formName][formField[typeCount].compareObject1].name){
					//}	
						//(formField[typeCount].compareObject1);
						//(formField[typeCount].compareObject2);
				}
			}
		}		

	//////field length field check//////////
	for (var maxLengthCount in formField)
	{

		/*if(!(formField[maxLengthCount].maxLength==null)){
			alert(formField[maxLengthCount].maxLength)
			var theFuck = (this[formName][formField[maxLengthCount].name].value)
			alert(theFuck.length)			
			}*/
		
		if(!(formField[maxLengthCount].maxLength==null)){  
			var theCheckedValue = (this[formName][formField[maxLengthCount].name].value)
			if ((theCheckedValue.length)>(formField[maxLengthCount].maxLength)){
				msg = msg  + formField[maxLengthCount].maxLength + " maximum characters allowed!";
				i++;
				alert (msg);
				this[formName][formField[maxLengthCount].name].focus();
				this[formName][formField[maxLengthCount].name].select();
				window.event.cancelBubble=true;
				window.event.returnValue=0;
				return false;
			}
		}
		
	}
	//////////// end  length field check
	
	if (i==0 && !(thanksDetails.name == 'noThanks') && (thanksDetails.suffixWhole == null)){
			alert(" Thank You " + this[formName][thanksDetails.name].value + ', ' + thanksDetails.suffix)
			}else if (i==0 && !(thanksDetails.suffixWhole == null)) {		
			alert(thanksDetails.suffixWhole + ' ' + this[formName][thanksDetails.name].value)			
	}else{
		if(!(thanksDetails.callBack==null)){			
			//callBack();
			this[thanksDetails.callBack]()
		}
	}

	
}
//////////////end frm_validation main function///////////////
/////////////////////////////
function radioCheck(radioID, radioAlert)
/////////////////////////////
{
	var radio_choice = false;
	for (counter = 0; counter < radioID.length; counter++){
		if (radioID[counter].checked)
		radio_choice = 1; 
	}	
	if (!radio_choice){
		alert(radioAlert)
		radio_choice = 0
		window.event.cancelBubble=true;
		window.event.returnValue=0;
	}
	return radio_choice;
}


///////////////////////////////////
function selectCheck(selectField, selectValueCheckIt)
///////////////////////////////////
{
	selectAnswer = 1;	
	if (selectField == selectValueCheckIt)
	{
		selectAnswer = 0;
		alert('Please select an option from the list');		
		window.event.cancelBubble=true;
		window.event.returnValue=0;
	}
	return selectAnswer;	
}


///////////////////////////////////
function emailCheck(emailField)
///////////////////////////////////
{
	emailAnswer = 1;
	var emailCheck1=emailField.indexOf('@');
	var emailCheck2=emailField.indexOf('.');
	var emailCheck3=emailField.indexOf(' ');
	var emailCheck4=emailField.indexOf('\'')
	var emailCheck5=emailField.indexOf('\"')
	var emailCheck6=emailField.indexOf('\&')
	var emailCheck7=emailField.indexOf('\\')
	if (!(emailCheck1>0 && emailCheck2>0 && emailCheck3==-1 && emailCheck4==-1 && emailCheck5==-1 && emailCheck6==-1 && emailCheck7==-1))
	{
		emailAnswer = 0;
		alert('Please Enter a Valid Email');		
	}
	return emailAnswer;
}

///////////////////////////////////
function urlCheck(urlField)
///////////////////////////////////
{
	urlAnswer = 1;
	var urlCheck1=urlField.substr(0,7);	
	var urlCheck2=urlField.indexOf('.');
	var urlCheck3=urlField.indexOf(' ');	
	if (!(urlCheck1=="http://" && urlCheck2>0 && urlCheck3==-1))
	{
		urlAnswer = 0;
		alert('Please Enter a Valid URL');		
	}
	return urlAnswer;
}

///////////////////////////////////
function passCheck(passField, passFieldCompare)
///////////////////////////////////
{
	passAnswer = 1;
	var myPassField = passField.toUpperCase()
	if (!(myPassField == passFieldCompare))
	{
		passAnswer = 0;
		alert('Please Enter a Valid Security Code');		
	}
	return passAnswer;
}

////////////////////////////////////
function isANumber(number, message)
////////////////////////////////////
{
	answer = 1;
	for (var i=0; i<number.length; i++) {
		if ((number.charAt(i) != "0") && (!parseFloat(number.charAt(i)) && (number.charAt(i) != "+") && (number.charAt(i) != "-") && (number.charAt(i) != "/") && (number.charAt(i) != ":") && (number.charAt(i) != " "))) {
			answer = 0;
			alert("Please Enter a Valid" + message);
			break;
			}
		}	
		return answer;
	}
	
/////////////////////////////////////////////////////////////////////////////
function translateThisPage(url,lang)
/////////////////////////////////////////////////////////////////////////////
{
	//german = 'de'
	//spanish = 'es'
	//french = 'fr'
	//italian = 'it'
	//portuguese = 'pt'

	var curUrlLen = url.length-7
	url = url.substr(7,curUrlLen);//cut the 'http://' part
	var fullUrl = "http://translate.google.com/translate?u=http%3A%2F%2F" + url + "&langpair=en%7C" + lang + "&hl=en&ie=ISO-8859-1&prev=%2Flanguage_tools";
	openInnewWindow(fullUrl,800,600,1);
}

/////////////////////////////////////////////////////////////////////////////
function openWin(url,title,attrib) 
/////////////////////////////////////////////////////////////////////////////
{
	wref=window.open(url,title,attrib);
	wref.focus()
}

/////////////////////////////////////////////////////////////////////////////
function openInnewWindow(url,width,height,toolbar,top,left,title)
/////////////////////////////////////////////////////////////////////////////
{
	if(toolbar==1) {openWin(url,title,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height +' top=' + top + ' left=' + left)}
	else {openWin(url,title,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,movable=yes,resizable=no,width='+width+',height='+height  +' top=' + top + ' left=' + left)}
}

/////////////////////////////////////////////////////////////////////////////
function writeEMail(user, host)
/////////////////////////////////////////////////////////////////////////////
{
	var username = user
	var hostname = host
	document.write(username + "@" + hostname)
}

/////////////////////////////////////////////////////////////////////////////
function addbookmark(url, title)
/////////////////////////////////////////////////////////////////////////////
{
var bookmarkurl=url
var bookmarktitle=title
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

/////////////////////////////////////////////////////////////////////////////
function BlinkTxt()
/////////////////////////////////////////////////////////////////////////////
{
	if(document.getElementById && document.all){
        	obj = document.getElementsByTagName('blink');
        	for (var i=0; i<obj.length; i++){
        		if (obj[i].style.color=="black") {
        			obj[i].style.color="red";
    			}
    			else {
        			obj[i].style.color="black";
    			}
		}
    		setTimeout('BlinkTxt()',400);
    	}		
}

/////////////////////////////////////////////////////////////////////////////
function showhide(what)
/////////////////////////////////////////////////////////////////////////////
{
	
	myElement = (document.getElementById(what));
	
	if (myElement.style.display=='none'){		
	myElement.style.display='';	
	}
	else{
	myElement.style.display='none';	
	}
}

//general hide all show one
function hideAllShowOne(idPrefix, numObj)
{
	var myRandom=Math.floor(Math.random()*(numObj))+1;
	var myObj;
	for(i=1;i<=numObj;i++)
	{
		myObj = document.getElementById(idPrefix+i);
		myObj.style.display='none';
	}
	myObj = document.getElementById(idPrefix+myRandom);
	myObj.style.display='';
}

function get_ContactFormCase()
{
	var contactCase_input = document.getElementById("contact_v4_HD_ContactFormCase");
	var contactCase = contactCase_input.value;
	
	if(contactCase==null || contactCase=="")
	{
		contactCase = "1";
	}
	
	return contactCase;
}

//hide all
function hideAllButThis(publicPath,what,menuFreeText,publicIndication,what_h,podium_h)
{
	//getBz2.style.display='none';
	//getActive2.style.display='none';
	//getPersonal2.style.display='none';
	//getInfo2.style.display='none';
	
	myWhat = what.substring(0,1);	
	
	//get level 1
	switch(myWhat)
	{
	case "1":
	myLevel1 = "vMenuLevelOne2";
	myMainLevel1 = "vMenuLevelOne";
	myColor = "orange";
	myLevelText = "adCore&#8482; demo";
	break    
	
	case "2":
	myLevel1 = "vMenuLevelTwo2";
	myMainLevel1 = "vMenuLevelTwo";
	myColor = "green";
	myLevelText = "adCore&#8482; overview & features";	
	break 
	
	case "3":
	myLevel1 = "vMenuLevelThree2";
	myMainLevel1 = "vMenuLevelThree";
	myColor = "purple";
	myLevelText = "Find your solution";		
	break 
	
	case "4":
	myLevel1 = "vMenuLevelFour2";
	myMainLevel1 = "vMenuLevelFour";
	myColor = "gray";
	myLevelText = "Costs and payments";			
	break
	
	case "5":
	myLevel1 = "";
	myMainLevel1 = "";
	myColor = "";
	myLevelText = "Info";			
	break
	
	case "6":
	myLevel1 = "";
	myMainLevel1 = "";
	myColor = "";
	
	//set to adCore if not a podium contact case
	if(get_ContactFormCase()!="1")
	{
		myLevelText = "adCore&#8482;";			
	}
	else
	{
		myLevelText = "";
		menuFreeText = "Contact Us"
	}
	break	
	
	case "":
	myLevel1 = "";
	myLevelText = "";
	myMainLevel1 = "";
	myColor = "";
	break
	}
				
	if(myLevel1!="")
	{
	//close all and open level1
	//showhide(myLevel1);	
	//indicate level 2
		changeStyle(what,"a_indicate",myMainLevel1, myColor);	
	}	
	
	//get level 2 name from hardCode
		//English case
	if(!curentPageCheck("_h.aspx") && !curentPageCheck("-l1"))
	{
		switch(what)
		{
		case "1_1":
		myLevel2 = "Online demo";
		myLink = publicPath+"1_1_OnlineDemo.aspx";
		break
		
		case "1_2":
		myLevel2 = "Schedule a 1 on 1 virtual tour";
		myLink = publicPath+"1_2_ScheduleVirtualTour.aspx";
		break
		
		case "2_1":
		myLevel2 = "Overview";
		myLink = publicPath+"2_1_Overview.aspx";
		break
		
		case "2_2":
		myLevel2 = "Integration";
		myLink = publicPath+"2_2_Integration.aspx";
		break
		
		case "2_3":
		myLevel2 = "Maximization";
		myLink = publicPath+"2_3_Maximization.aspx";
		break
		
		case "2_4":
		myLevel2 = "Reporting";
		myLink = publicPath+"2_4_Reporting.aspx";
		break
		
		case "2_5":
		myLevel2 = "Client management";
		myLink = publicPath+"2_5_ClientManagement.aspx";
		break
		
		case "2_6":
		myLevel2 = "Web Analytics";
		myLink = publicPath+"2_6_WebAnalytics.aspx";
		break
		
		case "3_1":
		myLevel2 = "SEM agencies";
		myLink = publicPath+"3_1_SEMagencies.aspx";
		break
		
		case "3_2":
		myLevel2 = "Direct advertisers";
		myLink = publicPath+"3_2_Directadvertisers.aspx";
		break
		
		case "4_1":
		myLevel2 = "SEM plan";
		myLink = publicPath+"4_1_SEMagencies.aspx";
		break    
		
		case "4_2":
		myLevel2 = "Direct advertisers plan";
		myLink = publicPath+"4_2_Directadvertisers.aspx";
		break
		
		case "5_1":
		myLevel2 = "News";
		myLink = publicPath+"mainNews.aspx";
		break
		
		case "5_2":
		myLevel2 = "Articles";
		myLink = publicPath+"articles.aspx";
		break
		
		case "5_4":
		myLevel2 = "Internet Glossary";
		myLink = publicPath+"glossary.aspx";
		break
		
		case "6_1":
		if(get_ContactFormCase()=="2")
		{
			myLevel2 = "Get a guest login";
			myLink = publicPath+"innerForm.aspx";
		}
		else if(get_ContactFormCase()=="3")
		{
			myLevel2 = "Registration form";
			myLink = publicPath+"innerForm.aspx";
		}
		else if(get_ContactFormCase()=="4")
		{
			myLevel2 = "Partnership program";
			myLink = publicPath+"innerForm.aspx";
		}
		else
		{
			myLevel2 = "";
			myLink = "";
		}
		break
		
		case "":
		myLevel2 = "";
		myLink = "";
		break
		}
	}
	
	makeIndication(publicPath, myLevelText, myLevel2, myLink, menuFreeText,publicIndication,podium_h);		
}

function makeIndication(publicPath, myLevel1, myLevel2, myLink, menuFreeText,publicIndication,podium_h)
{
	
	//this is to send with quick contact
	quickIndication = document.getElementById("contactForm_quickIndication");	
	
	if(publicIndication!="" && publicIndication!=null)
	{
		myIndication = document.getElementById("indication2");
		
		//english version
		if(!curentPageCheck("_h.aspx") && !curentPageCheck("-l1"))
		{
			myIndicationStr = "<a href="+publicPath+"default.aspx>Podium</a> &gt; ";
			
			myIndicationStr+= myLevel1 + " &gt; ";
			myIndicationStr+="<a href="+myLink+">" + myLevel2 + "</a>";	
			
			myIndicationStr+= publicIndication;
		}
		//hebrew version
		else
		{
			myIndicationStr= "<a href="+publicPath+"default_h.aspx>"+podium_h+"</a> &gt; ";
			myIndicationStr+= myLevel1;			
			myIndicationStr+=" &gt;  <a href="+myLink+">" + myLevel2 + "</a>";
			
			myIndicationStr+= publicIndication;
		}
			
		myIndication.innerHTML = myIndicationStr;
	}
	//static level3
	else if(menuFreeText!="")
	{
		myIndication = document.getElementById("indication2");		
		
		//english version
		if(!curentPageCheck("_h.aspx") && !curentPageCheck("-l1"))
		{
			myIndicationStr = "<a href="+publicPath+"default.aspx>Podium</a> &gt; ";
			
			//ADvance case
			if(myLevel1!=""	)
			{
				myIndicationStr+= myLevel1 + " &gt; ";
				myIndicationStr+="<a href="+myLink+">" + myLevel2 + "</a> &gt; ";
			}
			
			myIndicationStr+= "<b>"+menuFreeText+"</b>"
		}
		//hebrew version
		else
		{						
			if(myLevel1!=""	)
			{
				myIndicationStr= "<a href="+publicPath+"default_h.aspx>"+podium_h+"</a> &gt; ";
				myIndicationStr+= myLevel1;
				
				myIndicationStr+=" &gt;  <a href="+myLink+">" + myLevel2 + "</a> &gt; ";
				myIndicationStr+= "<b>"+menuFreeText+"</b>";
			}
			else
			{
				//ADvance case
				myIndicationStr = "<a href="+publicPath+"default_h.aspx>"+podium_h+"</a> &gt; ";
				myIndicationStr += "<b>"+menuFreeText+"</b>";
				
			}
		}
			
		myIndication.innerHTML = myIndicationStr;		
	}
	//static level2
	else
	{
		myIndication = document.getElementById("indication2");
		
		//english version
		if(!curentPageCheck("_h.aspx") && !curentPageCheck("-l1"))
		{
			myIndicationStr = "<a href="+publicPath+"default.aspx>Podium</a> &gt; ";
			
			myIndicationStr+= myLevel1 + " &gt; ";
			myIndicationStr+="<b>" + myLevel2 + "</b>";	
		}
		//hebrew version
		else
		{
			myIndicationStr= "<a href="+publicPath+"default_h.aspx>"+podium_h+"</a> &gt; ";
			myIndicationStr+= myLevel1; 		
			
			myIndicationStr+=" &gt;  <b>" + myLevel2 + "</b>";
		}
			
		myIndication.innerHTML = myIndicationStr;
	}
	//this is to send with quick contact
	if(quickIndication)
	{		
		quickIndication.value=stripHTML(myIndicationStr);		
	}
}

//change level2
function changeStyle(what, theStyle, what2, theStyle2)
{	
	myElement = (document.getElementById(what));
	
	if(myElement==null) return;
	
	myElement.className = theStyle;
	myElement2 = (document.getElementById(what2));
	myElement2.className=theStyle2;	
	myBlah = document.getElementById(what2+"_main");	
	myBlah.onmouseover=function () {};
	myBlah.onmouseout=function () {};
	//this sets the h1 for service pages to the package color
	myServiceHeader = (document.getElementById("serviceHeader"));
	if(myServiceHeader)
	{
		myServiceHeader.className=theStyle2;
	}	
}

/////////////////////////////////////////////////////////////////////////////
function printVersion()
/////////////////////////////////////////////////////////////////////////////
{		
	for (var printCount=1; printCount<=4; printCount++){
		var printID="printVersion"+printCount	
   		printVar=document.getElementById(printID);
		printVar.style.display='none'		   
   }
   //printVar=document.getElementById("printVersion9");
   //printVar.style.visibility='visible'
   
   mainWidth=document.getElementById("mainTable");
   mainWidth.width='720';
   mainPrint=document.getElementById("printButton");
   mainPrint.style.display='';
   /*mainWidth1=document.getElementById("mainTable1");
   mainWidth2=document.getElementById("printVersion5");
   mainWidth3=document.getElementById("printVersion7");
   myFooter=document.getElementById("footer");
   mainWidth.align='center';
   mainWidth.style.paddingLeft='35px';
   mainWidth1.width='580';
   mainWidth1.align='center';
   mainWidth2.width='1';      
   mainWidth3.style.display='';   
   myFooter.width='530';
   */
}
/////////////////////////////////////////////////////////////////////////////
function printVersion2()
/////////////////////////////////////////////////////////////////////////////
{
	for (var printCount=1; printCount<=10; printCount++){
		var printID="printVersion"+printCount	
   		printVar=document.getElementById(printID);
		printVar.style.display='none'		   
   }
   //printVar=document.getElementById("printVersion9");
   //printVar.style.visibility='visible'
   
   mainWidth=document.getElementById("mainTable");
   mainWidth1=document.getElementById("mainTable1");
   mainWidth2=document.getElementById("mainTable2");
   mainPrint=document.getElementById("printButton");
   mainWidth.width='550';
   mainWidth1.width='550';
   mainWidth2.width='570'
   mainPrint.style.display='';   
}


function printSuffixPrefixSwitch()
{
	var checkIDString=window.location.href;
	IDPassCheck=checkIDString.indexOf('?')						
	if(IDPassCheck>0){printItID='&printIt=yes'}
	else {printItID='?printIt=yes'}	
	openInnewWindow(window.location.href+printItID,720,450,1)
}

/////////////////////////////////////////escape yellow fields/////////////////////////////////
  if(window.attachEvent)
  window.attachEvent("onload",restoreStyles);	  
 
  function restoreStyles(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++)	
      inputList[i].style.backgroundColor = "";
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++)
      selectList[i].style.backgroundColor = "";	  
  }
/////////////////////////////////////////end escape yellow fields/////////////////////////////////

/////////self close/////////////
function selfClose(howFast)
{
setTimeout('selfCloseMe()',howFast);
}
function selfCloseMe()
{
	window.close()
}
///////page name//////
var sPath = window.location.pathname;
var myPage = sPath.substring(sPath.lastIndexOf('/') + 1);

///////fix page title/////
function fixPageTitle(myPageTitle)
{
	var myOnlyPageTitle = myPageTitle;	
	document.title = myOnlyPageTitle;	
}

//////////Combo Box (Select) Switch Generic functions////////////////
function childCombo(iID, sName, iTypeID) {
	this.ID = iID;
	this.Name = sName;
	this.TypeID = iTypeID;
}
function childComboSwitch(frmName,cmbMainName,cmbChildName,spanIdName,childArrayName,cmbChilClassName) {
     var sSelect = '<SELECT class="'+ [cmbChilClassName] +'" NAME=' + [cmbChildName] +'></OPTION>';
     var iTypeID = document[frmName][cmbMainName].value;
for (var x=1; x<this[childArrayName].length; x++) {	
if(this[childArrayName][x]!=null){
          if (this[childArrayName][x].TypeID == iTypeID) {
               sSelect = sSelect + '<OPTION VALUE=' + this[childArrayName][x].ID + '>' + this[childArrayName][x].Name + '</OPTION>'
          }
		}
     }
     sSelect = sSelect + '</SELECT>';
     document.all[spanIdName].innerHTML = "";
     document.all[spanIdName].innerHTML = sSelect; 	 
}

//this function is problematic and most probably won't be in use
function setOptionSelected(myFormName, mySelectName, myOptionID){	
	window[myFormName][mySelectName].options[myOptionID].selected = true;	
}
//end problematic function (not used)

function checkOptionValue(formName, selectName, optionValue){
	var myOptionCount=window[formName][selectName].options.length;		
		for (var i=0; i<myOptionCount; i++){
		var myOptionValue=window[formName][selectName].options[i].value;
		
		optionValue = optionValue.replace("&rsquo;","***")
		myOptionValue = myOptionValue.replace("'","***")
		
		//document.writeln(myOptionValue)
		//document.writeln([optionValue])
		
		if(myOptionValue==([optionValue])){		
			setOptionSelected([formName], [selectName], i)
			}
		}
	}

//option value for text values of select
function checkOptionText(formName, selectName, textValue){
	var myOptionCount=window[formName][selectName].options.length;		
		for (var i=0; i<myOptionCount; i++){
		var myOptionText=window[formName][selectName].options[i].text;				
		if(myOptionText==([textValue])){		
			setOptionSelected([formName], [selectName], i)
			}
		}
	}

//23 nov 2004
/////multiple select check
function checkMultipleSelect(formMultName, selectMultName, optionMultValue){
	//value array
	var myMultOptionCount=window[formMultName][selectMultName].options.length;		
	var myStr=[optionMultValue].toString();
	var myMultArray=myStr.split(', ');
	var myMultArrayLength=myMultArray.length;	
	for (var j=0; j<myMultArrayLength; j++) {
		for (var i=0; i<myMultOptionCount; i++){
			var myMultOptionValue=window[formMultName][selectMultName].options[i].value;				
			if(Number(myMultOptionValue)==Number(myMultArray[j])){				
				checkOptionValue(formMultName, selectMultName, Number(myMultArray[j]))
			}
							
		}		

	}	
}

///end multiple select check

///21 oct 2004 - cleans form field
function myPassClean(clFormName, clFieldName, clHowLong){
	setTimeout('myPassCleanTimed("'+[clFormName]+'", "'+[clFieldName]+'")',[clHowLong]);
	
}
function myPassCleanTimed(clFormName, clFieldName){
	document[clFormName][clFieldName].value="";
	document[clFormName][clFieldName].focus();	
}

function alertSecNumber(){			
	alert("Please enter a valid security code");	
	myPassClean("premiumForm", "myPassInput", 500);
}
///////////////10 nov 2004///////////////
//onChange URL function
function updateTargetOnChange(updateTarget, updateContent){
//alert(this[updateTarget].innerHTML)
this[updateTarget].innerHTML="<a href='" + [updateContent] + "' title='Check URL' target='_blank'>" + [updateContent] + "</a>"
}

/////////Change Form Action and Target 24 nov 2004/////////////
function formPropertiesChange(formName, formCurrentPage, formOrgAction, formOrgTarget, formTempAction, formTempTarget, popUp, myScroll){	
	//temp. change form action and submit
	if([popUp]=="popUp"){		
		var resWidth = window.screen.width - 10;
		var resHeight = window.screen.height - 56;
		void(openInnewWindow('',resWidth,resHeight,[myScroll],0,0,'myPopUp'));
		this[formName].target="myPopUp";
		this[formName].action=([formTempAction]);
		this[formName].submit();		
	}else{
		this[formName].action=[formTempAction];
		this[formName].target=[formTempTarget];
		this[formName].submit();
	}
		//return original form properties
	//this[formName].action=[formCurrentPage];
	//this[formName].target=[formOrgTarget];
	//this[formName].submit();
	this[formName].action=[formOrgAction];
	this[formName].target=[formOrgTarget];
}
///conform deletion////////
 function confirmDelete(formName, formCurrentPage, formOrgAction, formOrgTarget, formTempAction, formTempTarget, popUp)
  {
    if (confirm('Are you sure?'))
    {
      formPropertiesChange([formName], [formCurrentPage], [formOrgAction], [formOrgTarget], [formTempAction], [formTempTarget], [popUp]);
      return true;
    }
    return false;
  }

//////window resize///////////
function resizeWindow(width, height){
	window.resizeTo([width],[height])
}

///////url specific page check////////////
function curentPageCheck(valueToCompare){
	var myTrue = false;
	var myCurentPageURL = window.location.href;
	var valueOriginal = myCurentPageURL.indexOf(valueToCompare)
	if(valueOriginal>-1){
		myTrue = true;
	}
	return myTrue;
}

/////////////8 April 2005///////////
/////////////compare URL - 2 Fn - clean and getURLArray////////////
function cleanURL(urlValue){
	var whatToCompare = urlValue	
	//replace url prefixes + tail spaces and slashes		
	whatToCompare = whatToCompare.replace(/\s+/g," ");
	whatToCompare = whatToCompare.replace(" ","");		
	if(whatToCompare.lastIndexOf("/")==whatToCompare.length-1){								
		whatToCompare = whatToCompare.substr(0,whatToCompare.length-1);
	}
	whatToCompare = whatToCompare.replace("http://","");
	whatToCompare = whatToCompare.replace("www.","");
	return whatToCompare;
}
function getURLArray(passedArray, fieldValue, fieldName, formName, dbValue, myEvent){	
	var myArray = passedArray;
	var myDbValue = cleanURL(dbValue);
	var mineEvent = myEvent
	var myFieldValue = 	cleanURL(fieldValue.value);
	while(myFieldValue.indexOf("'")>=0)
	{
		myFieldValue = myFieldValue.replace("'","***quotesingle***");	
	}
	//split the array
	mySplitArray = myArray.split(",*del*,");	
	for(var i=0; i<mySplitArray.length; i++){
		myArrayValue = cleanURL(mySplitArray[i]);
		if(myFieldValue.toUpperCase()==myArrayValue.toUpperCase() && myFieldValue.toUpperCase()!=myDbValue.toUpperCase()){
			myError = document.getElementById('errorBox');
			myError.innerHTML = "Old URL ; ("
			if(mineEvent!='false'){
				this[formName][fieldName].select();
				this[formName][fieldName].focus();
				window.event.cancelBubble=true;
				window.event.returnValue=0;
			}
			return false;
		}else{
			myError = document.getElementById('errorBox');
			myError.innerHTML = "<span class='green'>New URL ; )</span>"
		}
		
	}	
}
///////////////multiple select conferance - April 2005////////
function makeSelectContent(myTarget, myCommaValue){		
var targetCombo = document.getElementById(myTarget);			
//clean the combo
while(targetCombo.length>0){	
	targetCombo.remove(targetCombo.options[0]);
}

var myClusterString = myCommaValue;
var myClusterArray = myClusterString.split(",");

	for (i=0; i<myClusterArray.length; i++) {
		if(myClusterArray[i] !=""){
			targetCombo.options[i] = new Option(myClusterArray[i],myClusterArray[i]);
		}
	}		
}		

function addSelectedItem(mySource, myTarget){
	var sourceCombo = document.getElementById(mySource);
	var targetCombo = document.getElementById(myTarget);
	//check if exists									
	while(sourceCombo.selectedIndex!=-1){
		if(checkIfDouble(myTarget, sourceCombo.options[sourceCombo.selectedIndex].text)){					
			targetCombo.options[targetCombo.length] = new Option(sourceCombo.options[sourceCombo.selectedIndex].text, sourceCombo.options[sourceCombo.selectedIndex].text);
		}
		
		sourceCombo.remove(sourceCombo.selectedIndex);
	}					
}
function addRemoveAll(mySource, myTarget){
	var sourceCombo = document.getElementById(mySource);
	var targetCombo = document.getElementById(myTarget);

	while(sourceCombo.length>0){
			if(checkIfDouble(myTarget, sourceCombo.options[0].text)){
				targetCombo.options[targetCombo.length] = new Option(sourceCombo.options[0].text, sourceCombo.options[0].text);
			}
			sourceCombo.remove(sourceCombo.options[0]);
	}		
	
}
function checkIfDouble(myTarget, valueToCompare){
var doubleAnswer = true;
var targetCombo = document.getElementById(myTarget);
	for(i=0; i<targetCombo.length; i++){
		if(targetCombo.options[i].text==valueToCompare){
			doubleAnswer = false;
		}				
	}
	return doubleAnswer;
}

function selectAllMultiple (myFormName, mySelectName){	
	for(i=0; i<window[myFormName][mySelectName].length; i++){
		setOptionSelected(myFormName, mySelectName, i)
	}
	
}
function stripHTML(dirthyHTML)
{
	var myRegex = /<\S[^>]*>/g;
	var cleanHTML = dirthyHTML.replace(myRegex,"");
	cleanHTML = cleanHTML.replace("&gt;","-");
	cleanHTML = cleanHTML.replace("&gt;","-");
	cleanHTML = cleanHTML.replace("&gt;","-");
	cleanHTML = cleanHTML.replace("&gt;","-");
	cleanHTML = cleanHTML.replace("&gt;","-"); 
	
	return cleanHTML;
}

function replaceQryChars(theURL)
{
	var codedURL = theURL.replace("&","**amp**");
	codedURL = codedURL.replace("&","**amp**");
	codedURL = codedURL.replace("&","**amp**");
	codedURL = codedURL.replace("&","**amp**");
	codedURL = codedURL.replace("&","**amp**");
	codedURL = codedURL.replace("&","**amp**");
	codedURL = codedURL.replace("&","**amp**");
	
	return codedURL
}
//////////////by Albert////////////////////2004////////////
/////// Print Function /////////////////
function doPrintFunction(){
		pageToDisplay = document.getElementById("printContent");
		tableToHide = document.getElementById("mainTable");
		myBigBody = document.getElementById("myBody");
		myServices = document.getElementById("services"); 
		myContactForm = document.getElementById("contactForm");
		
		tableToHide.style.display = "none";
		myServices.style.display = "none";
		if(myContactForm)
		{
			myContactForm.style.display = "none";
		}
		myBigBody.innerHTML = pageToDisplay.innerHTML;				
		print();
}

function qryStringCheck(param, durl, durl2, durl3)
{
	var myVariable = QueryString(param);
	if(myVariable)
	{
		var myDivAlign=""
		//english case
		if(!curentPageCheck("_h.aspx") && !curentPageCheck("-l1"))
		{
			var hebrewPrefix="";
			myDivAlign='align="right"';
		}
		//hebrew case
		else
		{
			var hebrewPrefix="_h";
			myDivAlign='align="left"';
		}
		
		var myPage="";		
		switch(myVariable)
		{
			case "1_2":
			myPage="getBZServices"+hebrewPrefix+".aspx";		
			break
			
			case "2_2":
			myPage="getActiveServices"+hebrewPrefix+".aspx";
			break
			
			case "3_2":
			myPage="getPersonalServices"+hebrewPrefix+".aspx";
			break		
		}
		document.writeln("<br><br><div "+myDivAlign+">"+durl+"<a href='"+myPage+"'>"+durl2+"</a>"+durl3+"</div>");
	}
}

//js qry tring//
function QueryString(param){
	var loca = document.location.href;
	if(loca.indexOf('?' + param + '=')>-1 || loca.indexOf('&' + param + '=')>-1){
		var qString = loca.split('?');
		var keyVal = qString[1].split('&');
		for(var i=0;i<keyVal.length;i++){
			if(keyVal[i].indexOf(param + '=')==0){
				var val = keyVal[i].split('=');
				return val[1];
			}
		}
		return false;
	}else{
		return false;
	}
};

function GetDemoURL()
{
	//var loca = document.location.href;
	var demoURL;
	
	//demoURL = (loca.indexOf("http://podium.co.il") > -1) ?
	//"http://www.podium.co.il" :
	//"http://podium.co.il";
	
	//demoURL += "/adCore/adCorePresentation.html";
	
	demoURL = "/adCore/adCorePresentation.html";
	
	return demoURL;
}

var aryImages = new Array(4);

  aryImages[0] = "http://podium.co.il/images/flag_usa_off.gif";  
  aryImages[1] = "http://podium.co.il/images/flag_germany_off.gif";
  aryImages[2] = "http://podium.co.il/images/flag_netherlands_off.gif";
  aryImages[3] = "http://podium.co.il/images/flag_spain_off.gif";


  for (i=0; i < aryImages.length; ++i) {
    var preload = new Image();
    preload.src = aryImages[i];
  }

function UpdateLangFlags()
{
	//get 3 images
	var img1, img2, img3, img4;
	
	img1 = document.getElementById("flag_img1");
	img2 = document.getElementById("flag_img2");
	img3 = document.getElementById("flag_img3");
	img4 = document.getElementById("flag_img4");
	
	//german
	if(curentPageCheck("_de.aspx"))
	{
		img2.src = aryImages[1];
	}
	//dutch
	else if(curentPageCheck("_nl.aspx"))
	{
		img3.src = aryImages[2];
	}
	//spanish
	else if(curentPageCheck("_es.aspx"))
	{
		img4.src = aryImages[3];
	}
	//english
	else
	{
		img1.src = aryImages[0];		
	}
}

///////blink//////////
BlinkTxt();
