﻿var $=function(strid){	
	return (typeof(strid)=="object")?strid:document.getElementById(strid);
};
var $N=function(strid){	
	return document.getElementsByName(strid);
};
var	$F=function(){
	var _num=arguments.length;
	if(_num<1)return;
	if(!$(arguments[0]))return;	
	if(_num==1)return $(arguments[0]).value;
	if(_num==2)$(arguments[0]).value=arguments[1];
};
var $I=function(){
	var _num=arguments.length;
	if(_num<1)return;
	if(!$(arguments[0]))return;
	var _obj=$(arguments[0]);
	if(_num==1)return $(arguments[0]).innerHTML;
	if(_num==2)$(arguments[0]).innerHTML=arguments[1];
};
var $D=function(){
	var _num=arguments.length;
	if(_num<1)return;
	if(!$(arguments[0]))return;	
	if(_num==1)return $(arguments[0]).style.display;
	if(_num==2)$(arguments[0]).style.display=arguments[1];	
};
Object.extend = function(destination, source) { 
  for (property in source) { 
    destination[property] = source[property]; 
  } 
  return destination; 
};
Object.prototype.extend = function(object) { 
  return Object.extend.apply(this, [this, object]); 
};
var EventAdd=function(_obj,_type,_function){
	if(!_obj)_obj=window;
	if(window.attachEvent){
		_obj.attachEvent("on"+_type,_function);
	}else{
		_obj.addEventListener(_type,_function,false);
	}
};
String.prototype.trim = function(){
	return this.replace(/(^[\s　]*)|([\s　]*$)/g, '');
};
var CreateFunction=function(obj,strFunc){
		var args=[];
		if(!obj)obj=window;
		for(var i=2;i<arguments.length;i++)args.push(arguments[i]);
		return function(){
			obj[strFunc].apply(obj,args);
		}
};
/*
function getDocElName(){
   if(document.compatMode && (document.compatMode == "CSS1Compat")){
        return "documentElement";
   }else{
        return "body";
   }
}
var verticalScroll = document[getDocElName()].scrollTop;
*/
var getBrowser=function(){
	var _navigator=navigator.userAgent.toLowerCase();
	return 	_navigator.indexOf("opera")!=-1?"opera":(_navigator.indexOf("firefox")!=-1?"firefox":"msie");
}	

if(typeof(Emoney)!="object")
var Emoney = new Object();


























function showMask(){	
	if(!$("promptShield")){
		var shieldStyle="position:absolute;top:0px;left:0px;width:0;height:0;background:#000000;text-align:center;z-index:1000;filter:alpha(opacity=80);opacity:0.8;";
		try{	
			document.body.appendChild(document.createElement("<div id='promptShield' style=\""+shieldStyle+"\"></div>"));			
		}catch(e){
			var promptShield=document.createElement("div");
			promptShield.id="promptShield";
			promptShield.setAttribute("style",shieldStyle);
			document.body.appendChild(promptShield);
			promptShield=null;
		}
	}
	
	
	$("promptShield").style.display="none";	
	var rootEl=document.compatMode=="CSS1Compat"?document.documentElement:document.body;	
	//alert("rootEl.clientHeight="+rootEl.clientHeight)
	//alert("rootEl.scrollHeight="+rootEl.scrollHeight)
	//alert("body.scrollHeight="+document.body.scrollHeight)
	var _docHeight=((rootEl.scrollTop==0)?rootEl.clientHeight:rootEl.scrollHeight)+"px";
	var _docWidth=((rootEl.scrollLeft==0)?rootEl.clientWidth:rootEl.scrollWidth)+"px";
	$("promptShield").style.width=_docWidth;
	$("promptShield").style.height=rootEl.scrollHeight+"px";	
	$I("promptShield","<div style='position:absolute;left:"+(rootEl.clientWidth/2)+"px;top:200px;'><img src='/estock/images/loading.gif' alt='loading...'><span style='padding-left:6px; font-size: 14px; color:#ffffff';>网页加载中，请稍后...</span>");
	$("promptShield").style.display="";			
	rootEl=null;
	document.body.onselectstart = function(){return false};
	document.body.oncontextmenu = function(){return false};
}

function removeMask(){
	$("promptShield").style.display="none";	
	document.body.onselectstart = function(){return true};
	document.body.oncontextmenu = function(){return true};
}



