//**** removeAllOptions
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
selectbox.remove(i);
}
}

//*** addOption

function addOption(selectbox,text,value )
{
var optn = document.createElement("option");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

//****addOption_list(selectbox)

function addOption_list(selectbox){
addOption(document.drop_list.dsize, "XS","XS");
addOption(document.drop_list.dsize, "S","S");
addOption(document.drop_list.dsize, "M","M");
addOption(document.drop_list.dsize, "L","L");
addOption(document.drop_list.dsize, "XL","XL");
addOption(document.drop_list.dsize, "XXL","XXL");
addOption(document.drop_list.dsize, "PL1X","PL1X");
addOption(document.drop_list.dsize, "PL2X","PL2X");
}

//****** SelectSubCat

function SelectColor(){
// ON selection of category this function will work
var dsize=document.drop_list.dsize.value;

removeAllOptions(document.drop_list.dcolor);
addOption(document.drop_list.dcolor, "Color", "color", "Color");

addOption(document.drop_list.dcolor,"White/Jet Black", "White/JetBlack");
addOption(document.drop_list.dcolor,"Jet Black/Stone", "JetBlack/Stone");
addOption(document.drop_list.dcolor,"Charcoal/Steel Grey", "Charcoal/Steel Grey");
addOption(document.drop_list.dcolor,"Light Blue/Classic Navy", "LightBlue/ClassicNavy");
addOption(document.drop_list.dcolor,"Light Pink/White", "LightPink/White");
addOption(document.drop_list.dcolor,"Lilac/Navy", "Lilac/Navy");


document.drop_list.size.value = document.drop_list.dsize.value;
}

//****** removeOptions(selectbox)

function removeOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
if(selectbox.options[i].selected)
selectbox.remove(i);
}
}

//*****reload

function setColor(selObj) {

 document.drop_list.color.value = document.drop_list.dcolor.value;	
}

function changeIt(objName)
{
//The image object accessed through its id we mentioned in the DIV block which is going to be visible currently
var obj = document.getElementById(objName);

//An array that hold the IDs of images that we mentioned in their DIV blocks
var objId = new Array();

//Storing the image IDs into the array starts here
objId[0] = "image1";
objId[1] = "image2";
objId[2] = "image3";
objId[3] = "image4";
objId[4] = "image5";
objId[5] = "image6";
objId[6] = "image7";
objId[7] = "image8";
objId[8] = "image9";
//Storing the image IDs into the array ends here

//A counter variable going to use for iteration
var i;

//A variable that can hold all the other object references other than the object which is going to be visible
var tempObj;

//The following loop does the display of a single image based on its ID. The image whose ID we passed into this function will be the
//only image that is displayed rest of the images will be hidden based on their IDs and that part has been handled by the else part
//of the if statement within this loop.
for(i=0;i<objId.length;i++)
{
if(objName == objId[i])
{
obj.style.display = "block";
}
else
{
tempObj = document.getElementById(objId[i]);
tempObj.style.display = "none"; 
}
}
return; 
}
//*** Submit form

function addToCart()
{
	document.droplist.submit();
}
