﻿//////////////////////////////////////
// Author : Private lan 20100630
// Info : js base farmeset
//////////////////////////////////////
/*if(Fps.isIE)this.cover.style.filter='Alpha(Opacity=50)'; 
        else this.cover.style.MozOpacity='0.5';*/
		
//linkCSS
var $style$ = document.createElement("link");
$style$.type = "text/css";
$style$.rel = "stylesheet";
$style$.href = "/Styles/skinWindow.css";
document.getElementsByTagName("HEAD")[0].appendChild($style$);

var Fps = {
	version : "20100630",
	HttpRule : "HttpRule",  
	HttpRuleValue : {ajax:'ajax', jsvar:'var' , jsfun: 'fun' },
	HttpBack : "HttpBack", 
	HttpBackValue : {ajax:'', jsvar:'FpsResult' , jsfun: ''},
	
	apply : function(c, f){
		if(typeof c != "object" || typeof f != "object"){return;}
		for(var i in f){
			c[i] = f[i];
		}
		return c;
	},
	
	event : function(e){
		if(!e){ e = window.event; }  
		var mouseX = e.pageX || e.clientX;
		var mouseY = e.pageY || e.clientY;
  		var num = e.which || e.keyCode;
		var element = e.srcElement || e.target
		if(num == "13"){ num = "enter"; }
		
		return {
			key : num,
			x : mouseX,
			y : mouseY,
			o : element
		}
	},
	
	//Check navigator version
	IE : 0/*@cc_on+1@*/, 
    ua : navigator.userAgent.toLowerCase(), 
    isStrict : document.compatMode == "CSS1Compat", 
    isOpera : navigator.userAgent.toLowerCase().indexOf("opera") > -1, 
    isSafari : (/webkit|khtml/).test(navigator.userAgent.toLowerCase()), 
    isIE : !(navigator.userAgent.toLowerCase().indexOf("opera") > -1) 
	       && navigator.userAgent.toLowerCase().indexOf("msie") > -1, 
    isIE6 : !(navigator.userAgent.toLowerCase().indexOf("opera") > -1) 
	        && navigator.userAgent.toLowerCase().indexOf("msie 7") == -1 
			&& navigator.userAgent.toLowerCase().indexOf("msie 6") > -1, 
    isIE7 : !(navigator.userAgent.toLowerCase().indexOf("opera") > -1) 
	        && navigator.userAgent.toLowerCase().indexOf("msie 7") > -1, 
    isGecko : !(navigator.userAgent.toLowerCase().indexOf("opera") > -1) 
	          && navigator.userAgent.toLowerCase().indexOf("gecko") > -1, 
   // isBorderBox : isIE && !isStrict, 
    isWindows : (navigator.userAgent.toLowerCase().indexOf("windows") != -1 || 
				navigator.userAgent.toLowerCase().indexOf("win32") != -1), 
    isMac : (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1 || 
               navigator.userAgent.toLowerCase().indexOf("mac os x") != -1), 
    isLinux : (navigator.userAgent.toLowerCase().indexOf("linux") != -1), 
    isSecure : window.location.href.toLowerCase().indexOf("https") === 0,
	isIE : navigator.userAgent.toLowerCase().indexOf("msie") > -1, 
	
	//filter prototype.js frameset.
	filterObject : function(o){
		var filter = ["prototype","extend","toJSONString"];
		var result = false;
			
		for(var i=0; i<filter.length; i++){
			var key = filter[i];
				
			if(o[key]){
				delete o[key];
			}
		}
			
		delete filter;
		return o;
	},
	
	getPageWidth : function(){
		return document.body.clientWidth;
	},
	
	getPageHeight : function(){
		return document.documentElement.clientHeight;
	},
	
	getScrollHeight : function(){
	   var scrollHeight=0;
　　　  if (self.pageYOffset) {
　　　    scrollHeight = self.pageYOffset;
　　　  } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
　　　    scrollHeight = document.documentElement.scrollTop;
　　　  } else if (document.body) { //all other Explorers
　　　    scrollHeight = document.body.scrollTop;
　　　  };
　　　  return scrollHeight
	},
	
	//Dom exptend
	addStyle : function(t, s){
		if(typeof t != "object" || typeof s != "object" ){ return; }
		
		for(var i in s){
			if(i == "float"){
				if(Fps.isIE){
					eval("t.style.styleFloat = '" + s[i] + "'");
				}else{
					eval("t.style.cssFloat = '" + s[i] + "'");
				}
				continue;
			}
			eval("t.style." + i + " = '" + s[i] + "'");
		};
	},
	
	remove : function(o){
		try{
			o.parentNode.removeChild(o);
		}catch(E){
		}
	},
	
	$c : function(o){
		var r = document.createElement(o);
		
		r.addStyle = function(s){
			Fps.addStyle(this, s);
		};
		
		r.remove = function(){
			Fps.remove(this);
		};
		
		return  r;
	},
	
	$g : function(o, t){
		if(!t || t == "id"){
			var r = document.getElementById(o);
			
			if(!r){return;}
			
			r.addStyle = function(s){
				Fps.addStyle(this, s);
			};
		
			r.remove = function(){
				Fps.remove(this);
			};
			
			return r;
		}else if(t == "name"){
			return document.getElementsByName(o);
		}else if(t == "tag"){
			return document.getElementsByTagName(o);
		} 
	},
	
	//Get url param
	getParam : function(n){
		var source = window.location;
		var reg = new RegExp("(^|\\?|&)"+ n +"=([^&]*)(\\s|&|$)", "i"); 
  		if(reg.test(source)){
			return RegExp.$2;
		}
		return "";
	},
	
	//Read and write Cookie
	getCookie : function(n){
		var cookieArray = document.cookie.split("; ");
		var cookie = new Object();
		
		for(var i=0; i<cookieArray.length; i++){
			var arr = cookieArray[i].split("="); 
			if(arr[0] == n){
				return unescape(arr[1]);
			}
		}
		
		return "";
	},
	
	setCookie : function(cookieName, cookieValue, opt){
		var str = cookieName+"="+escape(cookieValue); 
		if(opt){
			var cdate = new Date();
			if(opt.expireHours){
				var ms = opt.expireHours*3600*1000;
				cdate.setTime(cdate.getTime()+ms);
				str += "; expires=" + cdate.toGMTString();
			}else if(opt.expireDays){
				var ms = opt.expireDays*24*3600*1000;
				cdate.setTime(cdate.getTime()+ms);
				str+="; expires="+cdate.toGMTString();
			} 
			if(opt.path){str+="; path="+path;}
			if(opt.domain){str+="; domain"+domain;} 
			if(opt.secure){str+="; true";}
		}
		 
		document.cookie = str;
	},
	
 	removeCookie : function(cookieName){
		 Fps.setCookie(cookieName, "", {expireDays:-1});
	}
	
};

//For object insert event
Fps.addEvent = function (osrc,type, fun){ if (Fps.isIE) { osrc.attachEvent("on"+type, fun); }else{ osrc.addEventListener(type, fun, false); } }; 
Fps.removeEvent = function(osrc,type, fun){if(Fps.isIE) { osrc.detachEvent("on"+type, fun); }else{ osrc.removeEventListener(type, fun, false); } }; 

//For exptend dom 
Fps.Http = {
	times : 0,
	connect : function(uri, hanelFun){
		var s = Fps.$c("script");
		s.type = "text/javascript";
		s.src = uri;
		Fps.$g("head", "tag")[0].appendChild(s);
		
		if(!hanelFun){return;}
		
		s.onload = function(){
			try{
				if(eval(Fps.HttpBackValue.jsvar).length > 0){
					hanelFun(eval(Fps.HttpBackValue.jsvar));
				}else{
					Fps.Http.times++;
					if(Fps.Http.times < 5){
						setTimeout(function(){Fps.Http.connect(uri, hanelFun);}, 10);
					}
				}
			}catch(E){}
		};
		
		s.onreadystatechange = function(){
			var state = s.readyState;
			if(state == "loaded" || state == "interactive" || state == "complete"){
				try{
					if(eval(Fps.HttpBackValue.jsvar).length > 0){
						hanelFun(eval(Fps.HttpBackValue.jsvar));
					}else{
						Fps.Http.times++;
						if(Fps.Http.times < 5){
							setTimeout(function(){Fps.Http.connect(uri, hanelFun);}, 10);
						}
					}
				}catch(E){
				}
			}
		};
	},
	
	get : function(uri, conf, hanleFun){
		this.times =0;
		if(uri.indexOf('?')==-1){ uri += '?'; }
		for(i in conf){
			uri += "&" + i + "=" + conf[i];
		}	
		uri += "&"+ Fps.HttpRule + "=" + Fps.HttpRuleValue.jsvar;
		uri += "&"+ Fps.HttpBack + "=" + Fps.HttpBackValue.jsvar; 
		uri += "&version="+(new Date()).getTime();
		
		this.connect(encodeURI(uri), hanleFun);
		return {
			getURI : function(){ return uri; }
		}
	},
	
	request : function(uri, conf, hanleFunStr){
		if(uri.indexOf('?')==-1){ uri += '?'; }
		for(i in conf){
			uri += "&" + i + "=" + conf[i];
		}
		uri += "&"+ Fps.HttpRule + "=" + Fps.HttpRuleValue.jsfun;
		uri += "&"+ Fps.HttpBack + "=" + hanleFunStr; 
		uri += "&version="+(new Date()).getTime();
		
		this.connect(encodeURI(uri));
	}
	
};

Fps.Ajax = {
	def : {
		uri : "",
		param : "",
		callback : function(){},
		method : "GET",
		isAsync : true
		
	},
	
	getHttp : function(){
		var o;
		
		if(Fps.isIE){
			try{
				o = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				o = new ActiveXObject("MSXML2.XMLHTTP");
			}
		}else{
			o = new XMLHttpRequest();
		}
		
		return o;
	},
	
	send : function(conf){
		var xmlHttp = this.getHttp();
		var par = Fps.apply(this.def, conf);
		
		if(par.uri.indexOf('?')==-1){ par.uri += '?'; }

		xmlHttp.open(par.method, encodeURI(par.uri+"&"+Fps.HttpRule+"="+Fps.HttpRuleValue.ajax+"&version="+(new Date()).getTime()), par.isAsync);
		
		if(par.method == "POST"){
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
		}
		
		xmlHttp.onreadystatechange = function(){
			
			if(xmlHttp.readyState == 4){
			  	if(xmlHttp.status == 200){
                	par.callback(xmlHttp.responseText);
                }else if(xmlHttp.status == 404){
                	return;
                }else{
                	return;
                }
            }  
		};
		xmlHttp.send(par.method == "POST" ? encodeURI(par.param) : "");
	}
};

Fps.Xml = {
	load : function(s){
		var r;
		
    	if(Fps.isIE){
			r = new  ActiveXObject("Microsoft.XMLDOM");
        	r.loadXML(s);
    	}else{
         	var parser = new DOMParser();
         	r = parser.parseFromString(s, "text/xml");
    	}
		
     	return  {
			
			getNodes : function(path){
				if(Fps.isIE){
					return r.documentElement.selectNodes(path);
				}else{
					var t = path.split("/");
					return r.getElementsByTagName(t[t.length-1]); 	
				}
			},
			
			getNode : function(path){
				if(Fps.isIE){
					return r.documentElement.selectNodes(path)[0];
				}else{
					var t = path.split("/");
					return r.getElementsByTagName(t[t.length-1])[0]; 	
				}
			}
		};
	}	
};

//For Form exptend
Fps.Form = {
	setSelect : function(id, value,text){
		var o = Fps.$g(id);
		var p = o.options;
		
		for(var i=0; i<p.length; i++){
			if(p[i].value == value){
				p[i].selected = true;
				break;
			}
		}
		for(var i=0; i<p.length; i++){
			if(p[i].text == text){
				p[i].selected = true;
				break;
			}
		}
	},
	
	fillSelect : function(id, value){
		if(typeof value != "object"){return;}
		var o = Fps.$g(id);
		
		for(var i=0; i<value.length; i++){
			o.options[i] = new Option(value[i][0], value[i][1]);
		}
	},
	
	setRadio : function(eleName, value){
		var o = Fps.$g(eleName, "name");
		
		for(var i=0; i<o.length; i++){
			if(o[i].value == value){
				o[i].checked = true;
			}
		}
	},
	
	getRadio : function(eleName){
		var o = Fps.$g(eleName, "name");
		
		for(var i=0; i<o.length; i++){
			if(o[i].checked == true){
				return o[i].value;
			}
		}
	}
};

Fps.FrameWindow = {
	def : {
		skin : "window0_",
		id : "window_show_lan",
		icon : "",
		title : "通知",
		uri : "",
		width : 300,
		height : 120,
		left : 150,
		top : 60,
		isMode : true,
		move : {down:false, mx:'', my:'', dx:'', dy:''}
	},
	
	isOpen : false,
	mPanel : {},
	cover : {},
	isCover : false,
	
	
	resize : function(w, h){
		this.mPanel.addStyle({width:w+"px", height:h+2+21+"px"});
	},
	
	close : function(){
		
		if(this.isOpen == true){
			this.mPanel.remove(); 
			this.isOpen = false;
		}
		
		if(this.isCover == true){
			this.cover.remove();
			this.isCover = false;
		}
	},
	
	create : function(conf){
		if(this.isOpen == true){this.close();}
		
		var c = Fps.apply(this.def, conf);
	
		if(c.isMode == true){
			var cover = Fps.$c("div");
			cover.className = c.skin + "opacity";
		    cover.addStyle({height:document.documentElement.scrollHeight + "px"});
			document.body.appendChild(cover);
			this.cover = cover;
			this.isCover = true;
		}
		
		var mPanel = Fps.$c("div");
		mPanel.className = c.skin + "main";
		mPanel.addStyle({left:c.left+"px",top:c.top+"px",width:c.width+"px",height:c.height+"px"});
		mPanel.id = c.id;
		
		function remove(){mPanel.remove(); if(typeof cover != "unidefined"){cover.remove();}}//内部使用的关闭
		
		//IE6 注册滚动事件
		function onscroll(){
			if(c.move.down) return;
		    mPanel.addStyle({top: c.top + Fps.getScrollHeight() + "px"}); 
		}
		if(Fps.isIE6){mPanel.addStyle({position:'absolute'}); setInterval(function(){onscroll();},100);}
		
		var top = Fps.$c("div");
		top.className = c.skin + "top";
		
		top.onmousedown = function(e){
			top.style.cursor ="move";
			c.move.down = true;
			c.move.mx = Fps.event(e).x;
			c.move.my = Fps.event(e).y;
			c.move.dx = parseInt(mPanel.style.left);
			c.move.dy = parseInt(mPanel.style.top);
		}
		
		Fps.addEvent(document.body,"mouseup",function(e){c.move.down = false;top.style.cursor ="default";});
		Fps.addEvent(document.body,"mousemove",function(e){
			if(c.move.down){
	           mPanel.style.left=c.move.dx+(Fps.event(e).x-c.move.mx)+'px';
	           mPanel.style.top =c.move.dy+(Fps.event(e).y-c.move.my)+'px';
			   c.top = parseInt(mPanel.style.top) - Fps.getScrollHeight(); //同时更改配置文件中的top
			}
		})

		var iconPanel = Fps.$c("div");
		iconPanel.className = c.skin + "icon";
		if(c.icon != ""){
			var ico = Fps.$c("img");
			ico.src = c.icon;
			iconPanel.appendChild(ico);
		}
		
		iconPanel.appendChild(document.createTextNode(" "+c.title));
		
		var buttonPanel = Fps.$c("div");
		buttonPanel.className = c.skin + "button";
		
		var closeButton = Fps.$c("a");
		closeButton.className = c.skin + "closeButton"
		closeButton.href = "javascript:void(0)";
		closeButton.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		closeButton.addStyle({textDecoration:'none',fontSize:'20px'});
		closeButton.onmousedown = function(){remove(); };
		
		buttonPanel.appendChild(closeButton);
		
		top.appendChild(iconPanel);
		top.appendChild(buttonPanel);
		
		mPanel.appendChild(top);
		
		var conPanel = Fps.$c("div");
		conPanel.className = c.skin + "panel";
		
		if(c.uri != ''){
			var d = Fps.$c('div');
			d.className = c.skin + 'loading';
			d.innerHTML = 'loading...';
			var iframe = Fps.$c('iframe');
			iframe.className = c.skin + 'iframe';
			iframe.src = c.uri;
			iframe.frameBorder = 'no';
			iframe.scrolling = 'no';
			iframe.allowtransparency = 'yes';
			iframe.onload = function(){d.remove();} //ie onload event
			iframe.onreadystatechange = function(){d.remove();} //ff onload event
			conPanel.appendChild(d);
			conPanel.appendChild(iframe);
		}
		
		mPanel.appendChild(conPanel);
		document.body.appendChild(mPanel);
		this.mPanel = mPanel;
		this.isOpen = true;
		
		return {
			add : function(o){ conPanel.appendChild(o); }
		}
	}
};

//For view awoke msg
Fps.Awoke = {
	def : {
		msg : "",
		left : 150,
		top : 60,
		time : 1000
	},
	
	comm : function(conf){
		var par = Fps.apply(this.def, conf);
		
		var panel = Fps.FrameWindow.create({
			icon : Fps.iconPath+"email-open-regular.gif",
			title : "提示信息",
			uri : "",
			width : 250,
			height : 50,
			left : par.left,
			top : par.top,
			isMode : false
		});
		
		var m = Fps.$c("div");
		m.addStyle({width:"auto",height:"30px",lineHeight:"30px",textAlign:"center"});
		m.innerHTML = par.msg;
		panel.add(m);
		
		if(par.time != 0){
			setTimeout(function(){Fps.FrameWindow.close();}, par.time);
		}
	},
	
	window : function(conf){
		var par = Fps.apply(this.def, conf);
		var panel = Fps.FrameWindow.create({
			icon : Fps.iconPath+"email-open-regular.gif",
			title : "",
			uri : "",
			width : 250,
			height : 50,
			left : par.left,
			top : par.top,
			isMode : false
		});
		
		var m = Fps.$c("div");
		m.addStyle({width:"auto",height:"30px",lineHeight:"30px",textAlign:"center"});
		m.innerHTML = par.msg;
		panel.add(m);
	},
	
	loading : function(conf){
		var par = Fps.apply(this.def, conf);
		var panel = Fps.FrameWindow.create({
			icon : "t.gif",
			title : "加载数据中",
			uri : "",
			width : 250,
			height : 50,
			left : par.left,
			top : par.top,
			isMode : true
		});
		
		var m = Fps.$c("div");
		m.addStyle({width:"auto",height:"25px",lineHeight:"25px",color:"#09C",textAlign:"center"});
		m.innerHTML = "正在加载数据，请稍等";
		panel.add(m);
	},
	
	remove : function(conf, hanelFun){
		var par = Fps.apply(this.def, conf);
		
		var panel = Fps.FrameWindow.create({
			icon : Fps.iconPath+"delete-comment-blue.gif",
			title : "删除数据",
			uri : "",
			width : 250,
			height : 70,
			left : par.left,
			top : par.top
		});
		
		var m = Fps.$c("div");
		m.addStyle({width:"auto",height:"30px",lineHeight:"30px",textAlign:"center",color:"red"});
		m.innerHTML = "是否确认删除此条数据";
		
		var button = Fps.$c("div");
		button.addStyle({width:"auto",height:"20px",lineHeight:"20px",textAlign:"center"});
		
		var allay = Fps.$c("a");
		allay.href = "javascript:void(0)";
		allay.innerHTML = "确 定";
		allay.onclick = function(){
			hanelFun();
		};
		
		var concel = Fps.$c("a");
		concel.href = "javascript:void(0)";
		concel.innerHTML = "取 消";
		concel.addStyle({marginLeft:"15px"});
		concel.onclick = function(){
			Fps.FrameWindow.close();
		};
		
		button.appendChild(allay);
		button.appendChild(concel);
		
		panel.add(m);
		panel.add(button);
	}
};

//For view date
Fps.DateTable = {
	def : {
		skin : "table0_",
		height : 300,
		head : [{name : "标题1", width : 100}]
	},
	
	create : function(conf){
		var c = Fps.apply(this.def, conf);
		
		function getPanelW(o){
			var sum = 0;
			
			for(var i=0; i<o.length; i++){
				sum += o[i].width;
			}
			
			return sum + 17 + "px";
		};
		
		function createHead(o){
			var h = c.head;
			
			for(var i=0; i<h.length; i++){
				var headCell = Fps.$c("div");
				headCell.className = c.skin + "headCell";
				headCell.addStyle({width : h[i].width + "px"});
				
				var headText = Fps.$c("div");
				headText.className = c.skin + "headText";
				headText.innerHTML = h[i].name;
				
				var headBorder = Fps.$c("div");
				headBorder.className = c.skin + "headBorder";
				
				headCell.appendChild(headText);
				headCell.appendChild(headBorder);
				o.appendChild(headCell);
			}
		};
		
		var m = Fps.$c("div");
		m.className = c.skin + "main";
		
		var mainWidht = getPanelW(c.head);
		m.addStyle({width :getPanelW(c.head)});
		
		var head = Fps.$c("div");
		head.className = c.skin + "head";
		createHead(head);
		
		var datePanel = Fps.$c("div");
		datePanel.className = c.skin + "datePanel";
		datePanel.addStyle({height:c.height+"px"});

		m.appendChild(head);
		m.appendChild(datePanel);
		
		m.add = function(date){
			var r = Fps.$c("div");
			r.className = c.skin + "dateRow"
			r.onmouseover = function(){
				r.className = c.skin + "dateRow " + c.skin + "row_down";
			};
			r.onmouseout = function(){
				r.className = c.skin + "dateRow " + c.skin + "row_up";
			};
			
			for(var i=0; i<c.head.length; i++){
				var d = Fps.$c("div");
				d.className = c.skin + "dateCell";
				d.style.width = c.head[i].width + "px";
				
				var t = Fps.$c("span");
				t.className = c.skin + "dateText";
				
				if(typeof date[i] != "object"){
					t.innerHTML = date[i];
				}else{
					t.appendChild(date[i]);
				}
				
				d.appendChild(t);
				r.appendChild(d);
			}
		
			datePanel.appendChild(r);
		};
		
		m.clear = function(){
			datePanel.innerHTML = "";
		};
		
		m.getWidth = function(){
			return mainWidht;
		};
		
		return m;
	}
};

//For use more page view date
Fps.DateMorePage = {
	def : {
		date : [1,2,3],
		rowCount : 15,
		dateTable : {},
		index : 1,
		buttonName : {
			first : "First",
			pre : "Pre",
			next : "Next",
			last : "Last"
		}
	},
	
	create : function(conf){
		var c = Fps.apply(this.def, conf);
		
		var d = c.date;
		var n = c.rowCount;
		var dt = c.dateTable;
		var bName = c.buttonName;
		
		var index = 1;
		var newDate = [];
		
		while(d.length > n){
			newDate.push(d.splice(0, n));
		}
		
		newDate.push(d);
		
		var total = newDate.length;
		
		function view(index){
			var d = newDate[index-1];
			dt.clear();
			var i = 0;
			
			while( i< d.length){
				dt.add(d[i]);
				i++;
			}
		};
		
		function pageButton(name, eve){
			var o = Fps.$c("a");
			o.href = "javascript:void(0)";
			o.innerHTML = name;
			o.onclick = function(){
				eve();
				view(index);
				current.innerHTML = index;
			};
			o.addStyle({marginLeft:"10px",marginRight:"10px",marginTop:"10px"});
			
			return o;
		};
			
		var barPanel = Fps.$c("div");
		barPanel.addStyle({width:dt.getWidth(),height:"30px",lineHeight:"30px",borderBottom:"#54a5d5 1px solid"});
		
		var l = Fps.$c("div");
		l.addStyle({width:"100px",height:"30px",marginLeft:"15px",float:"left"});
		
		var current = Fps.$c("label");
		current.innerHTML = index;
		
		l.appendChild(current);
		l.appendChild(document.createTextNode(" / "+total)); 
		
		var r = Fps.$c("div");
		r.addStyle({width:"200px",height:"30px",marginRight:"15px",float:"right",textAlign:"right"});
		
		var first = pageButton(bName.first, function(){
			if(index == 1){return;}
			index = 1;
		});
		var last = pageButton(bName.last, function(){
			if(index == total){return;}
			index = total;
		});
		var pre = pageButton(bName.pre, function(){
			if(index == 1){return;}
			--index;
		});
		var next = pageButton(bName.next, function(){
			if(index == total){return;}
			++index;
		});
		
		r.appendChild(first);
		r.appendChild(pre);
		r.appendChild(next);
		r.appendChild(last);
		barPanel.appendChild(l);
		barPanel.appendChild(r);
		
		view(c.index);
		
		barPanel.getIndex = function(){
			return index;
		};
		
		return barPanel;
	}
};

Fps.TabPanel = {
	
	def : {
		skin : "tabpanel0_",
		index : 0,
		event : "onclick"
	},
	
	create : function(conf){
		var c = Fps.apply(this.def, conf);
		var m = Fps.$c("div");
		m.className = c.skin + "main";
		
		var t = Fps.$c("div");
		t.className = c.skin + "top";
		
		var b = Fps.$c("div");
		b.className = c.skin + "buttom";
		
		m.appendChild(t);
		m.appendChild(b);
		
		var currentDate = {};
		var count = 0;
		
		m.add = function(date){
			var h = Fps.$c("div");
			h.className = c.skin + "head";
			
			if(c.index == count){
				currentDate = {head:h, content:date.content};
				h.addStyle({backgroundImage:"url("+Fps.iconPath+"menuDown.gif)"});
			}
			
			var button = Fps.$c("a");
			button.href = "javascript:void(0)";
			button.innerHTML = date.title;
			button.date = {head:h, content:date.content};
			button.onclick = function(){
				currentDate.head.addStyle({backgroundImage:"none"});
				currentDate.content.addStyle({display:"none"});
				this.date.head.addStyle({backgroundImage:"url("+Fps.iconPath+"menuDown.gif)"});
				this.date.content.addStyle({display:""});
				
				currentDate = {head:this.date.head, content:this.date.content};
			};
			
			h.appendChild(button);
			t.appendChild(h);
			
			if(c.index != count){
				date.content.addStyle({display:"none"});
			}
			
			b.appendChild(date.content);
			count++;
		};
		
		return m;
	}
};


Fps.Accordion = {
	def : {
		skin : "accorditon0_",
		height : 400,
		date : []
	},
	
	create : function(conf){
		var par = Fps.apply(this.def, conf);
		var m = Fps.$c("ul");
		m.className = par.skin + "ul";
		m.addStyle({height:par.height+"px"});
		
		var h = par.height - 22*par.date.length;
		
		var current = {};
		
		for(var i=0; i<par.date.length; i++){
			var l = Fps.$c("li");
			l.className = par.skin + "li";
			l.innerHTML = par.date[i].msg;
			var c = Fps.$c("li");
			c.className = par.skin + "content";
			
			if(typeof par.date[i].content != "object"){
				c.innerHTML = par.date[i].content;
			}else{
				c.appendChild(par.date[i].content);
			}
			
			if(!par.date[i].selected){
				c.addStyle({height:"10px", display:"none"});
			}else{
				c.addStyle({height:h+"px",display:""});
				current = c;
			}
			
			l.content = c;
			
			l.onclick = function(){
				current.addStyle({height:"10px", display:"none"});
				this.content.addStyle({height:h+"px",display:""});
				current = this.content;
			};
			
			l.onmouseover = function(){
				this.addStyle({borderColor:"#004284"});
			};
			
			l.onmouseout = function(){
				this.addStyle({borderColor:"#77b6e6"});
			};
			
			m.appendChild(l);
			m.appendChild(c);
		}
		
		return m;
	}
};
   
Fps.Flash = {
	
	//获取flash对象
	get : function (n) {
    	if (isIE) {
        	return window[n];
    	} else {
        	if (document[n].length != undefined) {
				return document[n][1];
			}
	
			return document[n];		
		}
    },
	
	/**
	* @Info : 创建flash
	× @param : name 名称 String
	* @param : w 宽度 Number
	* @param : h 高度 Number
	* @src : src 路径
	* @flashVars : 传入flash的参数
	* @Return : flash的HTML代码 String
	*/
	
	create : function (name, w, h, src, flashVars, returnHTML, notTransparent) {
		
		var Transparent = typeof notTransparent == "undefined" ? "Transparent" : "Window";
		
		var str = '<object id="' + name + '" name="' + name + '"'+
		' height="' + h + '" width="' + w + '" align="top" '+
		' codebase="http:\/\/download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0"'+
		' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'+
		' <param value="' + src + '" name="movie"/>'+
		' <param value="always" name="allowScriptAccess"/>'+ 
		' <param value="autolow" name="quality"/>'+
		' <param value="all" name="allowNetworking" />'+
		' <param value="'+Transparent+'" name="wmode" />'+
		' <param value="true" name="swLiveConnect"/>'+
		' <param name="FlashVars" value="' + flashVars + '" />'+
		' <embed id="' + name + '" name="' + name + '" '+
		' height="' + h + '" width="' + w + '" align="top" '+
		' allowscriptaccess="always" wmode="'+Transparent+'"'+
		' type="application/x-shockwave-flash" '+
		' pluginspage="http:\/\/www.macromedia.com/go/getflashplayer"'+
		' FlashVars="' + flashVars + '"' +
		' src="' + src + '"/>'+
		' </object>';
		
		return str;
	}
	//var flashvar="aa=aa&bb=bb";
	//var str = Fps.Flash.create("uploadSwf", 323, 46, "../server/upload.swf", flashVar, true, true);
}
    
   
   
   
Fps.move = {
	down:false,
	mx:0,
	my:0,
	dx:0,
	dy:0,
	o:{},
	onmousedown : function(o,e){
		this.o = o;
		o.style.cursor ="move";
		Fps.move.down = true;
		Fps.move.mx = Fps.event(e).x;
		Fps.move.my = Fps.event(e).y;
		Fps.move.dx = parseInt(o.style.left);
		Fps.move.dy = parseInt(o.style.top);
	},
	onmousemove : function(e){
		if(Fps.move.down){
			this.o.style.left=Fps.move.dx+Fps.event(e).x-Fps.move.mx + "px";
			this.o.style.top=Fps.move.dy+Fps.event(e).y-Fps.move.my + "px";
		}
	},
	onmouseup : function(e){
		Fps.move.down = false;
		this.o.style.cursor ="default";
	}
}

/*
s   +=   "\r\n网页可见区域宽："+   document.documentElement.clientWidth;   
s   +=   "\r\n网页可见区域高："+   document.documentElement.clientHeight;   
s   +=   "\r\n网页可见区域宽："+   document.documentElement.offsetWidth     +"   (包括边线的宽)";   
s   +=   "\r\n网页可见区域高："+   document.documentElement.offsetHeight   +"   (包括边线的宽)";   
s   +=   "\r\n网页正文全文宽："+   document.documentElement.scrollWidth;   
s   +=   "\r\n网页正文全文高："+   document.documentElement.scrollHeight;   
s   +=   "\r\n网页被卷去的高："+   document.documentElement.scrollTop;   
s   +=   "\r\n网页被卷去的左："+   document.documentElement.scrollLeft;      
s   +=   "\r\n屏幕分辨率的高："+   window.screen.height;   
s   +=   "\r\n屏幕分辨率的宽："+   window.screen.width;   
s   +=   "\r\n屏幕可用工作区高度："+   window.screen.availHeight;   
*/

	
	var show_notesUI = function(){ 
        function excuteRs(rs){
            if(rs<1){return;}
			var y = Fps.getPageHeight() - 149;
			var x = Fps.getPageWidth() - 250;
			Fps.FrameWindow.create({
									uri:'http://www.brcclub.cn/notices.html?version='+(new Date()).getTime(),
									title:'',
									left:x,
									top: y,
									width:248,
									height:145,
									isMode:false
									});
	    }
		//查询有效通知的条数
		Fps.Ajax.send({uri : "/getNoticeCount.aspx", callback : excuteRs, method : "GET"});
		//Fps.Http.get("getNoticeCount.ashx", {} , excuteRs);
	}
	
	//窗口加载完之后初始化通知
	if(window.attachEvent){
	   window.attachEvent("onload", show_notesUI);   
	}else{
	   window.addEventListener("load",show_notesUI, false);
	}
