//*********************************************************************
//
//	Boat Names Australia
//	--------------------
//
//	JavaScript library for BotaNamesDesign Page's
//
//	Written by Fwintech - Benjamin Best
//
//	Version 0.1.7
//	
//	Modification Log
//	----------------
//	Date		Modified
//
//	09/02/2003	Benjamin Best
//	Original Creation.
//
//
//**********************************************************************


// Select Font
// Opens a font page to allow users to select different fonts for their Boat Names.
var hlpMsg0 = "";
var hlpMsg1 = "";
var hlpMsg2 = "";
var hlpMsg3 = "";
var hlpMsg4 = "";
var sidesPrice = 0;
var transomPrice = 0;
var portPrice = 0;
var regoPrice = 0;
var totalPrice = 0;


var nDesignProgramIP = "124.243.153.191";

var nNumberOfCodes = 27;

var sDiscountCode = "BNADSC";

function selectFont() {
	if(document.createName.CustomerName.value!="new")
	{
 		fontWin= open("http://localhost:8080/servlet/com.fwinboat.servlets.GetBoatName?Purpose=SelectFont&CustomerName="+document.createName.CustomerName.value, "selectfontWindow","width=530,height=480,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");
	}
	else
	{
		fontWin= open("http://localhost:8080/servlet/com.fwinboat.servlets.GetBoatName?Purpose=SelectFont", "selectfontWindow","width=530,height=480,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");
	}
 	fontWin.window.focus();
}
//**********************************************************************


// Choose Effect Style
// Sets hte effect style chosen by the user.
function chooseEffectStyle(index){
  	document.createName.effectStyle[index].checked=true;
  	document.createName.EffectStyle.value=document.createName.effectStyle[index].value;
  	calcPrice();
}
//**********************************************************************


// Choose Font
// Actually selects the font chosen by the user.
function choosefont(index)
{
	if(index!=-1) {
		document.fonts.fnt[index].checked=true;	
	}
	for(i=0;i<=43;i++) {
		if(document.fonts.fnt[i].checked) {
			opener.document.createName.Font.value=document.fonts.fnt[i].value;
			opener.document.createName.FontIndex.value=i;
			break;
		}
	}	
	window.close();
}
//**********************************************************************


// Preview
// Gathers all the elements set by the user and sends them to the server.
// A JPG of their boat name is returned in the new window opened.
function preview()
{
	//alert("Sorry the design preview is currently unavailable, we will attempt to restore the preview by Tuesday night.\n  In the meantime, if you wish, you can still submit your design and details, but don't continue on to the Payment process, and we will email you a design ASAP for you to preview.\n  We appologise for any inconvenience.");
	//return;
	if ( document.createName.CookiesExist.value == "true" ){
		// Check the boat name
		if ( document.createName.BoatName.value == "" )
		{
			alert("You need to enter a name for your boat.");
			return;
		}
		var outStr = "";
	
		outStr += "Purpose=CreateBoatName";
		outStr += "&FileName="+document.createName.FileName.value;
		outStr += "&BoatName="+document.createName.BoatName.value;
		outStr += "&FontName="+document.createName.Font.value;
		outStr += "&NameColour="+document.createName.NameColour.value;
		outStr += "&BoatColour="+document.createName.BoatColour.value;
		if ( document.createName.PortName.value!="" )
		{
			outStr += "&Port=Y";
			outStr += "&PortFontName="+document.createName.PortFontName.value;
			outStr += "&PortName="+document.createName.PortName.value;
			outStr += "&PortNameColour="+document.createName.PortNameColour.value;
		}
		else 
		{
			outStr += "&Port=N";
		}
		
	//	if ( document.createName.RegoNumbers.value!="" )
	//	{
	//		outStr += "&Rego=Y";
	//		outStr += "&RgNum="+document.createName.RegoNumbers.value;
	//		outStr += "&RgClr="+document.createName.PortNameColour.value;
	//		outStr += "&RgFnt="+document.createName.RegoFont.value;
	//	}
	//	
		if ( document.createName.EffectStyle.value == "SHADOW" )
		{		
			outStr += setShadow();
		}
		else if ( document.createName.EffectStyle.value == "OUTLINE" )
		{
			outStr += setOutline();
		}
		else if ( document.createName.EffectStyle.value == "BOTH" )
		{
			outStr += setShadow();
			outStr += setOutline();
		}
		else
		{
			outStr += "&Shadow=N";
			outStr += "&Outline=N";
		}
		calcPrice();
		
		//fontWin= open("http://flounder.cirrusaustralia.com.au/servlet/GetBoatName?"+outStr, "YourBoatName","width=530,height=240,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,alwaysRaised");
		fontWin= open("http://"+nDesignProgramIP+"/GetBoatName?"+outStr, "YourBoatName","width=700,height=400,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,alwaysRaised");
		fontWin.focus();
	}
	else{
		alert("You can't preview or order without cookies enabled!");
	}
		
}
//**********************************************************************

function setRegoFont(val)
{
	if ( val == 1 )
		document.createName.RegoFontVal.value = "Nice";
	else
		document.createName.RegoFontVal.value = "Same";
}

// Preview Rego
function previewRego()
{
	//alert("Sorry the design preview is currently unavailable, we will attempt to restore the preview by Tuesday night.\n  In the meantime, if you wish, you can still submit your design and details, but don't continue on to the Payment process, and we will email you a design ASAP for you to preview.\n  We appologise for any inconvenience.");
	//return;
	if ( document.createName.CookiesExist.value == "true" ){
		// Check the boat name
		if ( document.createName.RegoNumbers.value == "" )
		{
			alert("You need to enter rego numbers to preview.");
			return;
		}
				
		var sFileName = "";
		
		if ( document.createName.BoatNamePreviewed.value == "Yes" )
		{
			sFileName = "New";
			if ( document.createName.LastPreviewed.value == "Boat" )
			{
				document.createName.FileNameUsed.value = document.createName.FileName.value;	
			}	
		}
		else
		{
			sFileName = document.createName.FileName.value;
		}
		
		document.createName.RegoPreviewed.value = "Yes";
		document.createName.LastPreviewed.value = "Rego";
		
		var outStr = "";
		outStr += "Purpose=CreateBoatName";
		outStr += "&FileName="+sFileName;
		outStr += "&BoatName="+document.createName.RegoNumbers.value;
		if ( document.createName.RegoFontVal.value == "Nice" )
		{
			outStr += "&FontName=Impact";
		}
		else
		{
			outStr += "&FontName="+document.createName.Font.value;
		}
		outStr += "&NameColour="+document.createName.RegoColour.value;
		outStr += "&BoatColour="+document.createName.BoatColour.value;
		if ( document.createName.RegoShadow.checked==true )
		{		
			outStr += "&Shadow=Y";
			outStr += "&ShadowColour="+document.createName.RegoShadowColour.value;
			outStr += "&ShadowOffset=4;4;";
			outStr += "&ShadowVerticalOrientation=SHADOW_DOWN";
			outStr += "&ShadowHorizontalOrientation=SHADOW_RIGHT";
			outStr += "&ShadowType=FLOATING";
		}
		else
		{
			outStr += "&Shadow=N";
		}
		outStr += "&Outline=N";
		
		outStr += "&Port=N";
		outStr += "&Rego=N";
		calcPrice();
		
		//fontWin= open("http://flounder.cirrusaustralia.com.au/servlet/GetBoatName?"+outStr, "YourBoatName","width=530,height=240,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,alwaysRaised");
		fontWin= open("http://"+nDesignProgramIP+"/GetBoatName?"+outStr, "YourBoatName","width=700,height=400,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,alwaysRaised");
		fontWin.focus();
	}
	else{
		alert("You can't preview or order without cookies enabled!");
	}
		
}



// Set Colour
// Sets the chosen colour of an object based on the index value.

function colourChoice(index,r,g,b,clname)
{

	if ( index == 0 )
	{
		
		document.createName.NameColour.value = ""+r+";"+g+";"+b+";";
		document.createName.NameColourName.value = clname;
	}
	else if ( index == 1 )
	{
		document.createName.BoatColour.value = ""+r+";"+g+";"+b+";";
		document.createName.BoatColourName.value = clname;
	}
	else if ( index == 4 )
	{
		document.createName.ShadowColour.value = ""+r+";"+g+";"+b+";";
		document.createName.ShadowColourName.value = clname;
		if ( document.createName.OutlineChosen.value=="No" )
		{
			document.createName.OutlineColour.value = ""+r+";"+g+";"+b+";";
			document.createName.OutlineColourName.value = clname;
		}
	}
	else if ( index == 3 )
	{
		document.createName.PortNameColour.value = ""+r+";"+g+";"+b+";";
		document.createName.PortNameColourName.value = clname;
	}
	else if ( index == 2 )
	{
		document.createName.OutlineColour.value = ""+r+";"+g+";"+b+";";
		document.createName.OutlineColourName.value = clname;
		document.createName.OutlineChosen.value="Yes";
	}
	else if ( index == 5 )
	{
		document.createName.RegoColour.value = ""+r+";"+g+";"+b+";";
		document.createName.RegoColourName.value = clname;
	}
	else if ( index == 6 )
	{
		document.createName.RegoShadowColour.value = ""+r+";"+g+";"+b+";";
		document.createName.RegoShadowColourName.value = clname;
	}
	
	calcPrice();

}
//**********************************************************************


// Set Shadow
// Sets the shadow style for the boat name
function setShadow()
{

	var str = "";
	str += "&Shadow=Y";
	str += "&ShadowColour="+document.createName.ShadowColour.value;
	if ( document.createName.EffectStyle.value == "BOTH" )
	{
		if ( document.createName.OutlineSize.value == "1" )
		{
			str += "&ShadowOffset=6;6;";
		}
		else if ( document.createName.OutlineSize.value == "2" )
		{
			str += "&ShadowOffset=8;8;";
		}
		else
		{
			str += "&ShadowOffset=12;12;";
		}
	}
	else
	{
		str += "&ShadowOffset=4;4;";
	}
		
	str += "&ShadowVerticalOrientation=SHADOW_DOWN";
	str += "&ShadowHorizontalOrientation=SHADOW_RIGHT";
	str += "&ShadowType=FLOATING";
	
	return str;	
}
//**********************************************************************


// Set Outline
// Sets the outline style for the boatname
function setOutline()
{
	var str = "";
	
	str += "&Outline=Y";
	str += "&OutlineColour="+document.createName.OutlineColour.value;
	str += "&OutlineSize="+document.createName.OutlineSize.value;
		
	return str;
}
//**********************************************************************

// Choose Outline
// Sets the outline style for the boatname
function chooseOutline(index)
{
	type = 1
	if ( index >= 4 )
	{
		index = index - 3;
		type = 3
	}
		
	opener.document.createName.OutlineSize.value=index;
	opener.document.createName.effectStyle[type].checked=true;
	opener.document.createName.EffectStyle.value=opener.document.createName.effectStyle[type].value;
	//calcPrice();
		
}
//**********************************************************************

// Choose Outline
// Sets the outline style for the boatname
function sendOrder()
{
	
}
//**********************************************************************

// on Open
// On opening the font page, sets the chosen font
function onOpen()
{
	var index = opener.document.createName.FontIndex.value;
	document.fonts.fnt[index].checked=true;	
}
//**********************************************************************

function onOpenDesign()
{
	if ( document.cookie == "" ){
		alert("You need to enable cookies for this page to work!");
		document.createName.CookiesExist.value = "false";
	}
	else
	{
		document.createName.CookiesExist.value = "true";
	}
}



// helpOn
// Popup help on various items
function helpOn(index)
{
	switch(index)
	{
		case 0:
			setMessage(0,"Type in your boat name here. If you would like it all in CAPITOLS then type it that way. If you are going to be choosing script style then all capitols would be too busy.");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 1:
			setMessage(0,"All fonts, even plain simple ones, convey a particular feeling when reading them. Think about this when choosing your font.");
			setMessage(1,"eg, A name like Serendipity would be best in a script and Terminator wouldn't");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 2:
			setMessage(0,"It's a good idea to select a colour that matches other colours used on your boat." );
			setMessage(1,"The area you will want to place your name is probably white, in which case you should use dark lettering if you want maxium readability.");
			setMessage(2,"Colours have feelings attached to them, eg, RED - Fast, Hot, Anger, Sporty, Loud, Sporty, Devil, Blood. NAVY - Prestige, Composed, Calm, Expensive, Traditional.");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 3:
			setMessage(0,"Select the colour that the name will be placed on");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 4:
			setMessage(0,"You can Preview at anytime and easily save these to your desktop to compare and make a final choice. ");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 5:
			setMessage(0,"A second colour will enhance your name making it look more finished and professional. Both colours come laid up together to make applying your name even easier.");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 6:
			setMessage(0,"This lets you choose the outline or shadow thickness and the distance off the lettering they are.");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 7:
			setMessage(0,"If you selected a dark letter colour, we suggest using a neutral colour for the shadow or outline like - Gold, Silver or Grey. The main letters should stand out the most, this makes your name more readable and less busy. If you selected a light letter colour, we suggest using a dark letter colour for the shadow or outline. ");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 8:
			setMessage(0,"If you selected a dark letter colour, we suggest using a neutral colour for the shadow or outline like - Gold, Silver or Grey. The main letters should stand out the most, this makes your name more readable and less busy. If you selected a light letter colour, we suggest using a dark letter colour for the shadow or outline.");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 9:
			setMessage(0,"If you can't find a suitable graphic here - Then let us know in the addtional Comments section and one of designers will give you a price to reate a custom one. To Email us your own graphic use the email button at the top of this page. We accept all common file formats. If you selected lettering and a graphic for the sides of your boat. the graphic will be designed to face the bow on both sides. ");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 10:
			setMessage(0,"This should be in CAPITOLS. Please let us choose a style for you based on our 17 years experience. If you have a specific idea in mind use the Additional Comments section below. We recommend using the darker or main colour used in your lettering. The hail port and rego will be the same colour unless you request otherwise in the Additional Comments section below.");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 11:
			setMessage(0,"We recommend the Nice Block option as it dosen't detract from your name");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 12:
			setMessage(0,"Would you like your name on the Sides of your boat, the Transom or Both? If you choose the SIDES you will receive two names. If you choose TRANSOM you receive only one.");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 13:
			setMessage(0,"We can make what ever size lettering you would like for any size boat. Speed boats generally have quite large names for there lenght. Loud names like Aquaholic or Yee Ha would look silly too small, on a 5m speed boat they would look better at 200mm - 275mm high.");
			setMessage(1,"If you have a softer more traditional name like Serendipity it could be better at 150mm high. ");
			setMessage(2,"Racing yachts generally have large names and cruising yachts have small ones on the stern with medium on the bow. If you choose a script font( using upper and lower case ) order a size 50mm higher to make up for the lower case letters being half the size. ");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
		case 14:
			setMessage(0,"This takes you through to Verisign payment system, One of the worlds most secure payment systems");
			setMessage(1,"");
			setMessage(2,"");
			setMessage(3,"");
			setMessage(4,"");
			openHelp();
			break;
	}
}
//**********************************************************************

// set Message
// Sets a help message
function setMessage(index,message)
{
	if  ( index == 0 ){
		hlpMsg0 = message;
	}
	if  ( index == 1 ){
		hlpMsg1 = message;
	}
	if  ( index == 2 ){
		hlpMsg2 = message;
	}
	if  ( index == 3 ){
		hlpMsg3 = message;
	}
	if  ( index == 4 ){
		hlpMsg4 = message;
	}
}
//**********************************************************************

// Open Help
// Opens the help window
function openHelp()
{
	var outStr = "";
	
	outStr += "Purpose=Help";
	outStr += "&HelpString0="+hlpMsg0;
	outStr += "&HelpString1="+hlpMsg1;
	outStr += "&HelpString2="+hlpMsg2;
	outStr += "&HelpString3="+hlpMsg3;
	outStr += "&HelpString4="+hlpMsg4;
	fontWin= open("http://"+nDesignProgramIP+"/GetBoatName?"+outStr, "HelpWindow","width=530,height=480,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");
}

//**********************************************************************

// Calcualte Price
function calcPrice()
{
	var colour1 = document.createName.NameColour.value;
	var colour2 = document.createName.ShadowColour.value;
	var colour3 = document.createName.OutlineColour.value;
	var tmpPrice = 0;
	var discountprice = 0;
	sidesPrice = 0;
	transomPrice = 0;
	portPrice = 0;
	regoPrice = 0;
	totalPrice = 0;
	
	
	var numColours = 1;
	
	if ( document.createName.EffectStyle.value == "OUTLINE"){
		if ( colour1 != colour3 ){
			numColours = 2;
		}
	}
	else if ( document.createName.EffectStyle.value == "SHADOW"){
		if ( colour1 != colour2 ){
			numColours = 2;
		}
	}
	else if ( document.createName.EffectStyle.value == "BOTH"){
		if (( colour3 != colour1 ) & ( colour3 != colour2 ) & ( colour2 != colour1 )){
			numColours = 3;
		}
		else if (( colour3 == colour2 ) & (colour3 != colour1 )){
			numColours = 2;
		}
		else if (( colour3 == colour1 ) & (colour2 != colour1 )){
			numColours = 2;
		}
		else if (( colour2 == colour1 ) & (colour3 != colour1 )){
			numColours = 2;
		}
		
	}
	

	// Name price
	if ( document.createName.BoatName.value != "" ){
		if ( numColours == 1 ){
			if ( document.createName.NamePosition[0].checked ){
				sidesPrice = getSidesOneColourNamePrice();
			}
			else if ( document.createName.NamePosition[1].checked ){
				transomPrice = getTransomOneColourNamePrice();
			}
			else{
				sidesPrice = getSidesOneColourNamePrice();
				transomPrice = round(getTransomOneColourNamePrice()*0.75,2);
			}
		}
		else if ( numColours == 2 ){
			if ( document.createName.NamePosition[0].checked ){
				sidesPrice = getSidesTwoColourNamePrice();
			}
			else if ( document.createName.NamePosition[1].checked ){
				transomPrice = getTransomTwoColourNamePrice();
			}
			else {
				sidesPrice = getSidesTwoColourNamePrice();
				transomPrice = round(getTransomTwoColourNamePrice()*0.75,2);
			}
		}
		else if ( numColours == 3 ){
			if ( document.createName.NamePosition[0].checked ){
				sidesPrice = round((getSidesTwoColourNamePrice() + getSidesTwoColourNamePrice()*0.25),2);
			}
			else if ( document.createName.NamePosition[1].checked ){
				transomPrice = round((getTransomTwoColourNamePrice() + getTransomTwoColourNamePrice()*0.25),2);
			}
			else {
				sidesPrice = round((getSidesTwoColourNamePrice()+getSidesTwoColourNamePrice()*0.25),2);
				transomPrice = round((getTransomTwoColourNamePrice()*0.75 + (getTransomTwoColourNamePrice()*0.75)*0.25),2);
			}
		}
	}
	
	if ( document.createName.PortName.value!="" )
	{
		portPrice = getPortPrice();
	}
	
	
	
		
	totalPrice = sidesPrice+transomPrice+portPrice;
	
	if ( totalPrice < 65.00 )
	{
		if ( document.createName.RegoNumbers.value != "" )
		{
			regoPrice = 38.50;
		}
	}
	if ( totalPrice >= 65.00 )
	{
		document.createName.RegoPrice.value = "Free";
	}
	else
	{
		document.createName.RegoPrice.value = "$"+regoPrice;
	}
	
	if (document.createName.RegoShadow.checked == true ){
		if ( document.createName.RegoNumbers.value != "" ){
			regoPrice = regoPrice+33.00;
			document.createName.RegoPrice.value = "$"+regoPrice;
		}
	}
		
	totalPrice = round(totalPrice+regoPrice,2);
	
	var bCodeCorrect = CheckDiscountCode();
	if ( bCodeCorrect )
	{
		discountprice = round((totalPrice * 0.1),2);
		totalPrice -= discountprice;
		document.createName.DiscountPrice.value = "$-"+discountprice;
	}
	else
	{
		document.createName.DiscountPrice.value = "Invalid Code";
	}
		
	totalPrice = round((totalPrice+15),2);	
	
	document.createName.SidesPrice.value = "$"+sidesPrice;
	document.createName.TransomPrice.value = "$"+transomPrice;
	document.createName.PortNamePrice.value = "$"+portPrice;
	
	document.createName.TotalPrice.value = "$"+totalPrice;

		
	
}

function getSidesOneColourNamePrice()
{
	if ( document.createName.NameHeight.value == 0 ){
		return 0;
	}
	if ( document.createName.NameHeight.value == 50 ){
		return 39.75;
	}
	if ( document.createName.NameHeight.value == 75 ){
		return 68.60;
	}
	if ( document.createName.NameHeight.value == 100 ){
		return 79.55;
	}
	if ( document.createName.NameHeight.value == 125 ){
		return 88.75;
	}
	if ( document.createName.NameHeight.value == 150 ){
		return 99.75;
	}
	if ( document.createName.NameHeight.value == 175 ){
		return 110.75;
	}
	if ( document.createName.NameHeight.value == 200 ){
		return 128.45;
	}
	if ( document.createName.NameHeight.value == 225 ){
		return 136.15;
	}
	if ( document.createName.NameHeight.value == 250 ){
		return 148.15;
	}
	if ( document.createName.NameHeight.value == 275 ){
		return 171.35;
	}
	if ( document.createName.NameHeight.value == 300 ){
		return 208.75;
	}
}

function getSidesTwoColourNamePrice()
{
	if ( document.createName.NameHeight.value == 0 ){
		return 0;
	}
	if ( document.createName.NameHeight.value == 50 ){
		return 54.75;
	}
	if ( document.createName.NameHeight.value == 75 ){
		return 87.85;
	}
	if ( document.createName.NameHeight.value == 100 ){
		return 109.85;
	}
	if ( document.createName.NameHeight.value == 125 ){
		return 117.45;
	}
	if ( document.createName.NameHeight.value == 150 ){
		return 150.45;
	}
	if ( document.createName.NameHeight.value == 175 ){
		return 175.75;
	}
	if ( document.createName.NameHeight.value == 200 ){
		return 207.75;
	}
	if ( document.createName.NameHeight.value == 225 ){
		return 219.85;
	}
	if ( document.createName.NameHeight.value == 250 ){
		return 236.15;
	}
	if ( document.createName.NameHeight.value == 275 ){
		return 266.25;
	}
	if ( document.createName.NameHeight.value == 300 ){
		return 310.65;
	}
}

function getTransomOneColourNamePrice()
{
	if ( document.createName.TransomHeight.value == 0 ){
		return 0;
	}
	if ( document.createName.TransomHeight.value == 50 ){
		return 39.45;
	}
	if ( document.createName.TransomHeight.value == 75 ){
		return 54.75;
	}
	if ( document.createName.TransomHeight.value == 100 ){
		return 69.15;
	}
	if ( document.createName.TransomHeight.value == 125 ){
		return 75.75;
	}
	if ( document.createName.TransomHeight.value == 150 ){
		return 82.35;
	}
	if ( document.createName.TransomHeight.value == 175 ){
		return 97.75;
	}
	if ( document.createName.TransomHeight.value == 200 ){
		return 103.25;
	}
	if ( document.createName.TransomHeight.value == 225 ){
		return 109.85;
	}
	if ( document.createName.TransomHeight.value == 250 ){
		return 131.85;
	}
	if ( document.createName.TransomHeight.value == 275 ){
		return 142.85;
	}
	if ( document.createName.TransomHeight.value == 300 ){
		return 197.85;
	}
}

function getTransomTwoColourNamePrice()
{
	if ( document.createName.TransomHeight.value == 0 ){
		return 0;
	}
	if ( document.createName.TransomHeight.value == 50 ){
		return 58.15;
	}
	if ( document.createName.TransomHeight.value == 75 ){
		return 76.85;
	}
	if ( document.createName.TransomHeight.value == 100 ){
		return 82.35;
	}
	if ( document.createName.TransomHeight.value == 125 ){
		return 98.85;
	}
	if ( document.createName.TransomHeight.value == 150 ){
		return 110.85;
	}
	if ( document.createName.TransomHeight.value == 175 ){
		return 129.55;
	}
	if ( document.createName.TransomHeight.value == 200 ){
		return 136.35;
	}
	if ( document.createName.TransomHeight.value == 225 ){
		return 154.85;
	}
	if ( document.createName.TransomHeight.value == 250 ){
		return 192.35;
	}
	if ( document.createName.TransomHeight.value == 275 ){
		return 240.65;
	}
	if ( document.createName.TransomHeight.value == 300 ){
		return 280.15;
	}
}

function getPortPrice()
{
	if ( document.createName.PortHeight.value == 0 ){
		return 0;
	}
	if ( document.createName.PortHeight.value == 60 ){
		return 27.50;
	}
	if ( document.createName.PortHeight.value == 75 ){
		return 33;
	}
	if ( document.createName.PortHeight.value == 100 ){
		return 38.50;
	}
	if ( document.createName.PortHeight.value == 125 ){
		return 49.50;
	}
	
}

function getRegoPrice()
{
	
}
function round(amt,numDec)
{
	var whole = 0;
	var part = 0;
	var mult = 0;
	whole = Math.floor(amt);
	part = amt - whole;
	mult = Math.pow(10,numDec);
	part = part*mult;
	part = Math.round(part);
	part = part/mult;

	return whole+part
	
}


function CheckDiscountCode()
{
	var Code;
	Code = new String();
	Code = ""+document.createName.DealerCode.value;
	Code = Code.toUpperCase();
	for ( i = 0; i < nNumberOfCodes; i++ )
	{
		//alert(Code);
		//alert(i+" : "+DiscountCodes[i]+" : "+toUpperCase(document.createName.DealerCode.value));
		if ( Code == DiscountCodes[i] )
		{
			return true;
		}
	}
	
	return false;
}


var DiscountCodes = ["BNADSC",
					 "STONEY",
					 "HERVEY",
					 "BSOLAU",
					 "MDBOAT",
					 "REPAIR",
					 "IMPORT",
					 "ALLSHQ",
					 "WASKIP",
					 "CURRUM",
					 "WSIDEM",
					 "BRISKI",
					 "TSHACK",
					 "LEOMAR",
					 "COASTC",
					 "BOATSB",
					 "UNIVER",
					 "AUSTMC",
					 "MARWOR",
					 "BINTER",
					 "ENSIGN",
					 "MITCHE",
					 "TSAILP",
					 "BBSHOW",
					 "SYDSHO",
					 "PERTH09",
					 "BRIS09"
					 ];