	// Use this variable to enable/disable the popunder.
	var popurl = 'http://www.sunsetter.com/';
	var enablePopunder = true;
	var popupPage = 'popunder.asp';
	var popupBrowserName = 'Sunsetter_Popunder';
	var popupDecorations = 'menubar=no, resizable=no, toolbar=no, location=no, directories=no';


	/**
	 * The Get_Cookie function returns an unescaped value for the specified cookie
	 * name.  Returns null if a value for the specified name cannot be found.
	 */
	function Get_Cookie(name) {
	    var start = document.cookie.indexOf(name+"=");
	    var len = start+name.length+1;
	    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	    if (start == -1) return null;
	    var end = document.cookie.indexOf(";",len);
	    if (end == -1) end = document.cookie.length;
	    return unescape(document.cookie.substring(len,end));
	}

	// Don't popup if we have sent email to a dealer.
	if (Get_Cookie("EmailDealer") == 'true') {
		enablePopunder = false;
	}
	
	function doUnload(cust){
	
		// If not enabled then don't do the popunder.
		if (enablePopunder == false) 
			return;
			
		// See if the last name is in the cookie.
		cust = getKeyValue(cust, 'LastName');
	
		// Check if they have user data in the cookie.  If we already have their
		// user info then don't show the popunder.
		if (cust == null || cust == "") {
			// Open the popunder window.
			win = window.open(popurl + "blank.html", popupBrowserName, popupDecorations);
			win.blur();
			win.location = popupPage;
			window.focus();
		}
	}

	function doUnload2(){
		var popupPage2 = popurl + popupPage;
	
		// If not enabled then don't do the popunder.
		if (enablePopunder == false) 
			return;
			
			// Open the popunder window.
			win = window.open(popurl + "blank.html", popupBrowserName, popupDecorations);
			win.blur();
			win.location = popupPage2;
			window.focus();
	}
	
	function closePopunder(){
		var popupPage2 = popurl + popupPage + '?close=yes';
				
		// Open the popunder window.
		win = window.open(popupPage2, popupBrowserName, popupDecorations);
		win.blur();
		//win.location = popupPage2;
		window.focus();
	
	}
