	function getHost()
		{
			return document.location.host;
		}

	function menuOption(page, linkname)
		{
		
			webpath = getHost()
			document.write('&nbsp;<A HREF="http://' + webpath + page + '"' + ' class="link">' + linkname + '</A>');
		}
	function makeNewWindow(page,title)
		{
			msg=open(page,title,"width=600,height=600,toolbar=no,directories=no,scrollbars=yes,menubar=no,resizable=yes" );
		}
	function makeNewPopup(page,x,y)
		{
			var newProperties;
			newProperties = "width=" + x + ", height="  + y + ",toolbar=no,directories=no,scrollbars=yes,menubar=no,resizable=yes";
			msg=open(page,"DisplayWindow", newProperties );
		}

	var newWindow
	function makeNewWindowD(page,title){
		msg=open(page,title,"width=400,height=210,toolbar=no,directories=no,scrollbars=no,menubar=no,resizable=yes" )
		var d_winLeft = 350
  		var d_winTop = 350
		}

function closeNewWindow() {
  window.close();
}


if(document.location.href.indexOf("evalformsave.cfm")==-1){
	expireDate = new Date;
	expireDate.setMonth(expireDate.getMonth()+6);

	if(!document.referrer&&document.cookie.indexOf("Referred")==-1){				//if there's no referrer, set "from" to equal "typed"
		var from = "typed";
	}
	
	if(document.referrer&&document.referrer.indexOf("eventpro.net")==-1){			//if there is a referrer and it's an outside domain
		var from = document.referrer; 														//store referrer in variable
	}
	
	
	if(document.location.href.indexOf("?")!=-1){ 											//if the previous domain has passed more information through this url
		urlInfo = document.location.href.split("?");										//then parse the information into the prevRef variable
		prevRef = urlInfo[1];
		for(k=2;k<urlInfo.length;k++){
			prevRef = prevRef+"?"+urlInfo[k];
		}
		from = from+"?"+prevRef;							 								//add that information to the variable with the referrer
		document.location.href=document.location.href.split("?")[0];						//reset the window address to this page's url
	}
	
	if(document.cookie.indexOf("Referred")==-1&&from){ 										//if the referred cookie doesn't already exist
		document.cookie = "Referred="+from+";expires="+expireDate.toGMTString(); 			//set the referred cookie
	}
	
}

function interDom(page){
	whereFrom="";
			if(document.cookie!=""){ <!-- if cookie, add cookie to url -->
				aCookie = document.cookie.split(";");
				for (i=0; i<aCookie.length; i++){
					cookiePieces = aCookie[i].split("=");
					cookieName = cookiePieces[0];
					cookieValue = cookiePieces[1];
					for(j=2; j<cookiePieces.length;j++){
						cookieValue = cookieValue+"="+cookiePieces[j];
					}
					if(cookieName.indexOf("Referred")!=-1){ 
						whereFrom = cookieValue;
					}
				}
			}
	if (whereFrom!=""){
		document.location.href=page+"?"+whereFrom;
	}
	else{
		document.location.href=page;
	}
}
