
<!-- CODE for the NetMaster Online Store

// Populate Province/State Arrays {{{

provinces = new Array( 
	"Alberta",
	"British Columbia",
	"Manitoba",
	"New Brunswick",
	"Newfoundland",
	"Nova Scotia",
	"Nunavut",
	"Ontario",
	"Prince Edward Island",
	"Quebec",
	"Saskatchewan",
	"Yukon"
);	

states = new Array (
	"Alabama",
	"Alaska",
	"Arizona",
	"Arkansas",
	"California",
	"Colorado",
	"Connecticut",
	"District of Columbia",
	"Delaware",
	"Florida",
	"Georgia",
	"Hawaii",
	"Idaho",
	"Illinois",
	"Indiana",
	"Iowa",
	"Kansas",
	"Kentucky",
	"Louisiana",
	"Maine",
	"Maryland",
	"Massachusetts",
	"Michigan",
	"Minnesota",
	"Mississippi",
	"Missouri",
	"Montana",
	"Nebraska",
	"Nevada",
	"New Hampshire",
	"New Jersey",
	"New Mexico",
	"New York",
	"North Carolina",
	"North Dakota",
	"Ohio",
	"Oklahoma",
	"Oregon",
	"Pennsylvania",
	"Rhode Island",
	"South Carolina",
	"South Dakota",
	"Tennessee",
	"Texas",
	"Utah",
	"Vermont",
	"Virginia",
	"Washington",
	"West Virginia",
	"Wisconsin",
	"Wyoming"
);	
// }}}

// Define other variables and arrays {{{
prices = new Array(
	"124",		// GGOS1
	"134",		// GGOS2
	"524",		// GGBLADE
	"574",	 	// GGEXT
	"124",  	// GGUPGRADEHW
	"124",  	// GGUPGRADESW
	"25",		// SHIPPING
	"49",		// email, 1
	"99",		// email, 3
	"199",		// email, unlim
	"99",		// tel, 1
	"199",		// tel, 3
	"399"		// tel, unlim
);

productNames = new Array(
	"GG-OS Download",
	"GG-OS Retail",
	"GG-Blade",
	"GG-Ext",
	"Merilus FireCard Migration",
	"Merilus Gateway Guardian Migration",
	"Shipping",
	"Email Support - 1 incident or 1 month",
	"Email Support - 3 incidents or 3 months",
	"Email Support - Unlimited incidents for 1 year",
	"Telephone Support - 1 incident or 1 month",
	"Telephone Support - 3 incidents or 3 months",
	"Telephone Support - Unlimited incidents for 1 year"
);

shipping = 25.00;
// shipping_per_item = 6.30;
shipping_per_item = 0;


// }}}

function fillProvinceDropDown() { // {{{
	// Ok, check to see which Country we selected. If it is "International", 
	// then set State to "Other"

	// Nuke the fields in the Province/State dropdown
	var selectItem = document.storeForm.Province

	while( selectItem.length )
		selectItem.options[0] = null;

	loc = document.storeForm.Country.value;
	if( loc == "Canada" ) {
		for( var x=0; x<provinces.length; x++ ) {
			var option = new Option( provinces[x], provinces[x] );
			selectItem.options[x] = option;
			if( x == 1 ) {
				// lets default it to BC 
				selectItem.options[x].selected=true;
			}
		}
	}
	else if( loc == "USA" ) {
		for( var x=0; x<states.length; x++ ) {
			var option = new Option( states[x], states[x] );
			selectItem.options[x] = option;
		}
	}
	else {
		var option = new Option( "Other", "Other" );
		selectItem.options[0] = option;
	}

} // }}} 

function productDetect( product ) { // {{{

	var country = document.storeForm.Country.value
	var prov = document.storeForm.Province.value
	var taxAmt = parseFloat( 0.0 );
	var amount = document.storeForm.amount.value
	var taxes = parseFloat( 0.0 );

	if( product.name == "GGOS" ) {
		amount = prices[0];
		document.storeForm.item_name.value = productNames[0];
	}
	else if( product.name == "GGBLADE" ) {
		amount = prices[1];
		document.storeForm.item_name.value = productNames[1];
	}	
	else if( product.name == "GGEXT" ) {
		amount = prices[2];
		document.storeForm.item_name.value = productNames[2];
	}	
	else if( product.name == "GGUPGRADEHW" ) {
		amount = prices[3];
		document.storeForm.item_name.value = productNames[3];
	}	
	else if( product.name == "GGUPGRADESW" ) {
		amount = prices[3];
		document.storeForm.item_name.value = productNames[4];
	}	
	else if( product.name == "SHIPPING" ) {
		amount = prices[4];
		document.storeForm.item_name.value = productNames[5];
	}	

	// If we have a $ at the front.. strip it
	if( amount.substring( 0, 1 ) == '$' ) {
		amount = amount.substring( 1, amount.length );
	}

	// Check for TAX calcs
	if( country == "Canada" ) {
		taxAmt = 7;
		document.storeForm.os1.value = "No";
		if( prov == "British Columbia" ) {
			taxAmt += 7.5;
		}

		taxes = amount * ( taxAmt/100 );
	}
	else {
			document.storeForm.os1.value = "Yes";
	}

	// Figure out what the amount for this product will be.
	if( product.name == "GGBLADE" || product.name == "GGEXT" ) {
		if( document.storeForm.ship[0].checked ) {
			amount = parseFloat( amount, 10 ) + taxes + shipping_per_item;
			document.storeForm.os0.value = "Yes";
		}	
		else {	
			amount = parseFloat( amount, 10 ) + taxes;
			document.storeForm.os0.value = "No";
		}	
	}
	else if( product.name == "SHIPPING" ) {
		document.storeForm.os0.value = "Yes";
		document.storeForm.os1.value = "Yes";

		amount = parseFloat( amount, 10 );
	}
	else {
		if( document.storeForm.ship[0].checked ) {
			document.storeForm.os0.value = "Yes";
		}	
		else {	
			document.storeForm.os0.value = "No";
		}	

		amount = parseFloat( amount, 10 ) + taxes;
	}	

	document.storeForm.amount.value = cent( roundCurrency( amount ) );


	// Ok... now we need to submit to PayPal
	document.storeForm.submit();
	
} // }}}

function roundCurrency( value ) { // {{{
	return Math.round( value*Math.pow( 10, 2 ) )/Math.pow( 10, 2 );
} // }}}

function cent( amount ) { // {{{
// returns the amount in the .99 format
	amount -= 0;
	return (amount == Math.floor(amount)) ? 
				amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
} // }}}

-->
