// get mouse pointer position

var jtongfu_browserObject=new Object();
jtongfu_browserObject.BrowserType = (navigator.appVersion.match(/MSIE/)) ? 'IE' : 'NS' ;

function jtongfu_loadFilesInIframe(fileUrls){
	this.fileUrls=fileUrls;
	this.taskCount=0;
	this.loadFile=function(file){
		if(file == null || file == ''){
			this.doneLoad();
			return;
		}
		var _doc = document.getElementsByTagName('head')[0];
	    var js = document.createElement('iframe');
	    js.setAttribute('width', '0');
	    js.setAttribute('height', '0');
	    js.setAttribute('frameborder', 'no');
	    js.setAttribute('src', file);
	    js.caller=this;
	    _doc.appendChild(js);
	    if(!/*@cc_on!@*/0){ //if not IE
	        //Firefox2、Firefox3、Safari3.1+、Opera9.6+ support js.onload
	        js.onload=function(){
	            this.caller.doneLoad();
	        }
	    }
	    else{
	        //IE6、IE7 support js.onreadystatechange
	        js.onreadystatechange=function(){
	            if(js.readyState == 'loaded'
	            	|| js.readyState == 'complete'){
	                this.caller.doneLoad();
	            }
	        }
	    }
	}
	this.doneLoad=function(){
		this.taskCount--;
		if(this.taskCount == 0
			&& this.afterLoad != null)
			this.afterLoad();
	}
	this.load=function(){
		this.taskCount = this.fileUrls.length;
		for(ii=0;ii<this.fileUrls.length;ii++)
			this.loadFile(this.fileUrls[ii]);
	}
    this.afterLoad = null;
}

function jtongfu_loadJSFiles(fileUrls){
	this.fileUrls=fileUrls;
	this.taskCount=0;
	this.loadJSFile=function(file){
		if(file == null || file == ''){
			this.doneLoad();
			return;
		}
		var _doc = document.getElementsByTagName('head')[0];
	    var js = document.createElement('script');
	    js.setAttribute('type', 'text/javascript');
	    js.setAttribute('src', file);
	    js.caller=this;
	    _doc.appendChild(js);
	    if(!/*@cc_on!@*/0){ //if not IE
	        //Firefox2、Firefox3、Safari3.1+、Opera9.6+ support js.onload
	        js.onload=function(){
	            this.caller.doneLoad();
	        }
	    }
	    else{
	        //IE6、IE7 support js.onreadystatechange
	        js.onreadystatechange=function(){
	            if(js.readyState == 'loaded'
	            	|| js.readyState == 'complete'){
	                this.caller.doneLoad();
	            }
	        }
	    }
	}
	this.doneLoad=function(){
		this.taskCount--;
		if(this.taskCount == 0
			&& this.afterLoad != null)
			this.afterLoad();
	}
	this.load=function(){
		this.taskCount = this.fileUrls.length;
		for(ii=0;ii<this.fileUrls.length;ii++)
			this.loadJSFile(this.fileUrls[ii]);
	}
    this.afterLoad = null;
}

function jtongfu_getObjectXY(obj){
	var tmpPos = new Object();
	tmpPos.x = 0;
	tmpPos.y = 0;
	var tmpObj = obj;
	do{
		
		if(tmpObj != null){
			//alert(tmpObj.tagName);
			//alert(tmpObj.offsetLeft+'|'+tmpObj.offsetTop);
			tmpPos.x += tmpObj.offsetLeft;
			tmpPos.y += tmpObj.offsetTop;
		}
		tmpObj = (tmpObj.offsetParent != null && tmpObj.tagName != 'BODY') ? tmpObj.offsetParent : null ;
	}
	while(tmpObj != null);
	return tmpPos;
}

function jtongfu_obj1(obj){
	this.obj=obj;
	this.l;
	this.t;
	this.w;
	this.h;
	this.r;
	this.b;
	this.init=function(){
		var tmpPos = jtongfu_getObjectXY(this.obj);
		this.l = tmpPos.x;
		this.t = tmpPos.y;
		this.w = parseInt(this.obj.offsetWidth);
		this.h = parseInt(this.obj.offsetHeight);
		this.r = this.l+this.w;
		this.b = this.t+this.h;
		//alert('l:'+this.l+'\nt:'+this.t+'\nw:'+this.w+'\nh:'+this.h+'\nr:'+this.r+'\nb:'+this.b);
	}
	this.inme=function(x,y){
		if((x>=this.l&&y>=this.t&&y&&x<=this.r&&y<=this.b))
			return true;
		return false;
	}
	this.init();
}

function CallJTongfuScript(src){
	document.write('<script language="javascript" type="text/javascript" src="/js/jtongfu/jtongfu.'+src+'.js"></script>');
}