			
	function classChange(styleChange, item) {
		item.className = styleChange;
	}
	
	function newWindow(URL,theWidth,theHeight){
			leftPos = 0;
			topPos = 0;
			
			if(screen){
				leftPos = (screen.width - theWidth)/2;
				topPos = (screen.height - theHeight)/2;
			}

			myWindow = window.open(URL,'_replace','resizable=yes,titlebar=yes,scrollbars=yes,menubar=no,width='+ theWidth+',height='+theHeight+',top='+topPos+',left='+leftPos+'')
			myWindow.focus()
		}


	
	function validatePassword(elem){
		var str = elem.value;
		
		if (str == "") {
		alert("Please enter a Password!")
		document.signup.password.focus();
		return false
		}
		
		return true
	}		

	function verifyPassword(elem){
		var str = elem.value;
		var str2 = document.signup.password.value;
		
		if (str != str2) {
		alert("Passwords entered do not match!")
		document.signup.password.focus();
		document.signup.password.select();
		return false
		}
		return true
	}	
	
	
	function isNotEmpty(elem){
		var str = elem.value;
		var re = /.+/;
		if (!str.match(re)){
			alert("Please fill all the required fields.");
			return false;
		} else {
			return true;
		}
	}		
	
	function isNumber(elem){
		var str = elem.value;
		var re = /^[-]?\d*\.?\d*$/;
		str = str.toString();
		if (!str.match(re)){
			alert("Enter only numbers in the field.");
			return false;
		} else {
			return true;
		}
	}		
		
	function validateEmail(elem){
		var str = elem.value;
		var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
		if (!str.match(re)){
			alert("Please verify the email address format.");
			return false;
		} else {
			return true;
		}
	}		
	
	function validateForm(form){
		if (isNotEmpty(form.firstname)){
			if (isNotEmpty(form.lastname)){
				if (isNotEmpty(form.company)){
					if (isNotEmpty(form.address1)){
						if (isNotEmpty(form.city)){
							if (isNotEmpty(form.state)){
								if (isNotEmpty(form.zip)){
									if (isNotEmpty(form.phone)){
										if (isNotEmpty(form.email)){
											if (isNotEmpty(form.trade)){
												if (isNotEmpty(form.username)){
													if (isNotEmpty(form.password)){
														return true;
													}											
												}																	
											}																	
										}								
									}							
								}							
							}							
						}							
					}							
				}	
			}
		}
		return false;
	}		
	
	
	function validateSignUpForm(theForm){
		if (isNotEmpty(theForm.firstname)){
			if (isNotEmpty(theForm.lastname)){
				if (isNotEmpty(theForm.company)){
					if (isNotEmpty(theForm.address1)){
						if (isNotEmpty(theForm.city)){
							if (isNotEmpty(theForm.state)){
								if (isNotEmpty(theForm.zip)){
									if (isNotEmpty(theForm.phoneNumber)){
										if (isNotEmpty(theForm.email)){
											if (isNotEmpty(theForm.trade)){
												if (isNotEmpty(theForm.username)){
													if (isNotEmpty(theForm.password)){
														if (isNotEmpty(theForm.password_again)){
															return true;
														}											
													}											
												}																	
											}																	
										}								
									}							
								}							
							}							
						}							
					}							
				}	
			}
		}
		return false;
	}		

	
	function isExpirationDate(elem){
		var str = elem.value;
		var re = /[0-9]{2}[0-9]{2}/;
		if (!str.match(re)){
			alert("Please enter expiration date in mmyy format, i.e., 0707.");
			return false;
		} else {
			return true;
		}
	}		


	function isValidCreditCard(type, ccnum) {

	   if (type == "Visa") {
	      // Visa: length 16, prefix 4, dashes optional.
	      var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
	   } else if (type == "MasterCard") {
	      // Mastercard: length 16, prefix 51-55, dashes optional.
	      var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
	   } else if (type == "Discover") {
	      // Discover: length 16, prefix 6011, dashes optional.
	      var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;      
	   } else if (type == "American Express") {
	      // American Express: length 15, prefix 34 or 37.
	      var re = /^3[4,7]\d{13}$/;
	   } else if (type == "Diners Club") {
	      // Diners: length 14, prefix 30, 36, or 38.
	      var re = /^3[0,6,8]\d{12}$/;
	   }
	   
	   
	   if (!re.test(ccnum)){
	   		//alert("Invalid credit card number! Please enter a valid credit card number.");
			window.location.href = "index.cfm?pgid=checkout&layout=2col&ccerror=y";
	   	 	return false;
	   	 }

	   
	   
	   // Remove all dashes for the checksum checks to eliminate negative numbers	   
	   ccnum.value = ccnum.value.split("-").join("");

	   // Checksum ("Mod 10")
	   // Add even digits in even length strings or odd digits in odd length strings.
	   var checksum = 0;
	   for (var i=(2-(ccnum.length % 2)); i<=ccnum.length; i+=2) {
	      checksum += parseInt(ccnum.charAt(i-1));
	   }
	   
	   // Analyze odd digits in even length strings or even digits in odd length strings.
	   for (var i=(ccnum.length % 2) + 1; i<ccnum.length; i+=2) {
	      var digit = parseInt(ccnum.charAt(i-1)) * 2;
	      if (digit < 10) { checksum += digit; } else { checksum += (digit-9); }
	   }
	    
	   if ((checksum % 10) == 0){
	   	 return true;
	   	 } 
	   	 else {
	   		alert("Invalid credit card number!");
	   	 	return false;
	   	 }  	 
	}

	
	function reassignOrder(site_id) {
		if (site_id.options[site_id.selectedIndex].value != ""){
			window.location.href = "index.cfm?action=reassign&id=" 
			+ site_id.options[site_id.selectedIndex].value
		}
	}
	
	function add_to_cart(url) {
		
		window.location.href = url 
			+ "&pwd=" + document.enter_password.password.value
	}

	
	function submit_password(url) {
		alert("hello");
		window.location.href = url
			//+ "&pwd=" + document.enter_password.password.value
	}

	
	function showAlert(theMessage) {
		alert(theMessage);
	}

	
	function checkFilename(elem){	
		var str = elem.invitation_attachment.value;
		
		if (!elem.fckAttachment.checked)
		{
			if (elem.invitation_attachment.value.length < 6) {
			alert("Please select a file to attach using the Browse button.")
			return false
			}
		
		
			var re = /[!@#%^&()+={};"'<>?]/;
			if (str.match(re)){
				alert("Please use filenames that contain alpha-numeric characters, hyphens and underscores.");
				return false;
			} else {
				return true;
			}
		
		} else{
			return true;
		}
	}		
	
	
	
	function showList(theList) {
		alert(theList);
	}

	
	function toggleMenu(theMenu) {
		if (document.getElementById){
			var theElement = document.getElementById(theMenu).style;
			if(theElement.display == "block") {
				theElement.display = "none";
			} else {
				theElement.display = "block";
			}
			return false;
			} else {
			return true;
		}
	}