﻿<!--
var on1=  ['DesignAP1',  'DesignP1', 'DesignP2', 'DesignP3C', 'DesignP3H', 'DesignPDBS']; 
var thePrice= [ 10.50,     8.75,       8.00,         9.00,         9.00,       9.50 ];  //price for each Item pouch style

var os0=[1,2,3,4,5,6,8,10,12];
var myPrice=0;
var selected_item;
var selected_quantity;

function selected_on0 ( user_selected_colour )
{
  selected_colour = user_selected_colour;
}
function selected_on1( user_selected_item )
{
	selected_item = user_selected_item;
}
function selected_os0( user_selected_quantity )
{
	selected_quantity = user_selected_quantity;
}
function reset_vars()
{
	selected_item = "";
	selected_quantity = "";
}
function calculatePrice(on1,os0)
{
SelectColour=document.myForm1.on0.selectedIndex;

 if(document.myForm1.on0.options[SelectColour].value=="")
{
window.alert('Please select the Colour')
  return false
}
Quantity=document.myForm1.os0.selectedIndex;
 if(document.myForm1.os0.options[Quantity].value=="")
{
 window.alert('Please select the quantity')
  return false
}
ChooseDesign=document.myForm1.on1.selectedIndex;
 if(document.myForm1.on1.options[ChooseDesign].value=="")
{
 window.alert('Please select the Design')
 return false
 }

ChooseDesign=document.myForm1.on1.selectedIndex;
 if((document.myForm1.on1.options[ChooseDesign].value=="Design AP1")&&(document.myForm1.on0.options[SelectColour].value!="White Satin"))
{
 window.alert('Please select White Satin for this Design')
 return false
}


 
if (ChooseDesign && Quantity)
{
	var count;
	count = 0;

	for( var i = 0;  i < on1.length;  i++ )
	{
		if( on1[ i ].value == selected_item )
		{
			count = i;		
			break;				
		}
	}
	myPrice = ( selected_quantity  *  thePrice[ count - 1 ]); 	
if(selected_quantity==1)
{
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
    myPrice=(myPrice - myPrice*5.00/100); //discount percentage
    document.myForm1.shipping.value="0.00";
      myPrice=myPrice;	
}
 if ( selected_quantity ==2)    
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);     
   myPrice=Math.round(myPrice - myPrice*5.00/100);
    document.myForm1.shipping.value="0.00";
    myPrice=myPrice;
}
 if ( selected_quantity ==3)    
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
   myPrice= Math.round(myPrice - myPrice*5.00/100);
    document.myForm1.shipping.value="0.00";
      myPrice=myPrice;	
}
 if ( selected_quantity ==4)    
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
   myPrice= Math.round(myPrice - myPrice*5.00/100);
    document.myForm1.shipping.value="0.00";	
    myPrice=myPrice;
}
 if ( selected_quantity ==5 || selected_quantity ==6)   
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
   myPrice= Math.round(myPrice - myPrice*5.00/100);
    document.myForm1.shipping.value="0.00";	
    myPrice=myPrice;
}
 if ( selected_quantity ==8 || selected_quantity ==10 || selected_quantity ==12)   
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
      myPrice= Math.round(myPrice - myPrice*10.00/100);
    document.myForm1.shipping.value="0.00";	
    myPrice=myPrice;
}

 	document.myForm1.theProduct.value=('For '+ ' '+ selected_quantity + ' ' +selected_item);
	document.myForm1.price.value = myPrice;  	 
	document.myForm1.amount.value = myPrice; 
    document.myForm1.postage.value=('Postage is: '+ '£ '+ document.myForm1.shipping.value);
   
}
}
//-->

