
var eventlist = new Array();
function initevent()
{
    for(var i=0;i<eventlist.length;++i )
    {
        eval(eventlist[i]);
    }
}
function reginitevent(e)
{
    eventlist[eventlist.length] = e;
}
window.onload = initevent;

function adjustprice(formfield)
{
    adjustnumber(formfield)
}
function adjustnumber(formfield)
{
    formfield.value = formatPrice(formfield.value); 
}
function formatPrice(s)
{
    var s = parseFloat(s);
    if( isNaN(s) ) { s = "0.00"; }
    else { 
        s = ""+Math.round( s * 100 )/100;
        var p = s.indexOf(".");
        if( p < 0 ) s = s + ".00";
        else if( s.substring(p+1).length == 1 ) s = s + "0";
    }
    return s;
}

function adjustquantity(formfield)
{
    var s = parseInt(formfield.value);
    if( isNaN(s) ) { formfield.value = "0"; }
}

function confirm_delete()
{
    return confirm("请确认是否要删除?");    
}

function gotourl(url)
{
    window.location = url;
}
function selectall(o)
{
    var ops = o.options;
    for(var i=0; i< ops.length;++i)
        ops(i).selected = true;
}
function unselectall(o)
{
    var ops = o.options;
    for(var i=0; i< ops.length;++i)
        ops(i).selected = false;
}

function checkall(form,fieldname)
{
    var elem = form.elements;
    for(var j=0; j <elem.length;++j)
    {
        if( elem[j].name == fieldname )  
                elem[j].checked = true;
    }
}
function uncheckall(form,fieldname)
{
    var elem = form.elements;
    for(var j=0; j <elem.length;++j)
    {
        if( elem[j].name == fieldname )  
            elem[j].checked = false;
    }
}

function show_help_foucs(menuid) 
{
	$(menuid).className = "helpleftfalse";
}

function checkzip(value)
{
	return /^[0-9]{6}$/.test(value);
}



