<!--
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];}
}

//EMAIL VALIDATION
function validateEmail(email) {
            // Script prepared by Answer Studios / ToUnite.com
            // Version 1.1 (Feb. 1, 2001)
            // Logic:
            // 8 steps: Preset elements, 6 error checks, write error (if appicable)
            // --- Presets
            var count = 0;
            var error = "";
            // #1 Check if email address field is blank
                        if (email == "") {
                                    error = "";
                        }
            // #1 Check for invalid characters
            // Create an arroay of invalid characters
            if (error == "") {
            var invChars = new Array(" ", "#", "$", "%", "!", "^", "~", "'", "*", "(", ")", ",", "<", ">", "/", "\\","\r","\t");
            // Loop through Array and see if there are any matches, if yes then throw and error.
            for (var i = 0; i < invChars.length; i++) {
                        if (email.indexOf(invChars[i]) >= 0) {
                                    error = error + "Email address: Invalid character found.\n";
                        }
            }
            }
            // #2 If passed previous error step  >>> Check the @ symbol (1 instance of the symbol)
            if (error == "") {
                        // Loop by character through the email string for the @ symbol, count the number of instances
                        for (var i = 0; i < email.length; i++) {
                                    if (email.charAt(i) == "@") {
                                                count = count+1;
                                    }
                        }
                        // If there is not 1 instance (0 or more than 1) then throw an error.
                        if (count != 1) {
                                    error = error + "Email address: Missing the @ symbol.\n";
                        }
            }
            // Split the email string by the @ sign, forming the name portion and the domain portion.
            if (error == "") {
                        var splitEmail = email.split("@");
                        var emailName = splitEmail[0];
                        var emailDom = splitEmail[1];
                        // #3 Verify minimum characters in name portion (minimum of 1), if not throw an error.
                        if (emailName.length<1) {
                                    error = error + "Email address: Problem with the email name.\n";
                        }
                        // #4 Verify there is a . (dot) in the domain portion
                        if (emailDom.indexOf(".")<0) {
                                    error = error + "Email address: Missing the dot for the domain name.\n";
                        } else {
                                    // #5 Verify a minimum of 2 characters before the dot, if not throw an error.
                                    // First split the domain portion by the . (dot)
                                    var splitDom = emailDom.split(".");
                                    if (splitDom[0].length<2) {
                                                error = error + "Email address: Problem with the domain name or domain name missing.\n";
                                    }
                                    // #6 Verify a minimum of 2 characters after the dot, if not throw an error.
                                    if (splitDom[1].length<2) {
                                                error = error + "Email address: Invalid domain name extension (.com).\n";
                                    }
                        }
            }
            // Associate the error number into the message array for displaying results on the screen.
            if (error != ""){
              emailerror = error
            }
            else{
              emailerror = true
            }
            return emailerror
}

function imbedFlash(objID,FFile,fW,fH,bgc,menu,sa,fObjName,fVars,al,qua,parent,wmode){
	flashObj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + fW + '" height="' + fH + '" id="' + fObjName + '" align="' + al + '">' +
	'<param name="FlashVars" value="' + fVars + '">' +
	'<param name="allowScriptAccess" value="' + sa + '">' +
	'<param name="movie" value="' + FFile + '">' +
	'<param name="menu" value="' + menu + '">' +
	'<param name="bgcolor" value="' + bgc + '">' +
	'<param name="quality" value="' + qua + '">' +
	'<param name="wmode" value="' + wmode + '">' +
	'<embed src="' + FFile + '" menu="' + menu + '" wmode="' + wmode + '" quality="high" bgcolor="' + bgc + '" width="' + fW + '" height="' + fH + '" name="' + fObjName + '" align="' + al + '" allowScriptAccess="' + sa + '" FlashVars="' + fVars + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">' +
	'</object>'
	//alert(flashObj);
	switchDom(parent,objID).innerHTML = flashObj;
	//alert(switchDom(parent,objID).innerHTML);
	//alert(fVars);
}
function checkBrowser(){
	var brows = "";
	var agt=navigator.userAgent.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);
	var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('firefox')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	var is_nav6 = (is_nav && (is_major == 5));
	
	var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
	var is_fireFox = (agt.indexOf('firefox')!=-1);
	var is_safari = (agt.indexOf('safari')!=-1);
	
	if(is_ie5up | is_ie5_5up){
		brows = "IE";
	}
	else if (is_fireFox){
		brows = "FF";
	}
	else if (is_safari){
		brows = "SF";
	}
	else if (is_nav6){
		brows = "NS";
	}
if (brows == "IE" | brows == "NS" | brows == "FF" | brows == "SF"){
	return brows;
}
else{
	alert("Your browser may not be compatible.  You must install IE 5 or higher or Netscape 6.2 or higher.");
	return brows;
}
}
//alert(checkBrowser());
function switchDom(loc,objName){
	//alert(checkBrowser());
	if (checkBrowser() == "NS"){
		return eval(loc).document.getElementById(objName);
	}
	else if (checkBrowser() == "FF"){
		return eval(loc).document.getElementById(objName);
	}
	else if (checkBrowser() == "IE"){
		//alert(loc + ", " + objName);
		return eval(loc).document.all(objName);
	}
	else{
		return eval(loc).document.getElementById(objName);	
	}
}
function autoTxtDisp(objDivID,objID,disp){
	var obj = switchDom(this,objID);
	var objDiv = switchDom(this,objDivID);
	obj.style.display = disp;
	objDiv.style.display = disp;
	if (disp == "inline"){
		obj.disabled = false;
	}
	else{
		obj.disabled = true;
		obj.value = "";
	}
}
function autoInitTxtDisp(frmID,objDivID,objID,radObj){
	var obj = switchDom(this,objID);
	var objDiv = switchDom(this,objDivID);
	var rad = switchDom(this,frmID)[radObj];
	var disp = "none";
	for (i=0;i<rad.length;i++){
		if (rad[i].checked){
			if (rad[i].value == "Yes"){
				disp = "inline";
			}
			else if (rad[i].value == "No"){
				disp = "none";
			}
		}
	}
	obj.style.display = disp;
	objDiv.style.display = disp;
	if (disp == "inline"){
		obj.disabled = false;
	}
	else{
		obj.disabled = true;
		obj.value = "";
	}
}
function initCartForm(){
	autoInitTxtDisp('shirtform','shirtautodiv','shirtsign','tshirtauto');
	autoInitTxtDisp('bookform','bookautodiv','booksign','bookauto');
}
function charCnt(txtObjID){
	var obj = switchDom(this,objID);
	return obj.value.length;
}
function shirtAddCart(){
	var msg = "";
	var shirtrad = switchDom(this,"shirtform").shirtsize;
	var autorad = switchDom(this,"shirtform").tshirtauto;
	var prodName = "";
	var shirtSize = "";
	var sizeSel = false;
	var autoSel = false;
	var autoyes = false;
	for (i=0;i<shirtrad.length;i++){
		if (shirtrad[i].checked){
			sizeSel = true;
			shirtSize = shirtrad[i].value;
			prodName = "Sweetest T-Shirt: Youth " + shirtrad[i].value;
			break;
		}
	}
	if (!sizeSel){
		msg = msg + "Please select a shirt size.\n";
	}
	for (i=0;i<autorad.length;i++){
		if (autorad[i].checked){
			autoSel = true;
			if (autorad[i].value == "Yes"){
				autoyes = true;
			}
			break;
		}
	}
	if (!autoSel){
		msg = msg + "Please select whether or not you would like your shirt autographed and personalized.\n";
	}
	else{
		if (autoyes){
			var autoTxt = switchDom(this,"shirtsign").value;
			if (autoTxt == ""){
				msg = msg + "Please enter the personal message you would like signed on your shirt.\n";
			}
			else{
				if (autoTxt.length > 75){
					msg = msg + "The personal message may only be 75 characters or less. Your current message is " + autoTxt.length + " characters long.\n";
				}
				else{
					prodName = prodName + "\n > Personalization: " + autoTxt;
				}
			}
		}
	}
	if (msg == ""){
		switchDom(this,"item_name").value = prodName;
		switchDom(this,"item_number").value = "STS-" + shirtSize;
		switchDom(this,"amount").value = "12.00";
		var subSuccess = switchDom(this,"addCart").submit();
		return false;
	}
	else{
		msg = "Please correct the data below: \n\n" + msg;
		alert(msg);
		return false;
	}
}

<!-- Carnival Book Selection -->
function CGCRbookAddCart(){
	var msg = "";
	var bookrad = switchDom(this,"bookform1").booktype1;
	var autorad = switchDom(this,"bookform1").bookauto1;
	var prodName = "";
	var bookType = "";
	var bookSel = false;
	var autoSel = false;
	var autoyes = false;
	for (i=0;i<bookrad.length;i++){
		if (bookrad[i].checked){
			bookSel = true;
			bookType = bookrad[i].value;
			prodName = "Clyde the Glyde and the Carnival Ride: " + bookrad[i].value;
			break;
		}
	}
	if (!bookSel){
		msg = msg + "Please select a book type (Hardback or Paperback).\n";
	}
	for (i=0;i<autorad.length;i++){
		if (autorad[i].checked){
			autoSel = true;
			if (autorad[i].value == "Yes"){
				autoyes = true;
			}
			break;
		}
	}
	if (!autoSel){
		msg = msg + "Please select whether or not you would like your book autographed and personalized.\n";
	}
	else{
		if (autoyes){
			var autoTxt = switchDom(this,"booksign1").value;
			if (autoTxt == ""){
				msg = msg + "Please enter the personal message you would like signed in your book.\n";
			}
			else{
				if (autoTxt.length > 75){
					msg = msg + "The personal message may only be 75 characters or less. Your current message is " + autoTxt.length + " characters long.\n";
				}
				else{
					prodName = prodName + "\n > Personalization: " + autoTxt;
				}
			}
		}
	}
	if (msg == ""){
		var bookcost = "";
		if (bookType == "Hardback"){
			bookcost = "16.00";
		}
		else if (bookType == "Paperback"){
			bookcost = "10.00";
		}
		switchDom(this,"item_name").value = prodName;
		switchDom(this,"item_number").value = "CGCR-" + bookType;
		switchDom(this,"amount").value = bookcost;
		switchDom(this,"addCart").submit();
		return false;
	}
	else{
		msg = "Please correct the data below: \n\n" + msg;
		alert(msg);
		return false;
	}
}

<!-- Great Ride Book Selection -->
function CGGRbookAddCart(){
	var msg = "";
	var bookrad = switchDom(this,"bookform2").booktype2;
	var autorad = switchDom(this,"bookform2").bookauto2;
	var prodName = "";
	var bookType = "";
	var bookSel = false;
	var autoSel = false;
	var autoyes = false;
	for (i=0;i<bookrad.length;i++){
		if (bookrad[i].checked){
			bookSel = true;
			bookType = bookrad[i].value;
			prodName = "Clyde the Glyde and the Great Ride: " + bookrad[i].value;
			break;
		}
	}
	if (!bookSel){
		msg = msg + "Please select a book type (Hardback or Paperback).\n";
	}
	for (i=0;i<autorad.length;i++){
		if (autorad[i].checked){
			autoSel = true;
			if (autorad[i].value == "Yes"){
				autoyes = true;
			}
			break;
		}
	}
	if (!autoSel){
		msg = msg + "Please select whether or not you would like your book autographed and personalized.\n";
	}
	else{
		if (autoyes){
			var autoTxt = switchDom(this,"booksign2").value;
			if (autoTxt == ""){
				msg = msg + "Please enter the personal message you would like signed in your book.\n";
			}
			else{
				if (autoTxt.length > 75){
					msg = msg + "The personal message may only be 75 characters or less. Your current message is " + autoTxt.length + " characters long.\n";
				}
				else{
					prodName = prodName + "\n > Personalization: " + autoTxt;
				}
			}
		}
	}
	if (msg == ""){
		var bookcost = "";
		if (bookType == "Hardback"){
			bookcost = "16.00";
		}
		else if (bookType == "Paperback"){
			bookcost = "11.00";
		}
		switchDom(this,"item_name").value = prodName;
		switchDom(this,"item_number").value = "CGGR-" + bookType;
		switchDom(this,"amount").value = bookcost;
		switchDom(this,"addCart").submit();
		return false;
	}
	else{
		msg = "Please correct the data below: \n\n" + msg;
		alert(msg);
		return false;
	}
}

<!-- Great Ride Book Selection -->
function PMGDbookAddCart(){
	var msg = "";
	var bookrad = switchDom(this,"bookform3").booktype3;
	var autorad = switchDom(this,"bookform3").bookauto3;
	var prodName = "";
	var bookType = "";
	var bookSel = false;
	var autoSel = false;
	var autoyes = false;
	for (i=0;i<bookrad.length;i++){
		if (bookrad[i].checked){
			bookSel = true;
			bookType = bookrad[i].value;
			prodName = "Pearl the Motorcycle Girl - Take a Chance and Dance: " + bookrad[i].value;
			break;
		}
	}
	if (!bookSel){
		msg = msg + "Please select a book type (Hardback or Paperback).\n";
	}
	for (i=0;i<autorad.length;i++){
		if (autorad[i].checked){
			autoSel = true;
			if (autorad[i].value == "Yes"){
				autoyes = true;
			}
			break;
		}
	}
	if (!autoSel){
		msg = msg + "Please select whether or not you would like your book autographed and personalized.\n";
	}
	else{
		if (autoyes){
			var autoTxt = switchDom(this,"booksign3").value;
			if (autoTxt == ""){
				msg = msg + "Please enter the personal message you would like signed in your book.\n";
			}
			else{
				if (autoTxt.length > 75){
					msg = msg + "The personal message may only be 75 characters or less. Your current message is " + autoTxt.length + " characters long.\n";
				}
				else{
					prodName = prodName + "\n > Personalization: " + autoTxt;
				}
			}
		}
	}
	if (msg == ""){
		var bookcost = "";
		if (bookType == "Hardback"){
			bookcost = "15.00";
		}
		else if (bookType == "Paperback"){
			bookcost = "11.00";
		}
		switchDom(this,"item_name").value = prodName;
		switchDom(this,"item_number").value = "PMGD-" + bookType;
		switchDom(this,"amount").value = bookcost;
		switchDom(this,"addCart").submit();
		return false;
	}
	else{
		msg = "Please correct the data below: \n\n" + msg;
		alert(msg);
		return false;
	}
}
//-->