function ShowText(id1, id2, id3, id4, id5, id6, id7, id8, id9, id10,id11,id12,id13,id14,id15,id16,id17,id18,id19,id20,id21)
{
	document.getElementById(id1).style.display = 'none';
	document.getElementById(id2).style.display = '';
	document.getElementById(id3).style.display = '';
	document.getElementById(id4).style.display = 'none';
	document.getElementById(id5).disabled = false;
	document.getElementById(id6).style.display = '';
	document.getElementById(id7).style.display = 'none';
	document.getElementById(id8).style.display = 'none';
	document.getElementById(id11).style.display = 'none';
	document.getElementById(id9).style.display = '';
	document.getElementById(id12).style.display = '';
	document.getElementById(id13).style.display = '';
	document.getElementById(id14).style.display = '';
	document.getElementById(id10).style.display = '';
	document.getElementById(id19).style.display = '';
	document.getElementById(id15).disabled=false; 
	document.getElementById(id16).disabled=false; 
	document.getElementById(id17).style.display = '';
	document.getElementById(id18).style.display = '';
	document.getElementById(id20).style.display = '';
	document.getElementById(id21).style.display = 'none';
	return false; 
}


function confDelete()
{
	return confirm("Are you sure you want to delete this product?"); 
}

function checkData(id1,id2,id3)
{
	if (document.getElementById(id3).value=='')
	{
		alert("Please enter the Product Id");
		return false;
	}
	
	return check2(id1,id2);
	
} 

function check2(id1,id2)
{
 if ((document.getElementById(id1).value)!='' && (document.getElementById(id2).value)!='')
        {
                alert('Please select only one picture option');
                return false;
        }
}
//dropdown validation

function DropValidate(dd,ddisplay)
{
        var lstarray1 = dd.split(",");
        var lstarray2 = ddisplay.split(",");
        var flag=0;

         for(i=0;i<=lstarray1.length-1; i++ )
        {
                if(document.getElementById(lstarray1[i]).selectedIndex == '' )
                {
                        alert ("Please select" + " " + lstarray2[i]);
                        flag=1;
                        return (false);
                }
        }
                if(!flag) return(true);

}


// check the maximum mquantity for item 

function checkquantity(id)
{
	var qt = document.getElementById('quant').getAttribute("value");
        xmlhttp.open("GET", 'checkqty.php?id='+id+'&qty='+qt,true);
        xmlhttp.onreadystatechange = function()
        {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                        var resp=xmlhttp.responseText;
                        if(resp!='')
			{
				document.getElementById(id).innerHTML = resp;
				return true;
			}
			else
				return false;
                }

        }
        xmlhttp.send(null);
}

function setshipping()
{
	var statebox = document.getElementById('state');
	var optbox = document.getElementById('ship_opt');
	var vals = new Array();
	var i;
   	for(i=optbox.options.length-1;i>0;i--)
		//vals[i] = optbox.options[i].value;
		optbox.remove(i);

 	var optn1 = document.createElement("OPTION");
        optn1.text = "USPS priority 2-3 days";
        optn1.value = 'ground';

	 var optn2 = document.createElement("OPTION");
         optn2.text = "UPS second day air";
         optn2.value = 'express';

	for(i=statebox.options.length-1;i>=0;i--)
	{
		if(statebox.options[i].selected && 
			statebox.options[i].value.length > 2)
		{
        			optbox.options.add(optn2);
		}
		else if(statebox.options[i].selected &&
                     	statebox.options[i].value.length == 2)
		{
                                optbox.options.add(optn1);
                                optbox.options.add(optn2);
		}
	}
}


