function setOpenMenu() {
	var url = document.URL;
	var expandUrl = url.split("/");
	var searchUrl = expandUrl[4];
	var returnId = "";
	var left = document.getElementById("left");
	var links = left.getElementsByTagName("a");
	for (i=0; i < links.length; i++) {
		if (links[i].href.indexOf(searchUrl) != -1) {
			returnId = links[i].parentNode.id;
			break;
		}
	}
	return(returnId);
}


//image rollover for hornav with current section highlighted 
function navRollOver (whichNav,imageFileType) {	
	var rollOverSuffix = "-over";
	var whichNav = whichNav.replace(/^\s+|\s+$/g,'');
	var imageFileType = imageFileType.replace(/^\s+|\s+$/g,'');
	var imagePath = "/wp-content/themes/smileguys/images/home/hornav-";
	var navRoot = document.getElementById(whichNav);
	var args = getUrlSubString();	
	for(i=0; i<navRoot.childNodes.length; i++){
		node0 = navRoot.childNodes[i];
		if(node0.nodeName=='A'){
			for(a=0; a<node0.childNodes.length; a++){
				node1=node0.childNodes[a];
				if(node1.nodeName=="IMG"){
					node1.onmouseover=function(){
						if (
							(this.id=="health" && args=="health")||
							(this.id=="beauty" && args=="beauty")||
							(this.id=="househome" && args=="house-and-home")||
							(this.id=="entertainment" && args=="entertainment")||
							(this.id=="family" && args=="family")||
							(this.id=="personalfinance" && args=="personal-finance")
							)
						{	
							srcactive = imagePath+this.id+"-on"+imageFileType;
						} else {
							srcactive = imagePath+this.id+rollOverSuffix+imageFileType;
						}
						this.src = srcactive;
					}
					node1.onmouseout=function(){
						if (
							(this.id=="health" && args=="health")||
							(this.id=="beauty" && args=="beauty")||
							(this.id=="househome" && args=="house-and-home")||
							(this.id=="entertainment" && args=="entertainment")||
							(this.id=="family" && args=="family")||
							(this.id=="personalfinance" && args=="personal-finance")
							)
						{
							src = imagePath+this.id+"-on"+imageFileType;
						} else {
							src = imagePath+this.id+imageFileType;	
						}						
						this.src = src;
					}
				}
			}
		}
	}
}

//image rollover for hornav with current section highlighted 
function navRollOverHome (whichNav,imageFileType) {
	var rollOverSuffix = "-over";
	var whichNav = whichNav.replace(/^\s+|\s+$/g,'');
	var imageFileType = imageFileType.replace(/^\s+|\s+$/g,'');
	var imagePath = "/wp-content/themes/smileguys/images/home/hornav-";
	var navRoot = document.getElementById(whichNav);
	var args = getUrlSubString();	
	for(i=0; i<navRoot.childNodes.length; i++){
		node0 = navRoot.childNodes[i];
		if(node0.nodeName=='A'){
			for(a=0; a<node0.childNodes.length; a++){
				node1=node0.childNodes[a];
				if(node1.nodeName=="IMG"){
					node1.onmouseover=function(){
						srcactive = imagePath+this.id+rollOverSuffix+imageFileType;
						this.src = srcactive;
					}
					node1.onmouseout=function(){
						src = imagePath+this.id+imageFileType;	
						this.src = src;
					}
				}
			}
		}
	}
}


//returns the current section to navRollOver
function getUrlSubString() {
	var url = document.URL;
	var whichPageArray=url.split("/");	
	return whichPageArray[3];
}

function agreePrivacy(theform) {
	if (theform.privacypolicyagree.checked == false ) {
		alert("You must read and agree to the Privacy Policy.");
		theform.privacypolicytext.style.border="2px solid #999";
		theform.privacypolicytext.focus();
		return false;
	} else {
		return true;		
	}
}

function assignIframeSrc() {
	var iframeID="prospectiviframe" //the id you gave to your iframe
	var redirectID = "6588"; // value supplied my marketing
	var returnURL = "/inc/members-coupons.asp";	
	// do not edit below this line
	var iframeURL = "http://www.eversave.com/service/servlet/consumers.Redirect?rid=" + redirectID + "&r=" + returnURL;
	var iframeQS = document.getElementById("iframeQS").value;	
	document.getElementById(iframeID).src=iframeURL + iframeQS;	
}