///////////////////////////////////////////////////////////////////////////////////////function popupURL(url, theWidth, theHeight, theName){	//alert(url);	var newWindow;	var props = 'name=' + theName + ',scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=yes,directories=no,width=' + theWidth + ',height=' + theHeight;	newWindow = window.open(url, theName, props);}///////////////////////////////////////////////////////////////////////////////////////function checkCR(evt) {	var evt  = (evt) ? evt : ((event) ? event : null);	var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);	if ((evt.keyCode == 13) && (node.type=="text")) {return false;}}document.onkeypress = checkCR;///////////////////////////////////////////////////////////////////////////////////////function calcPriceOld(curField) {	alert('Not yet calculating $' + curField);}///////////////////////////////////////////////////////////////////////////////////////function insertEmail(theVal) {	var temp_array = theVal.split(" ");	document.encode.send_to.value = temp_array[2];}///////////////////////////////////////////////////////////////////////////////////////function checkall(formname,checkname,thestate){	var el_collection = eval("document.forms." + formname + "." + checkname);	for (c=0; c<el_collection.length; c++){		el_collection[c].checked = thestate;	}}///////////////////////////////////////////////////////////////////////////////////////function checkConversion(formName) {    //alert("The form: " + formName);    //return false;    //var theForm 	= document[formName];    //var reg_name 	= theForm.reg_name.value;    //var unlock	 	= theForm.reg_num.value;    //var theItem 	= theForm.all[0].value;    //alert("hello: " + theForm.all);    //alert("reg_name = " + reg_name + ", unlock = " + unlock);    }///////////////////////////////////////////////////////////////////////////////////////function checkActivationInfo(){	var theForm = document.registration;    //var theForm = document[formName];	var returnValue = true;		// sample code: VFW87-CO72B92	//alert("length = " + theForm.dc_code.value.length + ", Indexof = " + theForm.dc_code.value.indexOf('-'));	// typeof theForm.dc_order_id != "undefined"	//alert("dc_order_id exists? " + typeof(theForm.dc_order_id));	//alert("dc_order_id exists? " + theForm.dc_order_id.value);	//if(typeof(theForm.dc_order_id) != "undefined"){	//if(theForm.dc_order_id == undefined){		if(theForm.dc_code.value.length < 12 || theForm.dc_code.value.indexOf('-') == -1){  //  			returnValue = false;			alert("The \"Activation Code\" field has an improper value.  It should begin with alphabetic characters and have a dash (i.e. VFW87-A2B3C4D).");			theForm.dc_code.value = "";		}    //}    	// sample code:  UH5CF60900A632SC	if(theForm.idcode){  //  does ID Code field exist?		if(theForm.idcode.value.length > 1){			if(theForm.idcode.value.length != 16){				returnValue = false;				alert("The \"ID Code\" field has an improper value.  It requires a 16 digit alpha-numeric code that is found in the registration screen of ProPresenter on the system you intend to key this module to.");				theForm.idcode.value = "";				theForm.idcode.focus();			}		}else{			alert("The \"ID Code\" field is empty.  It requires a 16 digit alpha-numeric code that is found in the registration screen of ProPresenter on the system you intend to key this module to.");		}    }    	if(theForm.register_to){  //  does reg_name field exist?    	returnValue = checkRegistered("registration");    }        return returnValue;}///////////////////////////////////////////////////////////////////////////////////////function checkRegistered(formName) {    //alert("The form: " + formName);    var theForm = document[formName];    if(theForm.register_to)	{ var myvar = theForm.register_to.value; } else { myvar = "no exist"; }	    if(myvar == ""){    	alert("The \"Organization Name\" field was left empty. This field is required to generate an unlock code.");    	theForm.register_to.focus();    	return false;    }        //myvar = myvar.replace("  ", " ");        if(myvar.length < 6){    	alert("The \"Organization Name\" field is too short.  Six or more characters are required.");    	theForm.register_to.focus();    	return false;    }        //if(myvar.indexOf('"') > -1){    //	alert("The \"Registered to\" field contains illegal characters.  No quotes are allowed in this value.");    //	theForm.register_to.focus();    //	return false;    //}	// allow ONLY alpha keys, no symbols or punctuation or numbers	// this can be altered for any "checkOK" string you desire	var checkOK = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";	var checkStr = myvar;	var allValid = true;	var chList = "";	for (i = 0;  i < checkStr.length; i++){		ch = checkStr.charAt(i);		for (j = 0;  j < checkOK.length;  j++)			if (ch == checkOK.charAt(j))			break;			if (j == checkOK.length){				allValid = false;				//chList += "\"" + ch + "\"" + ", ";				break;			}	}	if (!allValid){		//alert("The \"Registered to\" field only accepts alphanumeric characters (symbols and/or punctuation marks are not allowed). The following characters are not allowed: \r\r     " + chList);		alert("The \"Organization Name\" field only accepts alphabetic characters. Numbers, symbols, or punctuation marks, such as those found in email addresses, are not permissable.");    	theForm.register_to.focus();		return false;	}}///////////////////////////////////////////////////////////////////////////////////////function fixEmpty(curName, curVal) {	var theForm = document.order_entry;	if(curVal == false){		curVal = 0.00;	}else{		curVal = parseFloat(curVal);	}	theForm[curName].value = curVal.toFixed(2);}///////////////////////////////////////////////////////////////////////////////////////function calcRow(curVal) {	var theForm = document.order_entry;	var valArray = curVal.split("_");	var item = parseInt(valArray[0]);	var price = parseFloat(valArray[1]);	var exPrice = 0;	var rowNum = parseInt(valArray[2]);	var startField = 16;	var diff = rowNum * 5;	var curFieldQty = startField + diff - 1;	var curFieldDate = startField + diff + 1;	var curFieldReg = startField + diff + 2;	var curFieldPrice = startField + diff + 3;	var rowCount = parseInt(theForm.numRows.value);	var sub = 0.00;	var curQty = 0;		// establish qty	if(theForm[curFieldQty].value == false){		curQty = 1;		theForm[curFieldQty].value = curQty; // set qty	}else{		curQty = parseInt(theForm[curFieldQty].value);	}	if(item){		exPrice = curQty * price;		theForm[curFieldPrice].value = exPrice.toFixed(2); // set ex. price	}else{		theForm[curFieldQty].value = "";		theForm[curFieldPrice].value = "";	}		if(item == "152"){  // Time Expiring Lease License		var d = new Date();		d.setDate(d.getDate()+365);		theForm[curFieldDate].value = d.format("yymmdd");	}		if(item == "153"){  // Time Expiring Lease License		var d = new Date();		d.setDate(d.getDate()+14);		theForm[curFieldDate].value = d.format("yymmdd");	}				for(i=0; i<rowCount; i++){		priceField = startField + 3 + (5 * i);		if(theForm[priceField].value == false){ curPrice = 0.00; }else{ curPrice = parseFloat(theForm[priceField].value); }		sub += curPrice;	}	theForm.subtotal.value = sub.toFixed(2);  // subtotal	theForm[curFieldReg].focus();	calcTotal();}///////////////////////////////////////////////////////////////////////////////////////function calcTotal(curName) {	var theForm = document.order_entry;	var startField = 17;	var sub = parseFloat(theForm.subtotal.value);	var total = 0.00;		if(theForm.tax.value == false){ tax = 0.00; }else{ tax = parseFloat(theForm.tax.value); }	if(theForm.shipping.value == false){ shipping = 0.00; }else{ shipping = parseFloat(theForm.shipping.value); }	if(theForm.handling.value == false){ handling = 0.00; }else{ handling = parseFloat(theForm.handling.value); }		total = sub + tax + shipping + handling;	theForm.order_total.value = total.toFixed(2);  // total}///////////////////////////////////////////////////////////////////////////////////////function checkEntry(theForm){	//var reg_to = theForm.registeredto;		//alert("first_name: " + theForm.first_name.value + "last_name: " + theForm.last_name.value + "email: " + theForm.email.value);	if(theForm.first_name.value && theForm.last_name.value && theForm.email.value){		return true;	}else{		alert('Missing required fields for database');		theForm.add_to_db.checked = false;		theForm.first_name.focus();		return false;	}}///////////////////////////////////////////////////////////////////////////////////////function checkMail(){	var x = document.email_list.email_address.value;	//alert ("email is: " + x);	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	if (!filter.test(x)){		alert('This is not a properly formatted eMail address\rPlease check your entry and try again.');		return false;	}else{		return true;	}}///////////////////////////////////////////////////////////////////////////////////////function checkEmail(email){	var theForm = document.form1;	//var x = theForm.PAYER.value;	//alert ("email is: " + x);	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	if (! filter.test(email)){		alert("This is not a properly formatted eMail address\rPlease check your entry and try again.");		//theForm.PAYER.value = "";		//theForm.PAYER.focus();		return false;	}else{		return true;	}}///////////////////////////////////////////////////////////////////////////////////////function confirmEmail(confirm_email){	var theForm = document.form1;	if (confirm_email != theForm.PAYER.value){		alert('This value does not match the email address you entered above. Please try again.');		return false;	}else{		return true;	}}///////////////////////////////////////////////////////////////////////////////////////function confirmEmail2(confirm_email){	var theForm = document.Feedback;	var firstForm = document.forms[0];	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;		if(! theForm && firstForm){ theForm = firstForm; }		if (!filter.test(confirm_email)){		alert('This is not a properly formatted eMail address\rPlease check your entry and try again.');		return false;	}	if (confirm_email != theForm.email.value){		alert('This email address does not match the first email address you entered. Please try again.');		//theForm.confirm_email.focus();		return false;	}else{		return true;	}}///////////////////////////////////////////////////////////////////////////////////////function checkDealerCodeInfo(){	var theForm = document.encode;	var product = false;	var dealer = false;		if(theForm.p_id.selectedIndex != 0){		product = true;	}else{		alert('Don\'t forget to choose a PRODUCT to go with this Brad!'); 	}		if(theForm.d_id.selectedIndex != 0){		dealer = true;	}else{		alert('Don\'t forget to choose a DEALER to go with this Brad!'); 	}		if(product && dealer){		return true;	}else{		return false;	}}///////////////////////////////////////////////////////////////////////////////////////function calcPrice() {  // cur_div	var theForm = document.turnkey;	var i;	var message = "";	var price = 0;	var curField;	var tempVal;	var tempVal_array;	//var objName = getObj("prod_2");		//alert("theForm = " + theForm);		for(i=0; i<theForm.length; i++) {		curField = theForm[i];		//message += theForm[i].name + ", ";		if(theForm[i].checked){			price += parseFloat(theForm[i].id);		}		//alert("curField name = " + curField.name + ", price (ID field) = " + theForm[i].id);		if(curField.name == "qty[]" && curField.value > 0){			tempVal = theForm[i].id;			tempVal_array = tempVal.split("-");			price += parseFloat(tempVal_array[0]) * curField.value;			//price += parseFloat(theForm[i].id) * curField.value;			//alert("curField name = " + curField.name + ", price = " + price);		}				//alert("div visibility (" + cur_div + ") = " + objName.style.visibility);		//alert("parent Div (prod_2) = " + objName.visibility);		if(curField.selectedIndex > 0){  //  && document.getElementById(cur_div).visibility != "hidden"  or   && cur_div != "prod_2"			tempVal = curField.options[curField.selectedIndex].value;			tempVal_array = tempVal.split("-");			price += parseFloat(tempVal_array[1]);		}		//document.write("The field name is: " + theForm[i].name + " and it s value is: " + theForm[i].value + ".<br />");	}		//alert('message: ' + message);	//alert('total: ' + total);	y = new String(price);		checkfordec = false;	counter = 0;	for(i=0; i < y.length; i++){		if(y.substr(i, 1) == "."){ 			checkfordec = true; 			break;		}		counter++;	}	if((y.length - counter) == 2){ price = y + "0"; }	if(! checkfordec){ price = y + ".00"; }		//alert("total: " + price + ", theForm.length = " + theForm.length);	theForm.total.value = price;}///////////////////////////////////////////////////////////////////////////////////////function calcPrice2() {	var theForm = document.turnkey;	var i;	var message = "";	var price = 0;	var curField;	var tempVal;	var tempVal_array;		for(i=0; i<theForm.length; i++) {		curField = theForm[i];		message += theForm[i] + ", ";		if(theForm[i].checked){			price += parseFloat(theForm[i].id);		}		if(curField.selectedIndex > 1){			tempVal = curField.options[curField.selectedIndex].value;			tempVal_array = tempVal.split("-");			price += parseFloat(tempVal_array[1]);		}		//document.write("The field name is: " + theForm[i].name + " and it s value is: " + theForm[i].value + ".<br />");	}	//alert('message: ' + message);	//alert('total: ' + total);	y = new String(price)	checkfordec = false;	counter = 0;	for(i=0; i < y.length; i++){		if(y.substr(i, 1) == "."){ 			checkfordec = true; 			break;		}		counter++;	}	if((y.length - counter) == 2){price = y + "0";}	if(! checkfordec){ 		price = y + ".00";	}	theForm.total.value = price;}///////////////////////////////////////////////////////////////////////////////////////function calcPrice3screen(selected_field) {	var theForm = document.turnkey;	var i;	var message = "";	var price = 0;	var curField;	var tempVal;	var tempVal_array;	var selected_mac;	var selected_mac_id;	var selected_matrox;	var selected_matrox_id;	var selected_pro;	var item_list = "";		for(i=0; i<theForm.length; i++) {		curField = theForm[i];		message += curField.name + ", ";				if(curField.selectedIndex > 0){			//alert("1) curField.name = " + curField.name + ", selected_field = " + selected_field);			if(curField.name != selected_field && curField.name in {'imac':'', 'macbook':'', 'mini':'', 'macbookpro':'', 'macpro':''} && ! (selected_field in {'pro':'', 'triple':'', 'dual':''})){				curField.selectedIndex = 0;			}else if(curField.name != selected_field && curField.name in {'triple':'', 'dual':''} && ! (selected_field in {'imac':'', 'macbook':'', 'mini':'', 'macbookpro':'', 'macpro':'', 'pro':''})){				curField.selectedIndex = 0;			}else{				tempVal = curField.options[curField.selectedIndex].value;				tempVal_array = tempVal.split("-");				//alert("2) tempVal_array[0] = " + tempVal_array[0]);				price += parseFloat(tempVal_array[1]);				if(curField.name != "pro" && curField.name != "triple" && curField.name != "dual"){					selected_mac = curField.name;					selected_mac_id = tempVal_array[0];				}else if(curField.name == "triple" || curField.name == "dual"){					selected_matrox = curField.name;					selected_matrox_id = tempVal_array[0];				}else{					selected_pro = tempVal_array[0];				}			}		}	}		//alert("selected_mac =" + selected_mac);		switch(selected_mac){		case "imac":			price = price + 29 + 29 + 169 + 199;  // display port adaptors (113, 114) and AppleCare (15)			bundle = "-113-114-15-87-";			break;		case "macbook":			if(selected_mac_id == 50){				price = price + 29 + 29 + 249 + 199;  // White MacBook: mini-display port adaptors (113, 114) and AppleCare (16)				bundle = "-113-114-16-87-";			}else{				price = price + 29 + 29 + 249 + 199;  // display port adaptors (113, 114) and AppleCare (16)				bundle = "-113-114-16-87-";			}			break;		case "mini":			price = price + 29 + 149 + 199;  // display port adaptors (ships with HDMI to DVI adaptor) and AppleCare (39)			bundle = "-113-39-87-";			break;		case "macbookpro":			price = price + 29 + 29 + 349 + 199;  // display port adaptors (113, 114) and AppleCare (17)			bundle = "-113-114-17-87-";			break;		case "macpro":			price = price + 29 + 29 + 249 + 199;  // display port adaptors (113, 114) and AppleCare (21)			bundle = "-113-114-21-87-";			break;		default:  // none selected			bundle = "-0-";			selected_mac_id = "0";			alert("No computer was selected.  This is fine if you don't need one, but without a system selected we cannot add the recommended bundled items since components and pricing vary between machines.");			break;	}		if(! selected_pro){ selected_pro = "0"; }	item_list += selected_mac_id + bundle + selected_matrox_id + "-" + selected_pro;	//alert("item_list = " + item_list);		theForm.item_list.value = item_list;		y = new String(price)	checkfordec = false;	counter = 0;	for(i=0; i < y.length; i++){		if(y.substr(i, 1) == "."){ 			checkfordec=true; 			break;		}		counter++;	}	if((y.length - counter) == 2){price = y + "0";}	if(! checkfordec){ 		price = y + ".00";	}		theForm.total.value = price;}///////////////////////////////////////////////////////////////////////////////////////function validate(){	//frmName is the name of the form	frmLength = document.frmName.length;	isEmpty = false;		for (i=0; i<frmLength;i++){		if(document.frmName[i].value == "")			isEmpty = true;  //one element is empty	}		if(istEmpty) return false;  //at least one element is empty so return false	return true; //all fields are non-empty so return true;}///////////////////////////////////////////////////////////////////////////////////////function validate2(){	for(i=0; i<document.FormName.elements.length; i++) {		document.write("The field name is: " + document.FormName.elements[i].name + " and it s value is: " + document.FormName.elements[i].value + ".<br />");	}}///////////////////////////////////////////////////////////////////////////////////////function getObj(name) {  if (document.getElementById) { return document.getElementById(name); }  else if (document.all) { return document.all[name]; }  else if (document.layers) { return document.layers[name]; }}///////////////////////////////////////////////////////////////////////////////////////function getBrowser(name) {  if (document.getElementById) { return "IE5"; }  else if (document.all) { return "IE4"; }  else if (document.layers) { return "NS"; }}///////////////////////////////////////////////////////////////////////////////////////function showProd(position) {	var browserType = getBrowser("dealer_info");	var visText = "visible";	var novisText = "hidden";	if (browserType == "IE5") {		var visText = "block";		var novisText = "none";	}	//alert(browserType + ", " + visText + ", " + novisText + ", " + position);		if (browserType == "IE5") {		if (position == 1) {			objName = getObj("prod_1");			objName.style.display = visText;			objName = getObj("prod_2");			objName.style.display = novisText;		} else {			objName = getObj("prod_1");			objName.style.display = novisText;			objName = getObj("prod_2");			objName.style.display = visText;		}	}else if (browserType == "IE4") {		if (position == 1) {			objName = getObj("prod_1");			objName.style.display = visText;			objName = getObj("prod_2");			objName.style.display = novisText;		} else {			objName = getObj("prod_1");			objName.style.display = novisText;			objName = getObj("prod_2");			objName.style.display = visText;		}	}else {		if (position == 1) {			objName = getObj("prod_1");			objName.style.display = visText;			objName = getObj("prod_2");			objName.style.display = novisText;		} else {			objName = getObj("prod_1");			objName.style.display = novisText;			objName = getObj("prod_2");			objName.style.display = visText;		}	}}///////////////////////////////////////////////////////////////////////////////////////function changeRegInfo(pageType) {	var browserType = getBrowser("dealer_info");	var visText = "visible";	var novisText = "hidden";	if (browserType == "IE5") {		var visText = "block";		var novisText = "none";	}	//alert(browserType + ", " + visText + ", " + novisText + ", " + pageType);	//exit;		if (browserType == "IE5") {		if (pageType == "dealer") {			objName = getObj("dealer_info");			objName.style.display = visText;			objName = getObj("renvis_info");			objName.style.display = novisText;		} else {			objName = getObj("dealer_info");			objName.style.display = novisText;			objName = getObj("renvis_info");			objName.style.display = visText;		}	}else if (browserType == "IE4") {		if (pageType == "dealer") {			objName = getObj("dealer_info");			objName.style.visibility = novisText;			objName = getObj("renvis_info");			objName.style.visibility = novisText;		} else {			objName = getObj("dealer_info");			objName.style.visibility = visText;			objName = getObj("renvis_info");			objName.style.visibility = visText;		}	}else {		if (pageType == "dealer") {			objName = getObj("dealer_info");			objName.style.visibility = novisText;			objName = getObj("renvis_info");			objName.style.visibility = novisText;		} else {			objName = getObj("dealer_info");			objName.style.visibility = visText;			objName = getObj("renvis_info");			objName.style.visibility = visText;		}	}}///////////////////////////////////////////////////////////////////////////////////////function changePage(pageType) {	var browserType = getBrowser("cc_info");	var visText = "visible";	var novisText = "hidden";	if (browserType == "IE5") {		var visText = "block";		var novisText = "none";	}		if (browserType == "IE5") {		if (pageType == "ec") {			objName = getObj("cc_info");			objName.style.display = novisText;			objName = getObj("billing_address");			objName.style.display = novisText;			objName = getObj("shipping_address");			objName.style.display = novisText;		} else {			objName = getObj("cc_info");			objName.style.display = visText;			objName = getObj("billing_address");			objName.style.display = visText;			objName = getObj("shipping_address");			objName.style.display = visText;		}	}	else if (browserType == "IE4") {		if (pageType == "ec") {			objName = getObj("cc_info");			objName.style.visibility = novisText;			objName = getObj("billing_address");			objName.style.visibility = novisText;			objName = getObj("shipping_address");			objName.style.visibility = novisText;		} else {			objName = getObj("cc_info");			objName.style.visibility = visText;			objName = getObj("billing_address");			objName.style.visibility = visText;			objName = getObj("shipping_address");			objName.style.visibility = visText;		}	}	else {		if (pageType == "ec") {			objName = getObj("cc_info");			objName.style.visibility = novisText;			objName = getObj("billing_address");			objName.style.visibility = novisText;			objName = getObj("shipping_address");			objName.style.visibility = novisText;		} else {			objName = getObj("cc_info");			objName.style.visibility = visText;			objName = getObj("billing_address");			objName.style.visibility = visText;			objName = getObj("shipping_address");			objName.style.visibility = visText;		}	}	switchFormAction(pageType);}///////////////////////////////////////////////////////////////////////////////////////function changeSubmit() {	var browserType = getBrowser("mysubmit1");	if (browserType == "IE5") {		objName = getObj("mysubmit1");		objName.style.display = "none";		objName = getObj("mysubmit2");		objName.style.display = "block";	} else {		objName = getObj("mysubmit1");		objName.style.visibility = "hidden";		objName = getObj("mysubmit2");		objName.style.visibility = "visible";	}	return true;}///////////////////////////////////////////////////////////////////////////////////////function SameAsFill(obForm) {	obForm = document.form1;	if (obForm.elements['SameAs'].checked){	  szFields = "FIRSTNAME,LASTNAME,STREET1,STREET2,CITYNAME,PROVINCE,PHONE,POSTALCODE";	  szBillFields = "BillingFirstName,BillingLastName,BillingStreet1,BillingStreet2,BillingCityName,BillingProvince,BillingPhone,BillingPostalCode";      var fields = szFields.split(",");      var billFields = szBillFields.split(",");      for (x=0; x < fields.length; x++) {        if (obForm.elements[fields[x]].value.length) {			obForm.elements[billFields[x]].value = obForm.elements[fields[x]].value;        }      }		thisState = obForm.elements['STATEORPROVINCE'].selectedIndex;	thisCountry = obForm.elements['COUNTRY'].selectedIndex;	obForm.elements['BillingStateOrProvince'].selectedIndex = thisState;	obForm.elements['BillingCountry'].selectedIndex = thisCountry;	}}///////////////////////////////////////////////////////////////////////////////////////function switchFormAction2(pageName) {	if (pageType == "ec") {		document.form1.action = "<?php echo($root_ssl_url . 'ec_to_paypal.php'); ?>";	}else{		document.form1.action = "<?php echo($root_ssl_url . '" + pageName + "'); ?>";	}}///////////////////////////////////////////////////////////////////////////////////////function fixCaps(theText){	var theStart = 0;	var temp = theText.value;	var theEnd = temp.length;	var theWord = "";	var newText = "";	var spacesExist = false;		if (temp.indexOf(" ") != -1){		for(i = theStart; i <= theEnd; i = i + 1){			if ((temp.charAt(i) != " ") && (i < theEnd)){				theWord = theWord + temp.charAt(i);			}else{				theWord = theWord + temp.charAt(i);				theWord = theWord.substring(0,1).toUpperCase() + theWord.substring(1,theWord.length).toLowerCase();				newText = newText + theWord;				theWord = "";			}		}	}else{		var newText = temp.substring(0,1).toUpperCase() + temp.substring(1,temp.length).toLowerCase();	}	theText.value = newText;}///////////////////////////////////////////////////////////////////////////////////////function fixCardNum(theText){	var temp = theText.value;	temp = temp.replace(/ /g, "");	temp = temp.replace(/-/g, "");	theText.value = temp;		switch (temp.substring(0, 1)) {		case "4":			document.form1.elements['CreditCardType'][0].checked = true;			break;		case "5":			document.form1.elements['CreditCardType'][1].checked = true;			break;		case "3":			document.form1.elements['CreditCardType'][2].checked = true;			break;		case "6":			document.form1.elements['CreditCardType'][3].checked = true;			break;	}}// ------------------------------------------------------------------------------------/* * Date Format 1.2.3 * (c) 2007-2009 Steven Levithan <stevenlevithan.com> * MIT license * * Includes enhancements by Scott Trenda <scott.trenda.net> * and Kris Kowal <cixar.com/~kris.kowal/> * * Accepts a date, a mask, or a date and a mask. * Returns a formatted version of the given date. * The date defaults to the current date/time. * The mask defaults to dateFormat.masks.default. */var dateFormat = function () {	var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,		timezoneClip = /[^-+\dA-Z]/g,		pad = function (val, len) {			val = String(val);			len = len || 2;			while (val.length < len) val = "0" + val;			return val;		};	// Regexes and supporting functions are cached through closure	return function (date, mask, utc) {		var dF = dateFormat;		// You can't provide utc if you skip other args (use the "UTC:" mask prefix)		if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {			mask = date;			date = undefined;		}		// Passing date through Date applies Date.parse, if necessary		date = date ? new Date(date) : new Date;		if (isNaN(date)) throw SyntaxError("invalid date");		mask = String(dF.masks[mask] || mask || dF.masks["default"]);		// Allow setting the utc argument via the mask		if (mask.slice(0, 4) == "UTC:") {			mask = mask.slice(4);			utc = true;		}		var	_ = utc ? "getUTC" : "get",			d = date[_ + "Date"](),			D = date[_ + "Day"](),			m = date[_ + "Month"](),			y = date[_ + "FullYear"](),			H = date[_ + "Hours"](),			M = date[_ + "Minutes"](),			s = date[_ + "Seconds"](),			L = date[_ + "Milliseconds"](),			o = utc ? 0 : date.getTimezoneOffset(),			flags = {				d:    d,				dd:   pad(d),				ddd:  dF.i18n.dayNames[D],				dddd: dF.i18n.dayNames[D + 7],				m:    m + 1,				mm:   pad(m + 1),				mmm:  dF.i18n.monthNames[m],				mmmm: dF.i18n.monthNames[m + 12],				yy:   String(y).slice(2),				yyyy: y,				h:    H % 12 || 12,				hh:   pad(H % 12 || 12),				H:    H,				HH:   pad(H),				M:    M,				MM:   pad(M),				s:    s,				ss:   pad(s),				l:    pad(L, 3),				L:    pad(L > 99 ? Math.round(L / 10) : L),				t:    H < 12 ? "a"  : "p",				tt:   H < 12 ? "am" : "pm",				T:    H < 12 ? "A"  : "P",				TT:   H < 12 ? "AM" : "PM",				Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),				o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),				S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]			};		return mask.replace(token, function ($0) {			return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);		});	};}();// Some common format stringsdateFormat.masks = {	"default":      "ddd mmm dd yyyy HH:MM:ss",	shortDate:      "m/d/yy",	mediumDate:     "mmm d, yyyy",	longDate:       "mmmm d, yyyy",	fullDate:       "dddd, mmmm d, yyyy",	shortTime:      "h:MM TT",	mediumTime:     "h:MM:ss TT",	longTime:       "h:MM:ss TT Z",	isoDate:        "yyyy-mm-dd",	isoTime:        "HH:MM:ss",	isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",	isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};// Internationalization stringsdateFormat.i18n = {	dayNames: [		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"	],	monthNames: [		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"	]};// For convenience...Date.prototype.format = function (mask, utc) {	return dateFormat(this, mask, utc);};////////////////////////////////////////////////////////////////////////////////////////*function edit_dealer() {	var e = document.getElementByID("dealer_id");	var the_val = e.options[e.selectedIndex].value;	alert("e index = " + e.selectedIndex + ", the_val = " + the_val);	window.location = "dealer.php?page=edit_dealer&curdid="+the_val;}*/
