﻿<!--Traditional style
var on1=  ['DesignAT1', 'DesignT1', 'DesignT2', 'DesignT3', 'DesignT4C', 'Design TDBFLY' ]; 
var thePrice= [11.00,      9.00,        9.00,      8.00,        9.50,       9.00   ];  //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
}
ChooseDesign=document.myForm2.on1.selectedIndex;
 if((((document.myForm2.on1.options[ChooseDesign].value=="Design T2")&&(document.myForm2.on0.options[SelectColour].value!="White Satin")
 &&(document.myForm2.on0.options[SelectColour].value!="Black Satin")&&(document.myForm2.on0.options[SelectColour].value!="Bridal White")
 &&(document.myForm2.on0.options[SelectColour].value!="Ivory/Cream"))))
{
 window.alert('This design is only available in White, Black, Bridal White and Ivory/Cream Satin, Please choose another colour')
 return false
}
ChooseDesign=document.myForm2.on1.selectedIndex;
 if((document.myForm2.on1.options[ChooseDesign].value=="Design TDBFLY")&&(document.myForm2.on0.options[SelectColour].value!="Bridal White")
 &&(document.myForm2.on0.options[SelectColour].value!="Ivory/Cream"))
{
 window.alert('This design is only available in Bridal White and Ivory/Cream Satin, Please choose another colour')
 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 ]);
    document.myForm2.shipping.value="0.00";
      myPrice=myPrice;	
}
 if ( selected_quantity ==2)    
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);     
    document.myForm2.shipping.value="0.00";
    myPrice=myPrice;
}
 if ( selected_quantity ==3)    
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
    document.myForm2.shipping.value="0.00";
      myPrice=myPrice;	
}
 if ( selected_quantity ==4)    
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
    document.myForm2.shipping.value="0.00";	
    myPrice=myPrice;
}
 if ( selected_quantity ==5 || selected_quantity ==6)   
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
    document.myForm2.shipping.value="0.00";	
    myPrice=myPrice;
}
 if ( selected_quantity ==8 || selected_quantity ==10 || selected_quantity ==12)   
 {
   myPrice= (selected_quantity  *  thePrice[ count - 1 ]);
    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);
   
}
}
//-->

