/* email redirect */
function composIt(n,d,tld) {
	var ext = ".com";
	if (tld) { ext = "." + tld; }
	if (d) { d = d + ext; } else { d = "burningman" + ext; }
	var addr = "mailto:" + n + "@" + d;
	location = addr;
	return false;
}
/* Function that displays status bar messages. */
function dm(msgStr) {
    window.status = msgStr;
    document.MM_returnValue = true;
}

/* Function that swaps images. */
function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */
function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

newWin=null;
function detailWin(detailName,winName,height,width){
	if (navigator.userAgent.indexOf("Mac",1) <1) {
	//for not macs
	if ((newWin==null) || (newWin.closed)) {
	win=window.open(detailName,winName,"toolbars=1,height="+height+",width="+width+",scrollbars=0,resizable=1,screenx=000,screeny=100,dependent=yes");
	} else
	newWin.close();
	newWin=null;
	newWin=window.open(detailName,winName,"toolbars=1,height="+height+",width="+width+",scrollbars=0,resizable=1,screenx=000,screeny=100,dependent=yes");
	}
	else
	
	//for macs
	//for netscape
	if (navigator.appName=="Netscape") {
	if ((newWin==null) || (newWin.closed)) {
	newWin=window.open(detailName,winName,"height="+height+",width="+width+",scrollbars=0,resizable=1,screenx=100,screeny=100,dependent=yes");
	} else
	newWin.close();
	newWin=null;
	newWin=window.open(detailName,winName,"height="+height+",width="+width+",scrollbars=0,resizable=1,screenx=100,screeny=100,dependent=yes");
	}
	else
	newWin=window.open(detailName,winName,"height="+height+",width="+width+",scrollbars=0,resizable=1,screenx=100,screeny=100,dependent=yes");
}
function validateDate(myField)  {
     dateStr = myField.value;
     a = dateStr.split("/");
     if (a.length != 3)
        {
 
        alert('Check that the date is in the proper format.');
        myField.focus();
        return false;
        }
        else
        {
           if (isNaN(a[0]) || a[0] > 12)
              {
              alert('Check that the date is in the proper format.');
              myField.focus();
              return false;
              }
            if (isNaN(a[1]) || a[1] > 31)
	      {
               alert('Check that the date is in the proper format.');
               myField.focus();
               return false;
              }
            if (isNaN(a[2]) || a[2] < 1900)
	      {
              alert('Check that the date is in the proper format.');
              myField.focus();
              return false;
              }
       }  // end if-else
    return true;
} 
function validateEmail(eMail)  {
		emailStr = eMail.value;
		a = emailStr.split("@");
		if (a.length !=2) {
			alert('Email invalid.');
			eMail.focus();
			return false;
		} else {
			b = a[1].split(".");
			if (b.length < 2) {
				alert ('Email invalid.');
				eMail.focus();
				return false;
			}
		}
		return true;
}
function validateNumber(myField) {
	numberStr = myField.value;
   if ((numberStr != "") && (isNaN(numberStr))) {
		return false;
	}
   if (numberStr == 0) {
      return false;
   }
   return true;
}
function checkBrowser() {
	var navArr = navigator.appVersion.split(" ");
	if (navigator.appName == "Microsoft Internet Explorer" && navArr[3] == "5.01;") {
		detailWin('alert.php','alert',550,500);
	}
}
function validateCardNumber(id) {
	idStr = id.value;
	if (isNaN(idStr)) { 
	 	alert('You must enter a valid credit card number. Numbers only. No letters, spaces or dashes, please.'); 
    	id.focus(); 
    	return false;
   }
   return true;
}
