function AddProduct(frm)
{
    var err=""
    var color=""
    var size=""
    try
    {
        if (document.forms[frm].elements["color"]!=null)
        {
            color = document.forms[frm].elements["color"].value
			if (color=="")
				err+="Please, choose product color\n"
		}
    }
    catch(ex)
    {}
    try
    {
        if (document.forms[frm].elements["size"]!=null)
        {
            size = document.forms[frm].elements["size"].value
			if (size=="")
				err+="Please, choose product size\n"
		}
    }
    catch(ex)
    {}                
    try
    {
        var qunt = parseInt(document.forms[frm].elements["quantity"].value)
        if (document.forms[frm].elements["quantity"].value<=0)
            err+="Please, provide product quantity\n"
    }
    catch(ex)
    {
        err+="Product quantity should be in numeric format\n"
    }
    if (err!="")
        alert(err);
    else
    {
		document.forms[frm].action+="&color=" + color + "&size=" + size + "&quantity=" + qunt + "&action=add"
        document.forms[frm].submit(); 
    }  
}

function CheckOut(sCartRedirect)
{
	window.location = sCartRedirect;
}
function DelProduct(frm)
{
	document.forms[frm].action+="&action=delete"
	document.forms[frm].submit();
}
function UpdateProduct(frm)
{
	try
	{
		var qunt = parseInt(document.forms[frm].elements["quantity"].value)
		if (document.forms[frm].elements["oldquantity"].value!=document.forms[frm].elements["quantity"].value)
		{
			document.forms[frm].action+="&quantity=" + qunt + "&action=update"
			document.forms[frm].submit();
		}
	}
	catch(ex)
	{
		
	}
}
