﻿<!-- Begin Change Value In Paypal Form
// Copyright Maxbal Genealogy 2007 - All rights reserved
// This script may not be used without permission

// Updates price and item number in PaypPal form depending on option selected
// and validates that an item has been selcted

function UpdateItemCode(form)
{

// Bowtie (Blank Charts 5) Charts Code

 valid = true;
 promo = "FHM1108!uytr";
 promoname = " Promotion - Family History Monthly 20% discount voucher ";
 promo2 = "MXNL1201";
 promoname2 = " Promotion - Buy One Get One Free ";

 ispromo = "No"; 	// Yes If Promotion
 					// No If No Promotion
 ispromo2 = "No"; 	// Yes If Promotion
 					// No If No Promotion
COL36 = 6.00;
 A1P = 6.50;
 A1W = 4.00;
 A1PV2 = 6.50;
 A1WV2 = 4.00;

 promoCOL36 = 6.00;
 promoA1P = 6.50;
 promoA1W = 4.00;
 promoA1PV2 = 6.50;
 promoA1WV2 = 4.00;

 form.on0.value = "";

if (form.name == "BowTieA1" || form.name == "BowTieA1V2")
	{
	if ( form.item_number.selectedIndex == 0 )
   		{
        	alert ( "Please select from the dropdown box which " + '\n' + form.item_name.value + '\n' +" you would like to purchase." );
        	return valid = false;
    	}
 	}

if ( form.os0.value )
  {
  	if (ispromo == "No" && ispromo2 == "No")
		{
			alert ("The are no current promotions for this product");
			form.os0.value = "";
			return valid = false;
		}
 	if (form.name != "BowTie36")
		{
			alert ("The are no current promotions for this product");
			form.os0.value = "";
			return valid = false;
		}
	if ( ispromo == "Yes" )
  		{
  			if ( form.os0.value == promo)
  				{
					COL36 = promoCOL36;
	 				A1P = promoA1P;
	 				A1W = promoA1W;
	 				A1PV2 = promoA1PV2;
 	 				A1WV2 = promoA1WV2;
 					form.on0.value = promoname;
 				}
			 else
   				{
       			   alert ("You have entered an invalid promotion code" + '\n\n' + "The code is case sensitive and must be entered using the correct upper and lower case letters." + '\n\n' + "Check that the code entered is still valid");
       			   form.os0.value = "";
        		  return valid = false;
      			}
  		}

   	if ( ispromo2 == "Yes")
   	 	{
   	 		if ( form.os0.value == promo2)
				{
					COL36 = promoCOL36;
 	 				A1P = promoA1P;
 	 				A1W = promoA1W;
 					form.on0.value = promoname2;
 				}
			else
   				{
       			   alert ("You have entered an invalid promotion code" + '\n\n' + "The code is case sensitive and must be entered using the correct upper and lower case letters." + '\n\n' + "Check that the code entered is still valid");
        		  form.os0.value = "";
      			  return valid = false;
      			}
  		}
  	}

if ( form.handling_cart.selectedIndex == 0 )
   	{
       	alert ( "Please select the postage zone from the dropdown box.");
       	return valid = false;
    }

if (form.name == "BowTieA1")
	{
		if (form.item_number.selectedIndex == 1)  
			{   
				form.amount.value =  A1P;
				form.item_name.value = "10 Generation Bowtie Chart Parchment A1";
			}
		else 	
			{
				form.amount.value = A1W;
 				form.item_name.value = "10 Generation Bowtie Chart White A1";
 			} 
 	}		

if (form.name == "BowTie36")
	{
		form.amount.value =  COL36;
		form.item_name.value = "10 Generation Bowtie Chart Colour";
	}

if (form.name == "BowTieA1V2")
	{
		if (form.item_number.selectedIndex == 1)  
			{   
				form.amount.value =  A1PV2;
				form.item_name.value = "10 Generation Bowtie Chart Parchment A1 2011";
			}
		else 	
			{
				form.amount.value = A1WV2;
 				form.item_name.value = "10 Generation Bowtie Chart White A1 2011";
 			} 
 	}		


// alert (form.name + " " + form.item_number.value + " " + form.amount.value + " " + form.on0.value + " " + form.os0.value + " " + form.item_name.value);
return valid;
}

// End -->

