// JScript ????
// linlin
function goTo(strUrl)
{
    window.location=strUrl;
}

// show or hidden sub menu
// linlin
function menuOverOut(mode,divId,divSubId)
{
	var objMenu = document.getElementById(divId);
	var objSubMenu = document.getElementById(divSubId);

	//objSubMenu.style.top = getTop(objMenu);
	//objSubMenu.style.right = screen.availWidth-getLeft(objMenu)-53;
	objSubMenu.style.top = getTop(objMenu) + 14;
	objSubMenu.style.left = getLeft(objMenu);

	if(mode=="over")
	{
		objSubMenu.style.display = "inline";
	}
	else if(mode=="out")
	{
		objSubMenu.style.display = "none";
	}
}

// show or hidden sub menu
// linlin
function newOverOut(mode,divId,divSubId)
{
	var objMenu = document.getElementById(divId);
	var objSubMenu = document.getElementById(divSubId);

	objSubMenu.style.top = getTop(objMenu)+27;
	//objSubMenu.style.right = screen.availWidth-getLeft(objMenu)-90;
	objSubMenu.style.left = getLeft(objMenu)-70;

	if(mode=="over")
	{
		objSubMenu.style.display = "inline";
	}
	else if(mode=="out")
	{
		objSubMenu.style.display = "none";
	}
}

// get the top absolute position
// linlin
function getTop(e)
{   
	var t=e.offsetTop;
	while(e=e.offsetParent)
	{   
		t+=e.offsetTop;   
	}   
	return t;
}  

// get the left absolute position
// linlin
function getLeft(e)
{   
	var l=e.offsetLeft;
	while(e=e.offsetParent)
	{   
		l+=e.offsetLeft;   
	}   
	return l;
}  

// pop up window
// linlin
function popUp(strUrl,h,w)
{
	var strPop = 'width='+w+',height='+h+',top='+(screen.availHeight/2-h/2)+',left='+(screen.availWidth/2-w/2)+'toolbar=no, menubar=no, scrollbars=yes,resizable=no,location=no, status=yes';
	//alert(strPop);
	window.open(strUrl,'',strPop);
}

// when submitting,all input will be disabed.
function disableOtherSubmit()
{   var obj = event.srcElement;
	var objs = document.getElementsByTagName('INPUT');
	for(var i=0; i<objs.length; i++)
	{
		if(objs[i].type.toLowerCase() == 'submit')
		{
			objs[i].disabled = true;
		}
	}
}

// textarea maxlength
function SetMaxLength(id,length)
{
    var area = document.getElementById(id);
    if(area.value.length>length)
    {
        area.value = area.value.substring(0,length);
    }
}
  function OnKeyUp(data) {
            if (isNaN(data.value)) {
            }
            else {
                if ((data.value.indexOf('.')) == -1) {
                    if (data.value.length >= 14) {
                        data.value = data.value.substring(0, 14);
                    }
                }
                else {
                    var parts = data.value.split('.');
                    if (parts.length == 2) {
                        if (parts[0].length >= 14) {
                            data.value = parts[0].substring(0, 14) + '.' + parts[1];
                        }
                    }
                }
            }
        }


function OnLostFocus(data) {
    ValidNumericField(data);    
}



window.onload = function() {

    if (document.getElementById("ctl00_ContentPlaceHolder1_divScroll") != null) {
        var strCook = document.cookie;
        if (strCook.length > 0) {
            var cookies = strCook.split(";");
            document.getElementById("ctl00_ContentPlaceHolder1_divScroll").scrollTop = cookies[0];
            //for (var i = 0; i < cookies.length; i++) {
            //var mySplit = cookies[i].split("="); 
            //try { document.getElementById(mySplit[0].replace(" ", "")).scrollTop = mySplit[1]; } catch (e) { } } }
        }
    }
    else {
        document.cookie = 0;
    }

}