// JavaScript Document 我爱七月 174581928 v3.2
(function(){
	window.$ = function(_id){return document.getElementById(_id);};
	window.JUL = new Object();
	JUL.C = new Object();
	JUL.C = {
		_P:"/julAPI",
		_D:new Array(16,56,33,16,16,16,16,12,41,17,11,60,23),
		_Z:0
	};
	JUL.V = function(){
		var ua=navigator.userAgent.toLowerCase();
		if(/msie/.test(ua) && !/opera/.test(ua)){
			return "IE"+ua.match(/msie ([\d.]+)/)[1].substring(0,1);
		}else if(/firefox/.test(ua)){
			return "FF"+ua.match(/firefox\/([\d.]+)/)[1].substring(0,1); 
		}else if(/opera/.test(ua)){
			return "OP"+ua.match(/opera.([\d.]+)/)[1].substring(0,1);
		}else if(/chrome/.test(ua)){
			return "CH"+ua.match(/chrome\/([\d.]+)/)[1].substring(0,1);
		}else if(/webkit/.test(ua)){
			return "SA"+ua.match(/version\/([\d.]+)/)[1].substring(0,1);
		}
	}();
	JUL.INS = function(){
		if(JUL.V=="IE6") document.execCommand("BackgroundImageCache",false,true);
	}();
	JUL.crTag = function(_P,_N,_S,_A){if(_P==undefined || typeof(_P)!="object" || _N==undefined) return false;var tempTag=document.createElement(_N);_P.appendChild(tempTag);if(_S!=undefined){for(var prop in _S){tempTag["style"][prop] = _S[prop];}}if(_A!=undefined){for(var prop in _A){tempTag[prop] = _A[prop];}}return tempTag;}
	JUL.seTag = function(_O,_S,_A){if(_O == undefined || typeof(_O) != "object") return false;if(_S!=undefined){for(var prop in _S){_O["style"][prop] = _S[prop];}}if(_A!=undefined){for(var prop in _A){_O[prop] = _A[prop];}}}
	JUL.seTFL = function(_O,_S){if(JUL.V=="FF3"||JUL.V=="CH2"||JUL.V=="SA4"){_O.style.cssFloat = _S;}else{_O.style.styleFloat = _S;}}
	JUL.seTBG = function(_O,_S){if(JUL.V=="IE6"){_O.style.filter ='progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src="'+_S+'")';}else{_O.style.backgroundImage = 'url('+_S+')';}}
	JUL.seTAP = function(_O,_S){if(_O==undefined || typeof(_O)!="object") return false;if(JUL.V=="IE6"||JUL.V=="IE7"||JUL.V=="IE8"){_O.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+_S+")";}else{_O.style.opacity = "0."+_S;}}
	JUL.geTL = function(_O){if(_O.offsetParent){return _O.offsetLeft + JUL.geTL(_O.offsetParent);}else{return _O.offsetLeft;}};
	JUL.geTT = function(_O){if(_O.offsetParent){return _O.offsetTop + JUL.geTT(_O.offsetParent);}else{return _O.offsetTop;}};
	JUL.Ajax = function(){
		this.url;
		this.type;
		this.open_type = 'get';
		this.asyn = true;
		this.waiting = function(){return;};
		this.response = function(obj){return obj;};
		this.createXmlhttp = function(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}};
		this.send = function(_date){this.xmlhttp.open(this.open_type,this.url,this.asyn);this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.xmlhttp.send(_date);};
		this.stateChange = function(){var _self = this;_self.xmlhttp.onreadystatechange = function(){if(_self.xmlhttp.readyState == 4){if(_self.xmlhttp.status == 200){if(_self.type == "txt"){_self.response(_self.xmlhttp.responseText);}else if(_self.type == "xml"){_self.response(_self.xmlhttp.responseXML);}}else{return false;}}else{_self.waiting();}}};
		if(this.xmlhttp = this.createXmlhttp()){this.stateChange();}
	}
	JUL.OS = new Object();
	JUL.OS.BASE = function(_w,_h,_x,_y,_z){
		var tA = JUL.C._D;
		var temp_w = (JUL.C._D[0]+JUL.C._D[1])>(JUL.C._D[5]+JUL.C._D[6])?(JUL.C._D[0]+JUL.C._D[1]):(JUL.C._D[5]+JUL.C._D[6]);
		var temp_h = JUL.C._D[2]+JUL.C._D[7];
		if(_w == undefined || _w < temp_w) _w = temp_w;
		if(_h == undefined || _h < temp_h) _h = temp_h;
		if(_x == undefined) _x = 0;
		if(_y == undefined) _y = 0;
		if(_z == undefined) _z = 1;
		if(JUL.C._Z<_z){JUL.C._Z = _z;}else{_z = JUL.C._Z;}
		if(JUL.V=="IE6"){
		this.BG = JUL.crTag(document.body,"IFRAME",{width:_w+"px",height:_h+"px"});
							JUL.seTag(this.BG,{position:"absolute",left:_x+"px",top:_y+"px",zIndex:_z-1});
							JUL.seTAP(this.BG,0);
		}
		this.O  = JUL.crTag(document.body,"DIV",{width:_w+"px",height:_h+"px"});
							JUL.seTag(this.O,{position:"absolute",left:_x+"px",top:_y+"px",zIndex:_z});
							JUL.seTag(this.O,{visibility:"inherit",cursor:"default"});
		this.OT = JUL.crTag(this.O,"DIV",{width:_w+"px",height:JUL.C._D[2]+"px"});
		this.OM = JUL.crTag(this.O,"DIV",{width:_w+"px",height:(_h-(JUL.C._D[2]+JUL.C._D[7]))+"px"});
		this.OB = JUL.crTag(this.O,"DIV",{width:_w+"px",height:JUL.C._D[7]+"px"});
							JUL.seTFL(this.OT,"left");
							JUL.seTFL(this.OM,"left");
							JUL.seTFL(this.OB,"left");
		this.OTL= JUL.crTag(this.OT,"DIV",{height:JUL.C._D[2]+"px",width:JUL.C._D[0]+"px"});
		this.OTM= JUL.crTag(this.OT,"DIV",{height:JUL.C._D[2]+"px",width:(_w-(JUL.C._D[0]+JUL.C._D[1]))+"px"});
		this.OTR= JUL.crTag(this.OT,"DIV",{height:JUL.C._D[2]+"px",width:JUL.C._D[1]+"px"});
							JUL.seTag(this.OTL,{fontSize:"0px"});
							JUL.seTag(this.OTM,{overflow:"hidden"});
							JUL.seTag(this.OTR,{fontSize:"0px"});
							JUL.seTFL(this.OTL,"left");
							JUL.seTFL(this.OTM,"left");
							JUL.seTFL(this.OTR,"left");
							JUL.seTBG(this.OTL,JUL.C._P+"/themes/OTL.png");
							JUL.seTBG(this.OTM,JUL.C._P+"/themes/OTM.png");
							JUL.seTBG(this.OTR,JUL.C._P+"/themes/OTR.png");
		this.OML= JUL.crTag(this.OM,"DIV",{height:(_h-(JUL.C._D[2]+JUL.C._D[7]))+"px",width:JUL.C._D[3]+"px"});
		this.OMM= JUL.crTag(this.OM,"DIV",{height:(_h-(JUL.C._D[2]+JUL.C._D[7]))+"px",width:(_w-(JUL.C._D[3]+JUL.C._D[4]))+"px"});
		this.OMR= JUL.crTag(this.OM,"DIV",{height:(_h-(JUL.C._D[2]+JUL.C._D[7]))+"px",width:JUL.C._D[4]+"px"});
							JUL.seTag(this.OML,{fontSize:"0px"});
							JUL.seTag(this.OMM,{background:"#FFF",overflow :"auto"});
							JUL.seTag(this.OMR,{fontSize:"0px"});
							JUL.seTFL(this.OML,"left");
							JUL.seTFL(this.OMM,"left");
							JUL.seTFL(this.OMR,"left");
							JUL.seTBG(this.OML,JUL.C._P+"/themes/OML.png");
							JUL.seTBG(this.OMR,JUL.C._P+"/themes/OMR.png");
		this.OBL= JUL.crTag(this.OB,"DIV",{height:JUL.C._D[7]+"px",width:JUL.C._D[5]+"px"});
		this.OBM= JUL.crTag(this.OB,"DIV",{height:JUL.C._D[7]+"px",width:(_w-(JUL.C._D[5]+JUL.C._D[6]))+"px"});
		this.OBR= JUL.crTag(this.OB,"DIV",{height:JUL.C._D[7]+"px",width:JUL.C._D[6]+"px"});
							JUL.seTag(this.OBL,{fontSize:"0px"});
							JUL.seTag(this.OBM,{fontSize:"0px",overflow:"hidden"});
							JUL.seTag(this.OBR,{fontSize:"0px"});
							JUL.seTFL(this.OBL,"left");
							JUL.seTFL(this.OBM,"left");
							JUL.seTFL(this.OBR,"left");
							JUL.seTBG(this.OBL,JUL.C._P+"/themes/OBL.png");
							JUL.seTBG(this.OBM,JUL.C._P+"/themes/OBM.png");
							JUL.seTBG(this.OBR,JUL.C._P+"/themes/OBR.png");
		this.COL= JUL.crTag(this.OTR,"DIV",{width:JUL.C._D[8]+"px",height:JUL.C._D[9]+"px"});
							JUL.seTag(this.COL,{marginTop:JUL.C._D[10]+"px",display:"inline",position:"relative"});
							JUL.seTFL(this.COL,"left");
							JUL.seTBG(this.COL,JUL.C._P+"/themes/OCOLO.png");
		(function(_self){
			_self.COL.onmouseover = function(){JUL.seTBG(_self.COL,JUL.C._P+"/themes/OCOLH.png");};
			_self.COL.onmouseout  = function(){JUL.seTBG(_self.COL,JUL.C._P+"/themes/OCOLO.png");};
			_self.COL.onmousedown = function(){JUL.seTBG(_self.COL,JUL.C._P+"/themes/OCOLV.png");};
			_self.O.onmousedown   = function(){
				JUL.C._Z+=2;
				if(_self.BG != undefined) JUL.seTag(_self.BG ,{zIndex:JUL.C._Z-1});
				if(_self.O  != undefined) JUL.seTag(_self.O  ,{zIndex:JUL.C._Z});
			};
			_self.COL.onclick     = function(){
				if(_self.BG != undefined) document.body.removeChild(_self.BG);
				if(_self.O  != undefined) document.body.removeChild(_self.O);
			};
			_self.OT.onmousedown  = function(e){
				if (!e) e = window.event;
				var mouse_x = e.clientX;
				var mouse_y = e.clientY;
				var dx = parseInt(_self.O.style.left);
				var dy = parseInt(_self.O.style.top);
				document.onmousemove = function(e){
					if (!e) e = window.event;
					var nl = dx + e.clientX - mouse_x;
					var nt = dy + e.clientY - mouse_y;
					if(_self.BG != undefined) JUL.seTag(_self.BG ,{left:nl+"px",top:nt+"px"});
					if(_self.O  != undefined) JUL.seTag(_self.O  ,{left:nl+"px",top:nt+"px"});
					document.onselectstart = function(){return false;};
				};
				document.onmouseup = function(){document.onmousemove = null;document.onselectstart = null};
			};
		})(this);
	};
	JUL.OS.MSG = function(_w,_h,_x,_y,_z,_n){
		var tA = JUL.C._D;
		var temp_w = JUL.C._D[3]+JUL.C._D[4]+10+(JUL.C._D[11]+5)*3;
		var temp_h = JUL.C._D[2]+JUL.C._D[7]+JUL.C._D[12]+41;
		if(_w == undefined || _w < temp_w) _w = temp_w;
		if(_h == undefined || _h < temp_h) _h = temp_h;
		if(_x == undefined)                _x = 0;
		if(_y == undefined)                _y = 0;
		if(_z == undefined)                _z = 1;
		if(_n == undefined || _n < 1)      _n = 1;
		this.BASE = new JUL.OS.BASE(_w,_h,_x,_y,_z);
								JUL.seTag(this.BASE.OMM,{background:"#F9F9F9",overflow :"hidden"});
		this.TOOL = JUL.crTag(this.BASE.OMM,"DIV",{width:(_w-(JUL.C._D[3]+JUL.C._D[4]+11))+"px",height:21+"px"});
								JUL.seTag(this.TOOL,{marginTop:"5px",marginLeft:"5px",borderLeft:"1px #898C95 solid",overflow:"hidden"});
								JUL.seTBG(this.TOOL,JUL.C._P+"/themes/TBG.png");
		this.T    = new Array();
		this.M    = new Array();
		(function(self,_n){
			for(var i=0; i<_n; i++){
				self.T[i] 	= JUL.crTag(self.TOOL,"DIV",{height:20+"px",border:"1px #898C95 solid",borderLeft:"0px",borderBottom:"0px"});
											JUL.seTag(self.T[i],{padding:"0px 10px",display:"inline",lineHeight:"20px",fontSize:"9pt",cursor:"default"});
											JUL.seTFL(self.T[i],"left");
				self.M[i] 	= new Array();
				self.M[i][0]= JUL.crTag(self.BASE.OMM,"DIV",{width:(_w-(JUL.C._D[3]+JUL.C._D[4]+10))+"px",height:(_h-(JUL.C._D[2]+JUL.C._D[7]+31))+"px"});
											JUL.seTag(self.M[i][0],{marginLeft:"5px",display:"none"});
											JUL.seTFL(self.M[i][0],"left");
											if(i==0){
												JUL.seTag(self.T[i],{background:"#FFF"});
												JUL.seTag(self.M[i][0],{display:"block"});
											}
				self.M[i][1]= JUL.crTag(self.M[i][0],"DIV",{width:(_w-(JUL.C._D[3]+JUL.C._D[4]+12))+"px",height:(_h-(JUL.C._D[2]+JUL.C._D[7]+31+JUL.C._D[12]+10))+"px"});
											JUL.seTag(self.M[i][1],{border:"1px #898C95 solid",borderTop:"0px",background:"#FFF"});
				self.M[i][2]= JUL.crTag(self.M[i][0],"DIV",{width:(_w-(JUL.C._D[3]+JUL.C._D[4]+10))+"px",height:(JUL.C._D[12]+10)+"px"});
				self.M[i][3]= new Array();
				for(var j=0; j<3; j++){
					self.M[i][3][j] = JUL.crTag(self.M[i][2],"DIV",{width:JUL.C._D[11]+"px",height:JUL.C._D[12]+"px"});
														JUL.seTag(self.M[i][3][j],{marginLeft:"5px",marginTop:"5px",display:"inline",fontSize:"9pt"});
														JUL.seTag(self.M[i][3][j],{lineHeight:JUL.C._D[12]+"px",textAlign:"center"});
														JUL.seTFL(self.M[i][3][j],"right");
														JUL.seTBG(self.M[i][3][j],JUL.C._P+"/themes/BUTO.png");
					(function insButon(_o){
						_o.onmouseover = function (i){JUL.seTBG(_o,JUL.C._P+"/themes/BUTV.png");};
						_o.onmouseout  = function (i){JUL.seTBG(_o,JUL.C._P+"/themes/BUTO.png");};
					})(self.M[i][3][j]);
				}
				self.M[i][3][3] = JUL.crTag(self.M[i][2],"DIV",{width:(_w-(JUL.C._D[3]+JUL.C._D[4]+10+(JUL.C._D[11]+5)*3))+"px",height:(JUL.C._D[12]+10)+"px"});
													JUL.seTag(self.M[i][2],{fontSize:"9pt"});
													JUL.seTFL(self.M[i][3][3],"left");
				(function(_self,_i){
					_self.T[_i].onclick = function(){
						for(var i=0; i<_self.T.length; i++){
							JUL.seTag(_self.T[i]   ,{background:""});
							JUL.seTag(_self.M[i][0],{display:"none"});
						}
						JUL.seTag(_self.T[_i]   ,{background:"#FFF"});
						JUL.seTag(_self.M[_i][0],{display:"block"});
					};
				})(self,i);
			}
		})(this,_n);
	};
})();
