function ETSOOCheckKVForm(form)
{
    var elements=form.elements.length;
    for(var i=0;i<elements;i++)
    {
        var e=form.elements[i];
        var required=e.getAttribute("required");
        if(required=="true")
        {
            var hasValue=false;
            var nodeName=e.nodeName;
            if(nodeName=="INPUT")
            {
                var type=e.type;
                if(type=="text")
				{
                    if(e.value!="")
                    {
                        hasValue=true;
                    }
                }
                else if(type=="radio"||type=="checkbox")
                {
                    var items=form.elements[e.name];
                    var len=items.length;
                    for(var h=0;h<len;h++)
                    {
                        var item=items[h];
                        if(item.checked)
                        {
                            hasValue=true;
                            break;
                        }
                    }
                }
                else hasValue=true;
            }
            else if(nodeName=="SELECT")
            {
                if(e.selectedIndex>0)
                {
                    hasValue=true;
                }
            }
            else if(nodeName=="TEXTAREA")
            {
                if(e.value!="")
                {
                    hasValue=true;
                }
            }
            else hasValue=true;
            
            if(!hasValue)
            {
                e.focus();
                return false;
            }
        }
    }
    return true;
}
function SelectIt(oT)
{
    var sProductID=oT.value;
    var oE=oT.form.elements["Qty_"+sProductID];
    if(oT.checked)
    {
	    oE.value=1;
	    oE.select();
    }
    else oE.value="";
}
function ViewLogo(productID)
{
    window.open('/Products/ViewProductLogo.aspx?ProductID='+productID,'ViewLogo','width=660, height=560, titlebar=no, menubar=no, statusbar=no, scrollbars=no');
}
function ViewProduct(productID)
{
    window.open('/Products/ViewProductWindow.aspx?ProductID='+productID,'ViewLogo','width=660, height=480, titlebar=no, menubar=no, statusbar=no, scrollbars=no');
}
function ViewPage(page)
{
    window.open('/ETSOO/EOFile/Root/PDF/'+page+'.pdf');
}
function updateOnline()
{
    var d=new Date();
    _sysAjax.importResources("WebsiteUpdateOnline","/XmlData/UpdateOnline.aspx?id=d"+d.valueOf());
}
function refreshVeryCode(image)
{
    if(typeof(image)=="string")
    {
        image=_sysDom.getObj(image);
    }
    if(image==null)return;
    
    var src=image.src;
    var autoIndex=src.indexOf("auto=");
    var autoID=1000*Math.random();
    if(autoIndex!=-1)src=src.substr(0,autoIndex);
    src+="&auto="+autoID;
    image.src=src;
}
function checkDropdownOrderForm(form)
{
    for(var name in ETSOODropdown.all)
    {
        var dd=ETSOODropdown.all[name];
        var value=dd.value;
        if(value!=null&&value!='')
        {
            var oProduct=form.elements[name];
            if(oProduct!=null)
            {
                oProduct.value=value;
            }
        }
    }
    return true;
}
function isKeyAvailable(powerID,keyValue,resultFunction)
{
    _sysAjax.importResources("IsKeyAvailable","/XmlData/IsKeyAvailable.aspx?PowerID="+powerID+"&KeyValue="+keyValue,resultFunction);
}
function onlyNumbers(evt)
{
	var e = evt
	if(window.event){ // IE
		var charCode = e.keyCode;
	} else if (e.which) { // Safari 4, Firefox 3.0.4
		var charCode = e.which
	}
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	    return false;
	return true;
}
function onlyLetters(evt)
{
	var e = evt
	if(window.event){ // IE
		var charCode = e.keyCode;
	} else if (e.which) { // Safari 4, Firefox 3.0.4
		var charCode = e.which
	}
	if(charCode <32 || (charCode >=48 && charCode <=57) || (charCode >=65 && charCode <=90) || (charCode >=97 && charCode <=122))
	    return true;
	else
	    return false;
}
