<!--
// Switch popup on/off;
var switchPopup = "off";
// Set coupon code
var couponCode = "NEWCUST";
// Set expiration date
var expDate = "JAN 30, 2009";

// The URL to show in the popup window
var currentUrl = new String(location.href);
if(currentUrl.search('popup')<0){
	if(currentUrl.search('sp.htm')>=0){
		var popupURL="http://www.desertburn.com/popup.htm";
	} else {
		var popupURL="http://www.desertburn.com/popup-sp.htm";
	}
}
SetCookie ('couponCode', couponCode);
SetCookie ('expDate', expDate);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_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];}
}
//-->
<!-- hiding code from bad browsers
// this is for any index pages

// Atlas landing page code 
// added 7/5/2005
// atlas code moved to actual pages
// atlas code moved to actual pages


// added to cookie customer info
// 7/07/2005
// passed as ?b=1001&cinfo=fn:eric|ln:tester|adr:123+fake|cty:NY|st:NY|zp:11111|ctry:CA|em:ere@test.com|ph:212-222-2222
var cinfo = "";
cinfo = Get_Parm('cinfo');
if( (cinfo != "") && (cinfo != null) ) {
  SimpleCookie('cinfo',cinfo,60*24*30,"/");
//  alert('set cinfo to '+ cinfo);
}



// modified per Matt req by ericw 4/8/2004


// add pop suppression 4/29/2005


var AFFILIATE_IF_BLANK = "NA";
var NEW_AFFILIATE_OVERWRITES = true;

var banner = GetCookie('affiliate');
var idnum = "";
var pid="";


// don't overwrite affiliates
if(!(NEW_AFFILIATE_OVERWRITES) && (banner != null) && (banner != "")  ) {
  idnum = banner;
} else {
  idnum = Get_Parm("b");

  if( (idnum == null) || (idnum == "") ) {
    // idnum = AFFILIATE_IF_BLANK;
  } else {
    pid=Get_Parm('pid'); 
  }
}
var np = "";
np = Get_Parm("np");
if(np != "") {
  SetCookie("np",np);
} else {
  np = GetCookie("np");
}


if(np == "Y") {
  doIpop=false;
}



var aff_num = Get_Parm("b");

var days2expire=60; // cookie expires in 60 days


var testing = "n";

//if(isDefined(FORCEAFFILIATE)) {
  // noop
//} else {
//  var FORCEAFFILIATE = "";
// }


function Get_Parm(name) {
    SCH = document.location.search;
    // alert('SCH = ' + SCH);
    var start = SCH.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != SCH.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = SCH.indexOf("&",len);
    if (end == -1) end = SCH.length;
    return unescape(SCH.substring(len,end));
}
function SetCookie (name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
        var path = (argc > 3) ? argv[3] : null;
        var delay = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires)) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((delay == null) ? "" : ("; delay=" + delay)) +
        ((secure == true) ? "; secure" : "");
}
function SimpleCookie (cookieName, cookieValue, expires_in_minutes,path) {
  var expDate = new Date();
  expDate.setTime( expDate.getTime() + (expires_in_minutes * 60 * 1000) );
  SetCookie(cookieName,cookieValue,expDate.toGMTString(),path);
}

function GetCookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if the cookie exists
      offset += search.length
      end = document.cookie.indexOf(";", offset); // set the index of beginning value
      if (end == -1) // set the index of the end of cookie value
        end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
    }
  }
  return returnvalue;
}
function DeleteCookie (name) {
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}


function SimplePopUnder(pageURL,h,w){
    h = parseInt(h);
    w = parseInt(w);
    if( (h == null) || (h == "") || (h == 0) || isNaN(h)) {
	  h=465;
	}
	if( (w == null) || (w == "") || (w == 0) || isNaN(w)) {
	  w=350;
	}
	
	var top='',left='';
	var smnNavUA = navigator.userAgent.toLowerCase();
	var	smnIE = (smnNavUA.indexOf('msie')>-1) && (smnNavUA.indexOf('opera')==-1) && (smnNavUA.indexOf('aol')==-1) && (smnNavUA.indexOf('webtv')==-1);
	var sOpt = 'width=' + w + ',height=' + h;
	if((parseInt(navigator.appVersion)>=5)&&!smnIE) sOpt += ',location=1';
	if(navigator.appVersion.indexOf("AOL") > 0) {
	  return;

        	}
	// alert('name:' + navigator.appName + '\n' + 'version:' + navigator.appVersion + '\ncode:' + navigator.appCodeName);
	var top=((screen.height-h)/2);
	top -= Math.round(top * smnTOffset);
	var left=((screen.width-w)/2);

	if (smnIE) sOpt += ',top=4000,left=4000';
	else sOpt += ',top=' + top + ',left=' + left;

	var nw = window.open('about:blank','nw',sOpt);

	// self.focus();
	// setTimeout("this.window.focus()",2000);

	if (nw.window.moveTo) nw.window.moveTo(left,top);
	nw.window.location = pageURL;
	nw.blur();
	// self.focus();
}

function affiliate2form() {
// in a form, use this: 
  var banner = GetCookie('affiliate');
  if( (banner != null) && (banner != "") ) {
	document.write('<input type="Hidden" name="affiliate" value="'+ banner+'">');
  } else {
	document.write('<input type="Hidden" name="affiliate" value="0">');
  }
}

function Get_Parm_Normal(name) {
   SCH = document.location.search;
   SCH = "?&" + SCH.substring(1,SCH.length);
   // alert('SCH = ' + SCH);
   var start = SCH.indexOf("&" + name+"=");
   var len = start+name.length+2;
   if ((!start) && (name != SCH.substring(0,name.length))) return("");
   if (start == -1) return "";
   var end = SCH.indexOf("&",len);
   if (end == -1) end = SCH.length;
   // alert('finished getting parm ' + name);
   return unescape(SCH.substring(len,end));
}
function MAP_pixel(siteAcct) { // changed to use myaf_tracked cookie, and not require b on the url string
  var idnum = Get_Parm("b"); // only set the map pixel when passed in this way
  var subid = Get_Parm("sub");
  var myaf_tracked = GetCookie('myaf_tracked');
  if( (idnum != null) && (idnum != "") ) {
    SimpleCookie('myaf_tracked',idnum,60*24*days2expire,"/"); // simple cookie uses minutes
    document.write('<img src="http://www.myaffiliateprogram.com/u/'+siteAcct+ '/t.asp?id=' +idnum+ '&sub=' + subid +'" height=1 width=1 border=0>');
    //alert('<img src="http://www.myaffiliateprogram.com/u/'+siteAcct+ '/b.asp?id=' +idnum+ '" height=1 width=1 border=0>"');
  } else if( (banner != null) && (banner != "") && (banner != myaf_tracked) ) {
    SimpleCookie('myaf_tracked',banner,60*24*days2expire,"/"); // simple cookie uses minutes
    document.write('<img src="http://www.myaffiliateprogram.com/u/'+siteAcct+ '/t.asp?id=' +banner+ '&sub=' + subid +'" height=1 width=1 border=0>');
    // alert(idnum);
  }

  <!--MNME Code-->
  var scriptUrl='https://secure.w3track.com/newtrk/click_js_urbsite.php?ENGINE=MNM&cp=' + escape(Get_Parm_Normal('cp')) + '&ucp=' + escape(Get_Parm_Normal('ucp')) + '&mcp=' + escape(Get_Parm_Normal('mcp')) + '&rf='+escape(document.referrer) + '&wu=' + escape(document.location)
	+ '&b=' + escape(Get_Parm_Normal('b')) + '&af=' + escape(Get_Parm_Normal('af'));
  // document.write(scriptUrl);
  //document.write('<scr' + 'ipt language="JavaScript" src="' + scriptUrl + '"></scr' + 'ipt>');
  <!--END MNME Code-->
}
function MAP_pixel_manual(siteAcct,idnum) { // pass in an idnum instead of reading off the url
  // var idnum = Get_Parm("b"); // only set the map pixel when passed in this way
  if( (idnum != null) && (idnum != "") ) {
    document.write('<img src="http://www.myaffiliateprogram.com/u/'+siteAcct+ '/b.asp?id=' +idnum+ '" height=1 width=1 border=0>');
    //alert('<img src="http://www.myaffiliateprogram.com/u/'+siteAcct+ '/b.asp?id=' +idnum+ '" height=1 width=1 border=0>');
  } else {
    // alert(idnum);
  }
  <!--MNME Code-->
  var scriptUrl='https://secure.w3track.com/newtrk/click_js_urbsite.php?ENGINE=MNM&cp=' + escape(Get_Parm_Normal('cp')) + '&ucp=' + escape(Get_Parm_Normal('ucp')) + '&mcp=' + escape(Get_Parm_Normal('mcp')) + '&rf='+escape(document.referrer) + '&wu=' + escape(document.location)
	+ '&b=' + escape(Get_Parm_Normal('b')) + '&af=' + escape(Get_Parm_Normal('af'));
  // document.write(scriptUrl);
  //document.write('<scr' + 'ipt language="JavaScript" src="' + scriptUrl + '"></scr' + 'ipt>');
  <!--END MNME Code-->
}


// end functions always check for affiliate here


if (idnum && (idnum != "") && (idnum != null) ) {
  SimpleCookie('affiliate',idnum,60*24*days2expire,"/"); // simple cookie uses minutes
} 


if(pid && (pid != null) && (pid != "")) {
   SimpleCookie('partnerUNID',pid,60*24*days2expire,"/");
} 

// else if( (FORCEAFFILIATE != null) && (FORCEAFFILIATE !="") ) {
//  SimpleCookie('affiliate',FORCEAFFILIATE,60*24*days2expire,"/"); // simple cookie uses minutes 
// }


// save subid from MyAffiliate program links to pass on orderform redirect
var subidMyAffiliate = Get_Parm("sub");
if( (subidMyAffiliate != null) && (subidMyAffiliate != "") ) {
  SimpleCookie('subidMyAffiliate',subidMyAffiliate,60*24*days2expire,"/"); // simple cookie uses minutes
}


// end hiding -->

// exitpop_remote scripting:
function GetParmEP(name) {
   SCH = document.location.search;
   SCH = "?&" + SCH.substring(1,SCH.length);
   // alert('SCH = ' + SCH);
   var start = SCH.indexOf("&" + name+"=");
   var len = start+name.length+2;
   if ((!start) && (name != SCH.substring(0,name.length))) return("");
   if (start == -1) return "";
   var end = SCH.indexOf("&",len);
   if (end == -1) end = SCH.length;
   // alert('finished getting parm ' + name);
   return unescape(SCH.substring(len,end));
}
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if the cookie exists
      offset += search.length
      end = document.cookie.indexOf(";", offset); // set the index of beginning value
      if (end == -1) // set the index of the end of cookie value
        end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
    }
  }
  return returnvalue;
}
function isDefined(ckVar)


    {
    	var DEFINED_V=true;
    	


        	function handleError() {
        	DEFINED_V=false;
        	return true;
        	}
        	var oldOnError=window.onerror;
        	window.onerror=handleError;
        	try { 
        		eval(ckVar);
        	}catch (e) 
        	{ DEFINED_V=false;
        	}
        	window.onerror=oldOnError;
        	return DEFINED_V;
    }


if(!isDefined('current_aff')) {
  var current_aff = ""; 
}
if( (current_aff == null) || (current_aff == "") ){
  current_aff = get_cookie('affiliate');
}
// alert(document.location.pathname);
var dir = document.location.pathname;
dir = dir.substring(1,dir.length);
var i=1;
var lastIndex = -1;
var loopcount = 0;
var i = dir.lastIndexOf("/");
dir = dir.substring(0,i);

var host = document.location.hostname;

function varIsDefined(variable) {
	return (typeof(window[variable]) == "undefined") ? false: true;
}
// ARG ucp doesnt exist
// ARG mcp doesnt exist
// ARG cp doesnt exist
if(!varIsDefined('MNME_CP')) var MNME_CP = '';
if(!varIsDefined('MNME_ENGINE')) var MNME_ENGINE = '';
MNME_CP = '99';
MNME_ENGINE = 'MNM';

var upvar = GetUrlArg('np');
if(typeof(window['np']) == "undefined") {
 var np;
}

// alert('upvar=' + upvar);
if(upvar == "Y") {
 var npExp = dateHence(1);
 SetCookieEPR("np","Y",npExp);
 np='Y';
} else {
 np = GetCookie("np");
}

function dateHence(days) {
 var exp = new Date();
 var expDays = days; // 60 days
 exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
 return(exp);
}

function GetUrlArg(name) {
 SCH = document.location.search;
 // alert('SCH = ' + SCH);
 var start = SCH.indexOf(name+"=");
 var len = start+name.length+1;
 if ((!start) && (name != SCH.substring(0,name.length))) return null;
 if (start == -1) return null;
 var end = SCH.indexOf("&",len);
 if (end == -1) end = SCH.length;
 return unescape(SCH.substring(len,end));
}

function GetCookie (name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
	 var j = i + alen;
	 if (document.cookie.substring(i, j) == arg)
	 return getCookieVal (j);
	 i = document.cookie.indexOf(" ", i) + 1;
	 if (i == 0)
	 break;
 }
 return null;
}
 
function getCookieVal (offset) {
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
 endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}
function SetCookieEPR (name, value) {
 var argv = SetCookieEPR.arguments;
 var argc = SetCookieEPR.arguments.length;
 var expires = (argc > 2) ? argv[2] : null;
 var path = (argc > 3) ? argv[3] : null;
 var delay = (argc > 4) ? argv[4] : null;
 var secure = (argc > 5) ? argv[5] : false;
 document.cookie = name + "=" + escape (value) +
 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
 ((path == null) ? "" : ("; path=" + path)) +
 ((delay == null) ? "" : ("; delay=" + delay)) +
 ((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
 var exp = new Date();
 exp.setTime (exp.getTime() - 1);
 var cval = GetCookie (name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var newpopwin;

if(np != "Y") {
 var exitPop = true;
} else {
 var exitPop = false;
}
var wthreec=(document.getElementById)? true: false;
var ie5=(wthreec && document.all)? true : false;
var ns6=(wthreec && (navigator.appName=="Netscape"))? true: false;

if (ns6) {
window.onunload=controlThePop;
}else {
window.onbeforeunload=controlThePop;
}
function controlThePop() {
 new exitPopup();
}

function exitPopup(){
 if( (typeof(window['TEMP_block_exitpop']) != "undefined") && TEMP_block_exitpop) {
 return;
 }
 if(typeof(window['np']) == "undefined") {
 var np;
 }

 if(np == "Y") {
 exitPop = false;
 }
//SetCookie('ordered',true);
//DeleteCookie('ordered')
//alert (GetCookie('ordered')==null);
//onclick="exitPop=false"
if(exitPop && GetCookie('ordered')==null && switchPopup=='on'){
 newpopwin = window.open(popupURL, 'newpopwin', 'width=800,height=400,scrollbars=no,menubar=no,statusbar=no,location=no,resizable=no');
 }
}
<!-- hide from old browsers

/* prefill assumes the following:
   1 form is named "quantities"
   2 layer to reveal(if any) is named layer1
   3 cookie cinfo in format of "fn:eric|ln:jones"
   4 names in form are same as given in cinfo
*/
function prefill() {
  var form = document.quantities;
  if(!form) {
    return;
  }
  var cinfo = Get_Cookie('cinfo');
  // var country = "";
  if(cinfo == "") {
    return;
  }

	showLayer('layer1');
  // alert(cinfo);
  var cinfo_array = cinfo.split("|");

  var temp_array; //  = New Array;
  var temp_var = "";
  // var name = "";
  var value = "";
  var elem;
  for(i=0;i<cinfo_array.length;i++) {
    temp_var = cinfo_array[i];
    // alert(temp_var);
    temp_array = temp_var.split(":");
    if(temp_array[0] != "") {
      // if(temp_array[0] == "ctry") {
      //        country = temp_array[1];
      // }
      elem = eval("form." + temp_array[0]);
      if(elem) {
        value = temp_array[1];
        // value.replace("+"," ");
        elem.value = value.replace(/\+/g," ");
      }
    }
  }
}

function showLayer(name) {
  layer = document.getElementById(name);
  if(layer) {
    layer.style.display='block';
  } else {
    // alert('layer ' + name + 'does not exist');
  }
}

function Get_Cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if the cookie exists
      offset += search.length
      end = document.cookie.indexOf(";", offset); // set the index of beginning value
      if (end == -1) // set the index of the end of cookie value
        end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
    }
  }
  return returnvalue;
}

function write_page_message() {
  var txt = Get_Parm('mssg');
  if(txt == null || txt == undefined || txt=="") {
     // noop
  } else {
     document.write('<p align=center><font color=red face=arial size=4>' + URLDecode(txt) + '</font></p>');
     // return(txt);
  }
 
}

function URLDecode(encoded )
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   // var encoded = document.URLForm.F2.value;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   // document.URLForm.F1.value = plaintext;
   return plaintext;
}
function checkFormSTD(form) {
  // setup error strings
  var error_preamble = "You are required to fill in the following information:      \n\n----------------------------------------\n\n";
  var error_postamble = "\n\n----------------------------------------\nPlease fill in the fields and try again.";
  var error_str = "";
  var error_email_match = "";
	
  // check fields for being empty
  if(form.status && form.status.value == ""){
    error_str += "   Status\n";
  }
  if(form.firstname && form.firstname.value == ""){
    error_str += "   First Name\n";
  }
  if(form.lastname && form.lastname.value == ""){
    error_str += "   Last Name\n";
  }
  if(form.email && form.email.value == ""){
    error_str += "   Email\n";
  }
  if(form.confirm_email && form.confirm_email.value == ""){
    error_str += "   Confirm Email\n";
  }

  if(form.email && form.email.value != "" &&
    form.confirm_email && form.confirm_email.value != ""){
    if(form.email.value != form.confirm_email.value){
      error_email_match = "Your email entries don't match.\n";
    }
  }
  if(!email_ok(form.email.value)) {
    error_str += "   Email does not appear valid";
  }

  /*  
  if(document.getElementById('status').value == "EC"){
    if(document.getElementById('subject').selectedIndex == 0){
      error_str += "   Subject\n";
    }
  } 
  */

  if(error_str == "" && error_email_match == "") {
    return true;
  } else {
    alert(error_preamble + error_str + error_email_match + error_postamble);
    return false;
  }

}

function email_ok(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   // alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   // alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    // alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    // alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    // alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    // alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    // alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

//-->
