function fnOpenScreenshot(xName)
{
	window.open('Screenshot.aspx?img=' + xName, 'Screenshot', 'width=660, height=498, menubar=no, resizable=no, scrollbars=no, titlebar=no');
}

function cmdSubmit_Click(iUpgrade)
{
	
	letters="abcdefghijklmnopqrstuvwxyz";
 	LETTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 	keyalert="  The software key can be found at the top of the activation screen.  See below for further details.";
	
	
	if (document.getElementById("txtOfficeName").value.length == 0)
	{
		alert("Please enter the office name.");
		document.getElementById("txtOfficeName").select();
		return;
	}
	
 	if (modValChar(document.getElementById("txtOfficeName").value) == 1)
	{
		alert("The office name may not contain any of the following characters:  & , #");
		document.getElementById("txtOfficeName").select();
		return;
	}
	
	if (document.getElementById("txtShipAddress").value.length == 0)
	{
		alert("Please enter the office address.");
		document.getElementById("txtShipAddress").select();
		return;
	}
	

	if (modValChar(document.getElementById("txtShipAddress").value) == 1) 
	{
		alert("The office address may not contain any of the following characters:  & , #");
		document.getElementById("txtAddress").select();
		return;
	}

	if (document.getElementById("txtShipCity").value.length == 0)
	{
		alert("Please enter the office city.");
		document.getElementById("txtShipCity").select();
		return;
	}
	
	if (modValChar(document.getElementById("txtShipCity").value) == 1) 
	{
		alert("The office city may not contain any of the following characters:  & , #");
		document.getElementById("txtShipCity").select();
		return;
	}

	if (document.getElementById("cmbShipState").value == "")
	{
		alert("Please enter the office state.");
		document.getElementById("cmbShipState").select();
		return;
	}

	if (modValChar(document.getElementById("cmbShipState").value) == 1) 
	{
		alert("The office state may not contain any of the following characters:  & , #");
		document.getElementById("cmbShipState").select();
		return;
	}

	if (document.getElementById("txtShipZIP").value.length < 5)
	{
		alert("Please enter the office ZIP.");
		document.getElementById("txtShipZIP").select();
		return;
	}

	if (modValChar(document.getElementById("txtShipZIP").value) == 1) 
	{
		alert("The office ZIP may not contain any of the following characters:  & , #");
		document.getElementById("txtShipZIP").select();
		return;
	}

	if (document.getElementById("txtContactName").value.length == 0)
	{
		alert("Please enter the cardholder's name.");
		document.getElementById("txtContactName").select();
		return;
	}
	
	if (modValChar(document.getElementById("txtContactName").value) == 1) 
	{
		alert("The cardholder's name may not contain any of the following characters:  & , #");
		document.getElementById("txtContactName").select();
		return;
	}
		
	if (document.getElementById("txtAddress").value.length == 0)
	{
		alert("Please enter the cardholder's address.");
		document.getElementById("txtAddress").select();
		return;
	}
	
	if (modValChar(document.getElementById("txtAddress").value) == 1) 
	{
		alert("The cardholder's address may not contain any of the following characters:  & , #");
		document.getElementById("txtAddress").select();
		return;
	}

	if (document.getElementById("txtCity").value.length == 0)
	{
		alert("Please enter the cardholder's city.");
		document.getElementById("txtCity").select();
		return;
	}
	
	if (modValChar(document.getElementById("txtCity").value) == 1) 
	{
		alert("The cardholder's city may not contain any of the following characters:  & , #");
		document.getElementById("txtCity").select();
		return;
	}
		
	if (document.getElementById("cmbState").value.length == 0)
	{
		alert("Please enter the cardholder's state.");
		document.getElementById("cmbState").select();
		return;
	}
	
	if (modValChar(document.getElementById("cmbState").value) == 1) 
	{
		alert("The cardholder's state may not contain any of the following characters:  & , #");
		document.getElementById("cmbState").select();
		return;
	}
	
	if (document.getElementById("txtZIP").value.length < 5)
	{
		alert("Please enter the cardholder's ZIP.");
		document.getElementById("txtZIP").select();
		return;
	}
	
	if (modValChar(document.getElementById("txtZIP").value) == 1) 
	{
		alert("The cardholder's ZIP may not contain any of the following characters:  & , #");
		document.getElementById("txtZIP").select();
		return;
	}
		
	if (document.getElementById("txtEmail").value.length == 0)
	{
		alert("Please enter the email address.");
		document.getElementById("txtEmail").select();
		return;
	}
	
	if (modValChar(document.getElementById("txtEmail").value) == 1) 
	{
		alert("The email address may not contain any of the following characters:  & , #");
		document.getElementById("txtEmail").select();
		return;
	}	

	if (document.getElementById("txtEmail").value.indexOf("@") < 0 || document.getElementById("txtEmail").value.indexOf(".") < 0)
	{
		alert("Please enter the full email address.");
		document.getElementById("txtEmail").select();
		return;
	}
	
	if (document.getElementById("txtKey1").value.length != 1)
	{
		alert("Please enter the entire six-letter software key." + keyalert);
		document.getElementById("txtKey1").select();
		return;
	}		

	if (document.getElementById("txtKey2").value.length != 1)
	{
		alert("Please enter the entire six-letter software key." + keyalert);
		document.getElementById("txtKey2").select();
		return;
	}	
	
	if (document.getElementById("txtKey3").value.length != 1)
	{
		alert("Please enter the entire six-letter software key." + keyalert);
		document.getElementById("txtKey3").select();
		return;
	}	
	
	if (document.getElementById("txtKey4").value.length != 1)
	{
		alert("Please enter the entire six-letter software key." + keyalert);
		document.getElementById("txtKey4").select();
		return;
	}	
	
	if (document.getElementById("txtKey5").value.length != 1)
	{
		alert("Please enter the entire six-letter software key." + keyalert);
		document.getElementById("txtKey5").select();
		return;
	}	
	
	if (document.getElementById("txtKey6").value.length != 1)
	{
		alert("Please enter the entire six-letter software key." + keyalert);
		document.getElementById("txtKey6").select();
		return;
	}	
	
	if (letters.indexOf(document.getElementById("txtKey1").value) < 0 && LETTERS.indexOf(document.getElementById("txtKey1").value) < 0)
	{
		alert("Please use letters only when entering the software key." + keyalert);
		document.getElementById("txtKey1").select();
		return;
	}

	if (letters.indexOf(document.getElementById("txtKey2").value) < 0 && LETTERS.indexOf(document.getElementById("txtKey2").value) < 0)
	{
		alert("Please use letters only when entering the software key." + keyalert);
		document.getElementById("txtKey2").select();
		return;
	}
	
	if (letters.indexOf(document.getElementById("txtKey3").value) < 0 && LETTERS.indexOf(document.getElementById("txtKey3").value) < 0)
	{
		alert("Please use letters only when entering the software key." + keyalert);
		document.getElementById("txtKey3").select();
		return;
	}
	
	if (letters.indexOf(document.getElementById("txtKey4").value) < 0 && LETTERS.indexOf(document.getElementById("txtKey4").value) < 0)
	{
		alert("Please use letters only when entering the software key." + keyalert);
		document.getElementById("txtKey4").select();
		return;
	}

	if (letters.indexOf(document.getElementById("txtKey5").value) < 0 && LETTERS.indexOf(document.getElementById("txtKey5").value) < 0)
	{
		alert("Please use letters only when entering the software key." + keyalert);
		document.getElementById("txtKey5").select();
		return;
	}
	
	if (letters.indexOf(document.getElementById("txtKey6").value) < 0 && LETTERS.indexOf(document.getElementById("txtKey6").value) < 0)
	{
		alert("Please use letters only when entering the software key." + keyalert);
		document.getElementById("txtKey6").select();
		return;
	}		
	
	if (iUpgrade == 1)
	{
		if (document.getElementById("cmbState").value == "IL")
			xAmount = "31.54"
		else
			xAmount = "29.00"
	}
	else
	{
		if (document.getElementById("cmbState").value == "IL")
			xAmount = "53.29"
		else
			xAmount = "49.00"
	}
	
	xDoc = "/FloorForWindows/Redirect.asp";
	xDoc += "?sid=64763&version=4&phone=%20&country=United%20States&ship_country=United%20States&total=" + xAmount;
	xDoc += "&card_holder_name=" + document.getElementById("txtContactName").value;
	xDoc += "&street_address=" + document.getElementById("txtAddress").value;
	xDoc += "&city=" + document.getElementById("txtCity").value;
	xDoc += "&state=" + document.getElementById("cmbState").value;
	xDoc += "&zip=" + document.getElementById("txtZIP").value;
	xDoc += "&ship_name=" + document.getElementById("txtOfficeName").value;
	xDoc += "&ship_street_address=" + document.getElementById("txtShipAddress").value;
	xDoc += "&ship_city=" + document.getElementById("txtShipCity").value;
	xDoc += "&ship_state=" + document.getElementById("cmbShipState").value;
	xDoc += "&ship_zip=" + document.getElementById("txtShipZIP").value;
	xDoc += "&cart_order_id=" + document.getElementById("txtKey1").value + document.getElementById("txtKey2").value + document.getElementById("txtKey3").value + document.getElementById("txtKey4").value + document.getElementById("txtKey5").value + document.getElementById("txtKey6").value;
	xDoc += "&email=" + document.getElementById("txtEmail").value;
	
	document.location = xDoc;
}


function modValChar(xText)
{	
	xValChar = 0;
	
	if (xText.indexOf("&") > -1 || xText.indexOf(",") > -1 || xText.indexOf("#") > -1)
		xValChar = 1;
		
	return xValChar;
}
