function checkPopUpFormFields(formType, formEl) {
	var errorString = '';
	
	if(eval('formEl.'+formType+'_contactfirstname.value == ""')) 
		errorString += 'First Name is required field.\r\n';
	if(eval('formEl.'+formType+'_contactlastname.value == ""')) 
		errorString += 'Last Name is required field.\r\n';

	if(eval('formEl.'+formType+'_contactphone.value == ""')) 
		errorString += 'Phone Number is required field.\r\n';
		
	email = eval('formEl.'+formType+'_contactemail.value');
	retypeemail = eval('formEl.'+formType+'_retypecontactemail.value');
	if(email == "") 
		errorString += 'E-Mail Address is required field.\r\n';
	else if(!(email.indexOf(".") > 2) || !(email.indexOf("@") > 0))
		errorString += 'E-Mail Address is invalid.\r\n';
	else if(email != retypeemail)
		errorString += 'The E-Mail Address is different from the Retype E-Mail Address.\r\n';
	
	if(errorString == '')	{
		return true;
	}
	else {
		alert(errorString);
		return false;
	}
}
//	return formEl.action;

///////////////////////////////////////////

	function showPopUp(linkid) {
		fireEvent(document.getElementById(linkid), 'click');
	}

///////////////////////////////////////////

function fireEvent(element,event){  
	if (document.createEventObject){  
		// dispatch for IE  
		var evt = document.createEventObject();  
		element.fireEvent('on'+event,evt)  
	}  
	else{  
		// dispatch for firefox + others  
		// alert('test');
		var evt = document.createEvent("HTMLEvents");  
		evt.initEvent(event, true, true ); // event type,bubbling,cancelable  
		element.dispatchEvent(evt);  
	}  
}  
 
//////////////////////////////////////////


function makeYellow() {
	event.srcElement.style.background = '#FFFF80';
}
function removeYellow() {
	event.srcElement.style.background = 'White';
}

//////////////////////////////////////////

function managebestTimeToContactDisplay (pPreferredContactMethod, elPrefix) {
	if (pPreferredContactMethod == 2) {
		getElement(elPrefix+'_besttimetoconductdemo_tr').style.display = '';
	} else {
		getElement(elPrefix+'_besttimetoconductdemo_tr').style.display = 'none';
	}
}		         						

function manageDemoTimeDisplay (pDemoPrefs, elPrefix) {
	if (pDemoPrefs == 8 || pDemoPrefs == 7 || pDemoPrefs == 0 || pDemoPrefs == -1) {
		getElement(elPrefix+'_demotime_tr').style.display = 'none';
	} else if (pDemoPrefs > 0) {
		getElement(elPrefix+'_demotime_tr').style.display = '';
	}
}

function countriesManageFields(country, elPrefix){
	if (country == "US") {
		getElement(elPrefix+"_province_label").innerHTML = "State";
		setElementValue(elPrefix+'_notinusaprovince', 0);
		swapProvince(0, elPrefix);
	}
	else if (country == "CA") {
		getElement(elPrefix+"_province_label").innerHTML = "Province";
		setElementValue(elPrefix+'_notinusaprovince', 1);
		swapProvince(1, elPrefix);
	}
	else {
		getElement(elPrefix+"_province_label").innerHTML = "State/Province";
		setElementValue(elPrefix+'_notinusaprovince', 1);
		swapProvince(1, elPrefix);
	}
}		
function swapProvince (notinus, elPrefix) {
    if (notinus == 1) {
        showElement(elPrefix+'_nonusprovince');
        hideElement(elPrefix+'_province');
    } else {
        hideElement(elPrefix+'_nonusprovince');
        showElement(elPrefix+'_province');
    }
}
							    
							    

function ToggleRowColor(oThis, bHighlight, sHighlightColor)
{
		if (isSet(oThis.customHighlightColor)) {
			sHighlightColor = oThis.customHighlightColor;
		}

		if (!isSet(sHighlightColor)) {
			sHighlightColor = "#DCDCDC";
		}
sHighlightColor = "#F8C089";

     if (bHighlight)
     {
          oLastRow = oThis;
          oLastRowBGColor = oThis.style.backgroundColor;

          oThis.style.backgroundColor = sHighlightColor;
          oThis.style.color = '#000';
     }
     else
     {
          oThis.style.backgroundColor = oLastRowBGColor;
          oThis.style.color = '#666';

          oLastRow = null;
          oLastRowBGColor = "";
     }
}


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];}
}