//Get Object By ID
function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject


function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	   styleObject.visibility = newVisibility;
	   return true;
    } else {
	   return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	   styleObject.left = newXCoordinate;
	   styleObject.top = newYCoordinate;
	   return true;
    } else {
	   return false;
    }
} // moveObject


function refreshpage(){document.execCommand("refresh");}
function String.prototype.trim(){return this.replace(/(^\s*)|(\s*$)/g,"");}
function String.prototype.Ltrim(){return this.replace(/(^\s*)/g,"");}
function String.prototype.Rtrim(){return this.replace(/(\s*$)/g,"");}
function String.prototype.left(len){return this.substring(0, len);}
function String.prototype.right(len){return this.substring(this.length-len, this.length);}
function String.prototype.Ucase(len){return this.toUpperCase();}
function String.prototype.Lcase(len){return this.toLowerCase();}

function openwin(url,height,width){
			var top=(screen.height-height)/2;
			var left=(screen.width-width)/2; 
			var wins;
			wins=window.open(url,'toolbarwindow','toolbar=no,top='+top+',left='+left+',width='+width+',height='+height+',menubar=no,scrollbars=yes,resizable=yes,status=no,statusbar=no');
			wins.focus();
}

function checkDbl(number)    
{
	var pattern = /^\d+\.*\d{0,4}$/;  
	return (pattern.test(number));
}

function chkDblInput(obj)
{
	
	if (obj.value.trim()==""){alert("You Keyed Nothing!");}
	else{
		if  (!(checkDbl(obj.value.trim()))){alert("You Keyed Error Number!");obj.focus();}
	}
}


//operator document.cookie
function SetCookie(sName, svalue) 
{ 
document.cookie = sName + "=" + escape(svalue) + "; expires=Fri, 31 Dec 3000 23:59:59 GMT;"; 
} 
function GetCookie(sName) 
{ 
	var aCookie = document.cookie.split("; "); 
	for (var i=0; i < aCookie.length; i++) 
	{ 
		var aCrumb = aCookie[i].split("="); 
		if (sName == aCrumb[0]) 
		return unescape(aCrumb[1]); 
	} 
} 
function DelCookie(sName) 
{ 
document.cookie += sName + "=" + escape(svalue) + "; expires=Fri, 31 Dec 1999 23:59:59 GMT;"; 
}
function DelAllCookie()
{
 var time = new Date();
 time.setTime(time.getTime()-1);
 document.cookie += ";expires="+time.toGMTString();
}

function CheckNumber(t)
{
	if (document.layers){
		var keyChar =e.which;
	}
	if (document.all){
		var keyChar =event.keyCode;
	}
	if ((keyChar>57 || keyChar<48))   
	{
		return false;
	}
}

function doZoom(size){
  document.getElementById('zoom').style.fontSize=size+'px'
}

function openwin(url,height,width){
			var top=(screen.height-height)/2;
			var left=(screen.width-width)/2; 
			var wins;
			//wins = showModalDialog(url,"status:no;resizable:yes;dialogHeight:"+ height+"px;dialogWidth:"+width +"px;unadorne:yes");
			wins=window.open(url,'toolbarwindow','toolbar=no,top='+top+',left='+left+',width='+width+',height='+height+',menubar=no,scrollbars=yes,resizable=no,status=no,statusbar=no');
}


function UpdateOrder(mid){
		var url = "../../web/shopper/paymentorderlist.aspx?id="+mid;
		openwin("../common/WinOpen.aspx?url="+url,400,640);
}