﻿<!--Traditional style
var on1=  ['DesignAT1', 'DesignT1', 'DesignT2', 'DesignT3', 'DesignT4C', 'DesignT4H', 'DesignTT5' ]; 
var thePrice= [11.50,      10.50,        9.75,      9.00,        10.50,       10.50,    11.50    ];  //price for each Item Traditional bags

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.myForm2.on0.selectedIndex;
 if(document.myForm2.on0.options[SelectColour].value=="")
{
window.alert('Please select your Satin Colour')
  return false
}
Quantity=document.myForm2.os0.selectedIndex;
 if(document.myForm2.os0.options[Quantity].value=="")
{
 window.alert('Please select the quantity')
  return false
}

ChooseDesign=document.myForm2.on1.selectedIndex;
 if(document.myForm2.on1.options[ChooseDesign].value=="")
{
 window.alert('Please select the Design')
 return false
 }

ChooseDesign=document.myForm2.on1.selectedIndex;
 if((document.myForm2.on1.options[ChooseDesign].value=="Design AT1")&&(document.myForm2.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.myForm2.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.myForm2.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.myForm2.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.myForm2.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.myForm2.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.myForm2.shipping.value="0.00";	
    myPrice=myPrice;
}

 	document.myForm2.theProduct.value=('For '+ ' '+ selected_quantity + ' ' +selected_item);
	document.myForm2.price.value = myPrice;  	 
	document.myForm2.amount.value = myPrice; 
    document.myForm2.postage.value=('Postage is: '+ '£ '+ document.myForm2.shipping.value);
   
}
}
//-->
