function test() {
	alert("TEST");
}

function playMovie(movie) {
	var divHTML = "<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width='320' height='260' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>";
	divHTML += "<param name='src' value='http://www.easternslopeproductions.com/redesign/" + movie + "'>";
	divHTML += "<param name='autoplay' value='true'>";
	divHTML += "<param name='controller' value='true'>";
	divHTML += "<param name='loop' value='false'>";
	divHTML += "<embed src='" + movie + "' width='320' height='260' autoplay='true' "; 
	divHTML += "controller='true' loop='false' bgcolor='#000000' pluginspage='http://www.apple.com/quicktime/download/'>";
	divHTML += "</embed>";
	divHTML += "</object>";
	
	var midLeft = (document.body.clientWidth/2)-175;
	var midTop = (document.body.clientHeight/2)-160;
	var win = window.open('', 'movie', 'left=' + midLeft + ',top=' + midTop + ',width=350,height=320,scrollbars=no,resizable=no,status=no');
	win.document.open() ;
	win.document.writeln("<html>") ;
	win.document.writeln("<head><title>Eastern Slope Productions</title></head>") ;
	win.document.writeln("<body bgcolor=white>") ;
	win.document.writeln("<div align=\"center\"><p>" + divHTML + "</p>");
	win.document.writeln("<a href=\"javascript:window.close();\" style='color: blue; text-decoration: none;'>Close Window</a></div>") ;
	win.document.writeln("</body>") ;
	win.document.writeln("</html>") ;
	win.document.close() ;
}


	function getXMLHttp() {
		var XMLHttp = null;
		if (window.XMLHttpRequest) {
			try {
				XMLHttp = new XMLHttpRequest();
			} catch (e) {
				alert(e.description);
			}
		} else if (window.ActiveXObject) {
			try {
				XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					alert(e.description);
				}
			}
		}
	
		return XMLHttp;
	}
	var XMLHttp = getXMLHttp();
	//window.onload = loadXML;
	var fileName = "";
	var loaderRef = "";
	var smallLoaderRef = "";
	var divRemove = "";
	function loadXML(thefile, oData, loader, smallLoader) {
		if (loader == "loaderMain") {
			document.getElementById("cbResults").style.display = "none";
			document.getElementById("cbResults").innerHTML = "";	
		} else if (loader == "loaderCart") {
			document.getElementById("cartInfo").style.display = "none";
			document.getElementById("cartInfo").innerHTML = "";
		}	
		
		if (oData.removeDiv) {
			divRemove = oData.removeDiv;
		} else {
			divRemove = "";	
		}
		
		XMLHttp.open("POST", thefile, true);
		loaderRef = loader;
		smallLoaderRef = smallLoader;
		var params = new String("");
		for (var prop in oData) {
			params += prop + "=" + escape(oData[prop]) + "&";
		}
		params = params.substr(0, params.length-1);
		
		XMLHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		XMLHttp.setRequestHeader("Content-length", params.length);
		XMLHttp.setRequestHeader("Connection", "close");
		
		fileName = thefile;
		XMLHttp.onreadystatechange = handlerFunction;
		
		
		setTimeout("XMLHttp.send('" + params + "')", 1000);
	}
	
	function handlerFunction() {
		if (XMLHttp.readyState == 4) {
			
			if (loaderRef == "loaderMain") {
				document.getElementById(loaderRef).style.display = "none";
				document.getElementById("leftContent").style.display = "block";
				
				var results = XMLHttp.responseText;
				var midLeft = (document.body.clientWidth/2)-150;
				var midTop = (document.body.clientHeight/2)-160;
				
				document.getElementById("cbResults").style.top = 200;
				document.getElementById("cbResults").style.left = midLeft;
								
				if (results == "Success") {
					var shtml = "<span class='bold italic larger'>Success!</span><br /><br />";
						shtml += "Your request has been sent.  You should receive a response within 24 hours.<br /><br/>Sincerely,";
						shtml += "<br /><br />Eastern Slope Productions<br /><br /><input type='button' value='Close' onclick='document.getElementById(\"cbResults\").style.display=\"none\";' />";
					document.getElementById("cbResults").innerHTML = shtml;
					
					contactUs.resetValues();
					
				} else {
					var shtml = "<span class='bold italic larger'>Error</span><br /><br />";
						shtml += "We're sorry, but there was a problem with your request.  Please check your information and try submitting again.<br /><br />If problems still persist, please contact us directly by email at <a href='mailto:brianbuck@easternslopeproductions.com'>brianbuck@easternslopeproductions.com</a>.<br /><br/>Sincerely,";
						shtml += "<br /><br />Eastern Slope Productions<br /><br /><input type='button' value='Close' onclick='document.getElementById(\"cbResults\").style.display=\"none\";' />";
					document.getElementById("cbResults").innerHTML = shtml;
				}
				
				document.getElementById("cbResults").style.display = "block";
			} else if (loaderRef == "loaderCart") {
				document.getElementById(loaderRef).style.display = "none";
				
				if (document.getElementById(smallLoaderRef)) {
					document.getElementById(smallLoaderRef).style.display = "none";
					
				}
				if (divRemove != "") {
						document.getElementById(divRemove).style.display = "block";
					}
				//document.getElementById("cartInfo")
				
				//document.getElementById("loaderMain").style.display = "none";
				//document.getElementById("leftContent").style.display = "block";
				
				var cartResults = XMLHttp.responseText;
				document.getElementById("cartInfo").innerHTML = cartResults;
				document.getElementById("cartInfo").style.display = "block";
				
				if (document.getElementById("page")) {
					if (document.getElementById("page").value == "cart") {
						location.href = "index.asp";	
					}	
				}
			}
		}	
	}
	

	var Element = document;

	function ContactUs() {
		this.init();
	}
	
	ContactUs.prototype.init = function() {
		this.name = "";
		this.email = "";
		this.qc = "";
		this.defQC = "Use this space to provide your questions and comments.";
		this.interest = [];
		this.interest["services"] = {isChecked: false, id: "intServices", value: "Services"};
		this.interest["products"] = {isChecked: false, id: "intProducts", value: "Products"};
		this.interest["pricing"] = {isChecked: false, id: "intPricing", value: "Pricing"};
		this.interest["tos"] = {isChecked: false, id: "intTOS", value: "TOS"};
		this.interest["aae"] = {isChecked: false, id: "intAAE", value: "AAE"};
		this.interest["none"] = {isChecked: false, id: "intNone", value: "None"};
	}
	
	ContactUs.prototype.errorCheck = function() {
		this.grabValues();	

		this.bError = false;
		
		if (this.name == "") {
			this.bError = true;	
			document.getElementById("nameError").innerHTML = "Please provide your name.";
			document.getElementById("nameError").style.display = "block";
			document.getElementById("fullName").style.backgroundColor = "#FFFFCF";
		} else {
			document.getElementById("nameError").style.display = "none";	
			document.getElementById("fullName").style.backgroundColor = "#FFFFFF";
		}
		
		if (this.email == "") {
			this.bError = true;
			document.getElementById("emailError").innerHTML = "Please provide your e-mail.";
			document.getElementById("emailError").style.display = "block";
			document.getElementById("email").style.backgroundColor = "#FFFFCF";
		} else if (!/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/.test(this.email)) {
			this.bError = true;	
			document.getElementById("emailError").innerHTML = "Please provide a valid e-mail.";
			document.getElementById("emailError").style.display = "block";
			document.getElementById("email").style.backgroundColor = "#FFFFCF";
		} else {
			document.getElementById("emailError").style.display = "none";
			document.getElementById("email").style.backgroundColor = "#FFFFFF";	
		}
		
		if (this.qc == "") {
			this.bError = true;
			document.getElementById("qcError").innerHTML = "Please provide your questions/comments.";
			document.getElementById("qcError").style.display = "block";
			document.getElementById("qc").style.backgroundColor = "#FFFFCF";
		} else if (this.qc == this.defQC) {
			this.bError = true;
			document.getElementById("qcError").innerHTML = "Please provide your questions/comments.";
			document.getElementById("qcError").style.display = "block";
			document.getElementById("qc").style.backgroundColor = "#FFFFCF";
		} else {
			document.getElementById("qcError").style.display = "none";
			document.getElementById("qc").style.backgroundColor = "#FFFFFF";
		}
		
		if (!this.bError) {
			document.getElementById("leftContent").style.display = "none";
			document.getElementById("loaderMain").style.display = "block";
		
			this.oData = {name: "", email: "", qc: "", interests: ""};
			this.oData.name = this.name;
			this.oData.email = this.email;
			this.oData.qc = this.qc;
			
			var sInterest = new String("");
			for (var ref in this.interest) {
				if (this.interest[ref].isChecked) {
					sInterest += this.interest[ref].value + "|";
				}
			}
			
			sInterest = sInterest.substr(0, sInterest.length-1);
			
			this.oData.interests = sInterest;
			
		
	
			loadXML("server/sendMail.asp", this.oData, "loaderMain");
		}		
	}
	
	ContactUs.prototype.grabValues = function() {
		this.name = document.getElementById("fullName").value;
		this.email = document.getElementById("email").value;
		this.qc = document.getElementById("qc").value;
		
		for (var ref in this.interest) {
			this.interest[ref].isChecked = document.getElementById(this.interest[ref].id).checked;	
		}

	}
	
	ContactUs.prototype.resetValues = function() {
		this.name = "";
		this.email = "";
		this.qc = "";
		for (var ref in this.interest) {
			this.interest[ref].isChecked = false;
			document.getElementById(this.interest[ref].id).checked = false;
		}
		
		document.getElementById("fullName").value = "";
		document.getElementById("email").value = "";
		document.getElementById("qc").value = this.defQC;
			document.getElementById("qc").style.color = "#666666";
		
		document.getElementById("nameError").style.display = "none";
		document.getElementById("emailError").style.display = "none";
		document.getElementById("qcError").style.display = "none";
		
		document.getElementById("fullName").style.backgroundColor = "#FFFFFF";
		document.getElementById("email").style.backgroundColor = "#FFFFFF";
		document.getElementById("qc").style.backgroundColor = "#FFFFFF";
		
		
	}
	
	ContactUs.prototype.handleTextarea = function(el) {
		if (el.value == this.defQC) {
			el.value = "";	
		}
	}
	
	ContactUs.prototype.checkEnter = function(el, evt) {
		if (evt.keyCode == 13) {
			this.errorCheck();	
		}
	}

	var contactUs = new ContactUs();



	function Products() {
		this.oData = {};
		this.tos = [];
		this.init();
	}
	
	Products.prototype.init = function() {
		this.tos["11032007"] = {cost: 25, name: "Tap or Snap (MMA)", tImg: "tosNov3Small.gif", img: "tosNov3.gif", 
			tWidth: 100, width: 150, tHeight: 147, height: 221, date: "11/3/2007", 
			desc: "DVD of the Tap or Snap Mixed Martial Arts fights held at the Douglas County Events in Castle Rock, Colorado on November 3, 2007."};
		
		this.tos["08142007"] = {cost: 25, name: "Tap or Snap (MMA)", tImg: "tosAug18Small.gif", img: "tosAug18.gif", 
			tWidth: 100, width: 150, tHeight: 147, height: 221, date: "8/18/2007",
			desc: "DVD of the Tap or Snap Mixed Martial Arts fights held at the Douglas County Events in Castle Rock, Colorado on August 18, 2007."};
			
		this.tos["06242007"] = {cost: 25, name: "Tap or Snap (MMA)", tImg: "tosJune24Small.gif", img: "tosJune24.gif", 
			tWidth: 100, width: 150, tHeight: 147, height: 221, date: "6/24/2007", 
			desc: "DVD of the Tap or Snap Mixed Martial Arts fights held in Downtown Colorado Springs, Colorado on June 24, 2007."};	
	}
	
	Products.prototype.addProduct = function(idProd, qtyEl, divRemove) {
		//document.getElementById("leftContent").style.display = "none";
		//document.getElementById("loaderMain").style.display = "block";
		
		if (!isNaN(document.getElementById(qtyEl).value) && !/\./g.test(document.getElementById(qtyEl).value)) {
			document.getElementById("smallLoader" + idProd).style.display = "block";
			
			document.getElementById("cartInfo").style.display = "none";
			document.getElementById("loaderCart").style.display = "block";
			
			this.oData = {name: this.tos[idProd].name, cost: this.tos[idProd].cost, date: this.tos[idProd].date, qty: document.getElementById(qtyEl).value, removeDiv: divRemove};
			loadXML("server/cart.asp", this.oData, "loaderCart","smallLoader" + idProd);
			
		} else if (!isNaN(document.getElementById(qtyEl).value) && /\./g.test(document.getElementById(qtyEl).value)) {
			alert("Error: The quantity entered for " + this.tos[idProd].name + " must be a whole number.");
		} else {
			alert("Error: The quantity entered for " + this.tos[idProd].name + " must be a numeric.");	
		}
	}
		
	Products.prototype.clearCart = function(page) {
		document.getElementById("cartInfo").style.display = "none";
		document.getElementById("loaderCart").style.display = "block";
		
		loadXML("server/cart.asp", {cart: "clear", page: page}, "loaderCart");	
	}
	Products.prototype.removeProduct = function(idProd, divRemove) {
		document.getElementById("cartInfo").style.display = "none";
		document.getElementById("loaderCart").style.display = "block";
		
		document.getElementById(divRemove).style.display = "none";
		document.getElementById("smallLoader" + idProd).style.display = "block";
		
		loadXML("server/cart.asp", {name: this.tos[idProd].name + " - DVD - " + this.tos[idProd].date, cart: "remove"}, "loaderCart", "smallLoader" + idProd);
	}
	
	Products.prototype.checkoutUpdate = function(idRef) {
		
	}
	
	Products.prototype.checkoutRemove = function(prodName) {
		alert(prodName);	
	}
	
	var products = new Products();