// Modified from the following source
// made by: Nicolas - http://www.javascript-page.com
// by Tom Holden

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

function addbuttons (course,itemno,cost,type) {

var currentdate = 0;
currentdate = new Date();
signupdate = new Date("13 DEC 2009");
signupdate.setHours(23);
signupdate.setMinutes(59);

button = '';
str='';

// Check if Google Button
if(type==2) {
		str+='</b></font><form action=\"https:\/\/checkout.google.com\/cws\/v2\/Merchant\/543027796700938\/checkoutForm\" id=\"BB_BuyButtonForm\" method=\"post\" name=\"BB_BuyButtonForm\">';
		str+='<input name=\"item_name_1\" type=\"hidden\" value=\"'+itemno+'\"\/>';
		if(cost > 20) {
			str+='<input name=\"item_description_1\" type=\"hidden\" value=\"'+course+' Tournament \"\/>';
				str+='<input name=\"ship_method_price_1\" type=\"hidden\" value=\"2.5\"\/>';
		}
		else {
			str+='<input name=\"item_description_1\" type=\"hidden\" value=\"'+course+' Fee\"\/>';
			str+='<input name=\"ship_method_price_1\" type=\"hidden\" value=\".45\"\/>';
		}
		str+='<input name=\"item_quantity_1\" type=\"hidden\" value=\"1\"\/>';
		str+='<input name=\"item_price_1\" type=\"hidden\" value=\"'+cost+'\"\/>';
		str+='<input name=\"item_currency_1\" type=\"hidden\" value=\"USD\"\/>';
		str+='<input name=\"ship_method_name_1\" type=\"hidden\" value=\"Fee\"\/>';
		str+='<input name=\"ship_method_currency_1\" type=\"hidden\" value=\"USD\"\/>';
		str+='<input name=\"_charset_\" type=\"hidden\" value=\"utf-8\"\/>';
		str+='<input alt=\"\" src=\"https:\/\/checkout.google.com\/buttons\/buy.gif?merchant_id=543027796700938\&w=121\&h=44\&style=trans\&variant=text\&loc=en_US\" type=\"image\"\/>';
		str+='<\/form>';
}


//Otherwise process PayPal Buttons
// Type 0 is Buy Now, Type 1 is Shopping Cart
else {
	str+='<form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" target=\"paypal\" method=\"post\">';
	if(course.substring(0,4)=="2010") {
		str+='<input type=\"hidden\" name=\"item_name\" value=\"'+course+'\">';
	}
	else {
		str+='<input type=\"hidden\" name=\"item_name\" value=\"'+course+' Tournament\">';
	}
	str+='<input type=\"hidden\" name=\"item_number\" value=\"'+itemno+'\">';
	str+='<input type=\"hidden\" name=\"amount\" value=\"'+cost+'\">';
	if(type==0) {
		str+='<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">';
		str+='<input type=\"hidden\" name=\"image_url\" value=\"\">';
		str+='<input type=\"image\" src=\"http:\/\/images.paypal.com\/images\/x-click-but01.gif\" border=\"0\" name=\"I1\" width=\"62\" height=\"31\">';
	}
	else if (type==1) {
		str+='<input type=\"hidden\" name=\"cmd\" value=\"_cart\">';
		str+='<input type=\"hidden\" name=\"add\" value=\"1\">';
		str+='<input type=\"hidden\" name=\"quantity\" value=\"1\">';
		str+='<input type=\"hidden\" name=\"no_shipping\" value=\"1\">';
		str+='<input type=\"image\" src=\"http:\/\/images.paypal.com\/images\/sc-but-01.gif\" border=\"0\" name=\"submit\">';
	}
	str+='<input type=\"hidden\" name=\"bn\" value=\"AMPPFPWZ.301\">';
	str+='<input type=\"hidden\" name=\"business\" value=\"signup07@nasga.com\" > ';
	str+='<input type=\"hidden\" name=\"currency_code\" value=\"USD\">';
//	document.write(cost);

	if(currentdate > signupdate) {
		if(cost == 10) {
			str+='<input type=\"hidden\" name=\"shipping\" value=\".6\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\".6\">';
		}
		else if(cost == 5) {
			str+='<input type=\"hidden\" name=\"shipping\" value=\".45\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\".45\">';
		}
		else if(cost == 46) {
			str+='<input type=\"hidden\" name=\"shipping\" value=\"1.68\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\"1.68\">';
		}
		else if(cost == 56) {
			str+='<input type=\"hidden\" name=\"shipping\" value=\"1.98\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\"1.98\">';
		}
		else if(cost == 66) {
			str+='<input type=\"hidden\" name=\"shipping\" value=\"2.28\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\"2.28\">';
		}
		else {
			str+='<input type=\"hidden\" name=\"shipping\" value=\"2.50\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\"2.50\">';
		}
	}
	else {
			str+='<input type=\"hidden\" name=\"shipping\" value=\"0.00\">';
			str+='<input type=\"hidden\" name=\"shipping2\" value=\"0.00\">';
	}

	if(course.substring(0,4)=="2010") {
		str+='<input type=\"hidden\" name=\"cn\" value=\"If this Membership payment is for another person please click here and enter their name!\">';
	}
	else {
		str+='<input type=\"hidden\" name=\"cn\" value=\"Grouping\/Request?\">';
	}
	str+='<input type=\"hidden\" name=\"no_note\" value=\"0\">';
	str+='<input type=\"hidden\" name=\"return\" value=\"http:\/\/nasga.com\/thankyou.htm\">';
	str+='<input type=\"hidden\" name=\"cancel_return\" value=\"http:\/\/nasga.com\/index.html\">';
	str+='</form>';
}

button = str;

return(button);
}
//-->
