/*******************************上传功能专用**********************************/
function OnUploadCompleted(err,url,file,message){
	if(url==''){alert('请正确选择文件上传!\n'+message);return};
    if(err==0){
    	alert('上传成功('+url+')!!       ');
        PG.BrowserFile();
    }else{
    	alert('上传失败!!\n\n原因:'+message+'.      ');
	}
}
/*******************************通行证功能**********************************/
var PST = {
	UserName : '',
	Password : '',
	counter:0,
	tabListId : 'myTabs',
	/*内部变量*/
	_isLogin : false, 
	_LastOpResult : false,/*最后一次操作结果*/
	/* 内容过程调用 */

	loadContent : function(/*String*/fName,/*String*/query,/*String*/ActMenuId){
		if(xPassport.isLogined()){
			PG.loadContent(fName,query);
		}else{
			alert('您还未登录，请先登录！！     ');
			location.href = 'login.html'
		}
		/*if(ActMenuId&&MenuTree)MenuTree.setActivedItem(ActMenuId);*/
	},
	/* 通行证注册　*/
	doRegUser : function(obj,/*form XmlNode*/frmobj){
		obj.disabled = true;
		try{
			var sQuery = Form.serialize(frmobj);
			if(PG.doCmd('RegUser',sQuery,0)==1){
				this.chkLogin('txtUserName','txtPassword','vCode','/my/default.html');
			}
		}catch(e){
			alert(e);
		}
		obj.disabled = false;
	},
	/* 页面登录　*/
	chkAdminLogin : function(/*String|Object*/userId,/*String|Object*/pwdId,/*String*/vCode,/*String*/toUrl){
		if(!toUrl) toUrl= '/default.html';
		if(!userId||!pwdId)return;
		var _alert = _window.Open('<img src="/images/default/loading.gif"/>','系统登录中,请稍候...','ismodal=1,width=240,class=VISTA,resize=no');
		userId = Object.isString(userId)?$(userId)['value']:userId;
		pwdId = Object.isString(pwdId)?$(pwdId)['value']:pwdId;
		vCode = Object.isString(vCode)?(($(vCode)==null)?'':$(vCode)['value']):vCode;
		var rtnValue  = false;
		if(userId.length<3||pwdId.length<3){
			alert('对不起！用户名及密码至少3位！！');
		}else{
		var q= 'mLoginUid='+userId+'&mLoginPwd='+pwdId+'&vCode='+vCode;
		new Ajax.Request('/httpchklogin.html',
										{
											asynchronous:false,
											parameters: q ,
											method: 'post',
											onComplete:function(r){
												var text = r.responseText;
												if(text.split(",")[0]==0){
													rtnValue = true;
													if(toUrl==null){
														location.href=document.referer?document.referer:'/my/default.html';
													}else location.href=toUrl;
													_alert = _window.Open('<img src="/images/default/loading.gif"/>','登录成功！转向中,请稍候...','ismodal=1,width=240,class=VISTA,resize=no');
												}else if(text.split(",")[0]==103){
													if($('vCodeLine')) Element.show('vCodeLine');
													rtnValue = false;
													alert(text.split(",")[1]);
												}else{
													rtnValue = false;
													alert(text.split(",")[1]);
												}
											}
										});
		}
		_alert.Hidden();
		return rtnValue;
	},
	openLoginWin : function(){
		var myAjax = new Ajax.Request('/htmls/login.htm?'+Math.random(),{
																	asynchronous:true,
																	method: 'get',
																	onSuccess:function(r){
																		var w = _window.Confirm(r.responseText,'登录','width=260')
																		w.OnOK=function(){
																			if(PST.chkLogin('mLoginUid','mLoginPwd','vCode','#')){
																				alert("祝贺您登录成功!!!");
																				w.Hidden();
																			}
																		}
																	}
																	});
	},
	chkLogin : function(/*String|Object*/userId,/*String|Object*/pwdId,/*String*/vCode,/*String*/toUrl){
		if(!toUrl) toUrl= '/default.html';
		if(!userId||!pwdId)return;
		var _alert = _window.Open('<img src="/images/default/loading.gif"/>','系统登录中,请稍候...','ismodal=1,width=240,class=VISTA,resize=no');
		userId = Object.isString(userId)?$(userId)['value']:userId;
		pwdId = Object.isString(pwdId)?$(pwdId)['value']:pwdId;
		vCode = Object.isString(vCode)?(($(vCode)==null)?'':$(vCode)['value']):vCode;
		if(userId.length<3||pwdId.length<3){
			alert('对不起！用户名及密码至少3位！！');
		}else{
		var q= 'txtUserName='+userId+'&txtPassword='+pwdId+'&vCode='+vCode;
		new Ajax.Request('/httpchklogin.html',
										{
											asynchronous:false,
											parameters: q ,
											method: 'post',
											onComplete:function(r){
												var text = r.responseText;
												if(text.split(",")[0]==0){
													PST._isLogin = true;
													if(toUrl==null){
														location.href=document.referer?document.referer:'/my/default.html';
													}else location.href=toUrl;
													_alert = _window.Open('<img src="/images/default/loading.gif"/>','登录成功！转向中,请稍候...','ismodal=1,width=240,class=VISTA,resize=no');
												}else if(text.split(",")[0]==103){
													if($('vCodeLine')) Element.show('vCodeLine');
													PST._isLogin = false;
													alert(text.split(",")[1]);
												}else{
													PST._isLogin = false;
													alert(text.split(",")[1]);
												}
											}
										});
		}
		_alert.Hidden();
		return this._isLogin;
	},
	LogOut : function(toUrl){
			this._isLogin = false;
			if(toUrl.substring(toUrl.length-1,1)=="/"){toUrl = toUrl.substring(0,toUrl.length-1)}
			dojo.xhrPost({url:"/passport/logout.html",
					 sync : true,
					 error: xPage.doError,
					 load: function(){location.href=toUrl}
			})
			
	},
	doCheckBoxOpen : function(fCb,url,imax,fArg){
		if(PG.IsChecked(fCb,imax)){
			window.open(url+'?'+fCb+'='+PG.getCheckBoxValue(fCb)+'&'+fArg);
		}
	},
	/*执行命令*/
	doCheckBoxCmd : function(fName,fCb,fVal,balert){
		if(PG.IsChecked(fCb)){
			return PG.doCmd(fName,fCb+'='+PG.getCheckBoxValue(fCb)+'&State='+fVal,balert||false);
		}
	},
	/**********************************表单提交保存处理****************************************/
	saveContentCmd : function(fObj,tForm,isAlert){
		try{
			PG.IsAlert = isAlert;
			fObj.disabled=true;
			var d = Form.serialize(tForm);
			var rtnValue = false;
			var myAjax = new Ajax.Request('/aspx/xmlhttppost.aspx',{
																		asynchronous:false, parameters: d ,method: 'post',
																		onComplete:function(r){
																			/*处理返回的数据*/
																			rtnValue =  PST.returnSaveCmdResult(r.responseText);
																	}});
			fObj.disabled=false;
			return rtnValue;
		}catch(e){
			alert(e.message);
			fObj.disabled=false;
			return false;
		}
		return false;
	},
	
	/* 处理 提交数据后返回的代码和消息 */
	returnSaveCmdResult : function(r){
		var arr = r.split(',');
		switch(arr[0])
		{
			case "1":
				if(PG.IsAlert) _window.Alert(arr[1],'提示');
				return true;
			case "2":
				if(PG.IsAlert) _window.Alert(arr[1],'提示');
				return true;
			default:
				alert(arr[1]);
				break;
		}
		return false;
	},
	/*处理 xhr Get方法的结果*/
	doGetResult : function(/*string*/fC){
		xPassport._LastOpResult = xPage.doResult(fC);
	},
	/*处理 xhr Post方法的结果*/
	doPostResult : function(/*string*/fC){
		xPassport._LastOpResult = xPage.doResult(fC);
	}
}
var PG = {
	IsAlert : true,/*是否显示提示信息*/
	MaxSelected :6,
	_FileDialog : null,
	selectObj : {text:null,value:null},
	getIEVersion : function (){
    var reg = new RegExp("MSIE ([^;]*);", "i");
    if (reg.test(navigator.appVersion)) return parseInt(RegExp.$1);
    return 0;
	},
	byId : function(fId){
		return document.getElementById(fId);
	},
	/* 加载内容divContent */
	loadContent : function(/*String*/fName,/*String*/query){
		this.loadTheContent('divContent',fName,query)
	},
	/* 加载内容 */
	loadTheContent : function(/*Object*/node,/*String*/fName,/*String*/query,bAsyn){
		var obj = (Object.isString(node))? this.byId(node):node
		if(!obj){alert('找不到对象['+node+'].');return;}
		var q = 'f='+encodeURI(fName)+'&'+query;
		new Ajax.Updater(obj,'/aspx/xmlhttp.aspx',{asynchronous:bAsyn&&true,parameters: q ,method: 'get'});
		var handle={
			onCreate: function(){
				Element.update(obj,'Loadding...');
			}
		};
		Ajax.Responders.register(handle);
	},
	/* 加载内容 */
	loadUrlContent : function(/*Object*/node,/*String*/fUrl,/*String*/query){
		var obj = (Object.isString(node))? this.byId(node):node
		if(!obj){alert('找不到对象['+node+'].');return;}
		var q = query;
		new Ajax.Request(fUrl,{
																	parameters: sQuery ,
																	method: 'get',
																	evalJS: true,
																	onComplete: function(r) {
																		Element.update(obj,r.responseText);
																	}
																	});
		var handle={
			onCreate: function(){
				Element.update(obj,'Loadding...');
			}
		};
		Ajax.Responders.register(handle);
	},
	FileSelect : function(inputObj,ImgObj,title){
		if(document.readyState=='complete'){
			if(Object.isString(inputObj))inputObj = $(inputObj);
			if(Object.isString(ImgObj))ImgObj = $(ImgObj);
			var sFeatures = 'class=NOKIA,button=OK|CANCEL,width=480px,height=400px,resize=0,ismodal=1';
			var sTitle = '选择我的文件';
			var sQuery = 's=' + Math.random();
			new Ajax.Request('/my/MyFiles.html',{
				asynchronous:false,
				parameters: sQuery,
				method: 'get',
				evalJS: false,
				onSuccess: function(r) {
					PG._FileDialog=_window.Open(r.responseText,title, sFeatures);
					PG._FileDialog.OnOK= function(){
						var objValue = $('imgValue');
						if(objValue!=null){
							if(ImgObj!=null)ImgObj.src =objValue.value
							if(inputObj!=null)inputObj.value =objValue.value
							this.Hidden();
						}else{
							alert('对不起！！你还未选择文件！！\n请重新选择你上传的文件！！！');
						}
					}
				}
			});		
		}else{
			document.onreadystatechange=function(){
				PG.FileSelect(inputObj,ImgObj,title)
			}
		}
	},
	UploadFile :function (){
		Element.hide('browser');
		Element.removeClassName('tab-browser','current')
		Element.show('upload')
		Element.addClassName('tab-upload','current')
	},
	BrowserFile : function(sQuery){
		new Ajax.Request('/my/MyFiles.html',{
					asynchronous:false,
					parameters: 's='+Math.random()+'&'+sQuery,
					method: 'get',
					evalJS: false,
					onSuccess: function(r) {
						PG._FileDialog.SetContent(r.responseText)
					}
				});
		Element.hide('upload');
		Element.removeClassName('tab-upload','current')
		Element.show('browser')
		Element.addClassName('tab-browser','current')
	},
	loadOptions : function(/*Object|String*/node,/*string*/ fName,/*String*/query,/*boolean*/ fuseDefault){
		var obj = (Object.isString(node))? $(node):node;
		var q = 'f='+encodeURI(fName)+'&'+query;
		var tmp = obj.innerHTML;
		obj.disabled = true;
		Element.update(obj,'<option>加载数据中...<option>');
		try{
			new Ajax.Updater(obj,'/aspx/xmlhttp.aspx',{parameters: q ,method: 'get'});
		}catch(e){
			obj.update(tmp);
			alert(e.message);
		}
		obj.disabled = false;
	},
	loadCatalog : function(fnTargetObj,fnParentObj,fuseDefault){
		this.loadOptions((typeof(fnTargetObj)=='object')?fnTargetObj:$(fnTargetObj),(typeof(fnParentObj)=='object')?fnParentObj:$(fnParentObj),'分类目录选择',0||fuseDefault);
	},
	copy2clipboard : function(ss){
     window.clipboardData.setData("text",ss);
     alert("您已经复制了本页的链接，可以直接粘贴发给您的朋友。");
	},
	getOptionValues : function(objid,textobjid,valueobjid,flag){
		flag = (flag==null)?false:flag;
		var obj =  $(objid);
		if(obj==null){if(debug)alert("对不起,对象["+objid+"]未建立");return}
		var text='';
		var values='';
		for(var i=0;i<obj.options.length;i++){
			if(flag){
				text+=","+obj.options[i].text.replace(",","");
				values+=","+obj.options[i].value.replace(",","");
			}else if(obj.selectedIndex>-1){
				text=obj.options[i].text;
				values=obj.options[i].value;
				break;
			}
		}
		$(textobjid).value=text;
        $(valueobjid).value=values;
	},
	setInnerHTML : function (el, htmlCode) {
		var ua = navigator.userAgent.toLowerCase();
		if (ua.indexOf('msie') >= 0 && ua.indexOf('opera') < 0) {
			htmlCode = '<div style="display:none">for IE</div>' + htmlCode;
			htmlCode = htmlCode.replace(/<script([^>]*)>/gi,
										'<script$1 defer>');
			el.innerHTML = '';
			el.innerHTML = htmlCode;
			el.removeChild(el.firstChild);
		} else {
			var el_next = el.nextSibling;
			var el_parent = el.parentNode;
			el_parent.removeChild(el);
			el.innerHTML = htmlCode;
			if (el_next) {
				el_parent.insertBefore(el, el_next)
			} else {
				el_parent.appendChild(el);
			}
		}
	},
	/* －－－－－－－－－－－－－－－　表单对象处理 Form.Element　－－－－－－－－－－－－－－－*/
	// 获得CheckBox元素的值 */
	getCheckBoxValue : function(fId){
		var str ="";
		var obj=document.getElementsByTagName("INPUT");
		for(var i=0;i<obj.length;i++)
			if(obj[i].type=="checkbox")
			{
				if(obj[i].id==fId||obj[i].name==fId)
				{
					if(obj[i].checked&&!obj[i].disabled)
					{
						str = str + "," + obj[i].value;
					}
				}
			}
		if(str.length>0) str = str.substring(1);
		return str;
	},
	// 获得RADIO元素的值 */
	getRadioValue : function(radio) {
		if (!radio.length && radio.type.toLowerCase() == 'radio'){
			return (radio.checked)?radio.value:'';
		}
		if (radio[0].tagName.toLowerCase() != 'input' ||radio[0].type.toLowerCase() != 'radio'){
			return '';
		}
		var len = radio.length; 
		for(i=0; i<len; i++){
			if (radio[i].checked){
				return radio[i].value;
				}
			}
		return '';
	},
	pop : function(node,me,f_){
		var obj = (Object.isString(node))? $(node):node;
		obj.style.display='block';
		obj.style.position='absolute';
		var _w = obj.clientWidth ; _h = obj.clientHeight;
		Position.clone(me,obj);
		obj.style.top = (obj.offsetTop + me.offsetHeight) + 'px';
		obj.style.width = _w;
		obj.style.height = _h;
		obj.onmouseout = function(){
			obj.style.display='none';
		}
		obj.onmouseover = function(){
			obj.style.display='block';
		}
	},
	IsChecked : function(elName,imax){
		var obj	=document.getElementsByName(elName);
		var checked = false;
		imax = (imax==null)?obj.length:imax;
		var icount=0
		for(var i=0;i<obj.length;i++){
			if(obj[i].checked&&!obj[i].disabled){
				checked=true;
				icount++;
			}
			if(icount>imax){
				window.alert("您最多选择"+imax+"项.      ");
				return false;
			}
		}
		if(icount==0) window.alert("请至少选择一个");
		return checked;
	},
	/*第1参数为目录对象*/
	selectOptions : function(){
		if(arguments.length==0) return;
		var tObj = arguments[0];
		if(tObj.options.length>=this.MaxSelected){
			alert('对不起!!你只能选择'+this.MaxSelected+'项!!');
			return ;
		}
		var s = '',v = '';
		for(var i=1;i<arguments.length;i++)
		{
			if(arguments[i].selectedIndex > -1 ){
				s += arguments[i].options[arguments[i].selectedIndex].text + ' / ';
				v = arguments[i].options[arguments[i].selectedIndex].value;
			}
		}
		if(s.length>0){
			var oOption = new Option(s,v);
			tObj.options.add(oOption,-1);
		}
	},
	removeOptions : function(){
		for(var i=0;i<arguments.length;i++)
		{
			if(arguments[i].selectedIndex > -1){
				arguments[i].options[arguments[i].selectedIndex] ==null;
				arguments[i].removeChild(arguments[i].options[arguments[i].selectedIndex]);
			}
		}
	},
	// 获得Select元素的所有Options */
	getOptions : function(objid){
		var optionArray = $A($(objid));
		var text = [],value = [];
		optionArray.each(function(node){
				text.push(node.innerHTML);
				value.push(node.value);
		});
		return {text:text.join(','),value:value.join(',')};
	},
	loadVisited:function(key){
		var strCookie = this.getCookie('Visited_'+key);
		if(strCookie!=null&&$('visitedList')!=null){
			var myAjax = new Ajax.Updater('visitedList','/aspx/xmlhttp.aspx',{
																		parameters: 'f=visitedList&idlist='+strCookie+'&key='+key,
																		method: 'get',
																		evalJS: true
																		});
		}
	},
	addVisited:function(key,val){
		var strCookie = this.getCookie('Visited_'+key);
		if(strCookie!=null){
			var arrVisited = strCookie.split(',');
			var pos = arrVisited.indexOf(val)
			//if not Exists then Add
			if(pos==-1){
				if(arrVisited.length>=10) arrVisited.shift();
				arrVisited.push(val);
			}
			val=arrVisited.join(',');
		}
		this.setCookie('Visited_'+key,val,1);
	},
	/* －－－－－－－－－－－－－－Cookie 设定　－－－－－－－－－－－－－－－*/
	setCookie : function(name, value, expires, path, domain, secure){
		var strCookie = name + "=" + value;
		if (expires){
			var dtmNow = new Date();
			dtmNow.setTime(dtmNow.getTime() + expires*24*60*60*1000);
			strCookie += "; expires=" + dtmNow.toGMTString();
		}
		strCookie +=  (path) ? "; path=" + path : "";
		strCookie +=  (domain) ? "; domain=" + domain : "";
		strCookie +=  (secure) ? "; secure" : "";
		document.cookie = strCookie;
	},
	getCookie : function(name){	
		var strCookies = document.cookie;
		var cookieName = name + "=";
		var intBegin, intEnd, strValue;
		intBegin = strCookies.indexOf(cookieName);
		if (intBegin == -1) return null;
		intEnd = strCookies.indexOf(";", intBegin);
		if (intEnd == -1) intEnd = strCookies.length;
		strValue = strCookies.substring(intBegin+cookieName.length,intEnd);
		return strValue;
	},
	Select : function(sName,txtId,valueId){
		if(document.readyState=='complete'){
		var tObj,vObj;
		tObj = Object.isString(txtId)?$(txtId):txtId;
		vObj = Object.isString(valueId)?$(valueId):valueId;
		
		if(tObj==null||vObj==null){
			alert('未定义的对象！！');
			return;			
		}
		if(tObj.tagName.toLowerCase()=='input'){
			sQuery = 'objText='+((vObj.value!='')?tObj.value:'')+'&objValue='+vObj.value;
		}else{
			sQuery = 'objText='+((vObj.value!='')?tObj.innerHTML:'')+'&objValue='+vObj.value;
		}
		var title = sName;
		new Ajax.Request('/aspx/xmlhttp.aspx',{parameters: 'f='+encodeURI(sName)+'&'+sQuery ,method: 'get',evalJS: true,onComplete: function(transport) {
			var dialogSelect = _window.Open(transport.responseText,title, 'ismodal=1,button=OK|CANCEL,width=420,height=200');
			dialogSelect.OnOK = function(){
				if(tObj.tagName.toLowerCase()=='input'){
					tObj.value = $('selectedText').innerHTML;
				}else{
					tObj.innerHTML=($('selectedText').innerHTML||'选择');
				}
				vObj.value=$('selectedValue').value;
				dialogSelect.Hidden();
			}
			}});
			}else{
				document.onreadystatechange=function(){
					PG.Select(sName,txtId,valueId)
				}
		}
	},
	/*运行ajax 窗口程序*/
	Open :	function (sName,sQuery,sTitle,sFeatures){
		var _w =null;
		if(document.readyState=='complete'){
			var title = (sTitle||sName);
			new Ajax.Request('/aspx/xmlhttp.aspx',{asynchronous:false,parameters: 'f='+encodeURI(sName)+'&'+sQuery ,method: 'get',evalJS: true,onSuccess: function(transport) {_w=_window.Open(transport.responseText,title, sFeatures);}});
		}else{
			document.onreadystatechange=function(){
				_w = PG.Open(sName,sQuery,sTitle,sFeatures);
			}
		}
		return _w;
	},
	Alert: function(sContent,sTitle,sFeatures){
		return _window.open(sContent,(sTitle||'提示'),sFeatures+',resize=no');
	},
	/*运行页面ajax指令*/
	doCmd : function(/*String*/fCmd,/*String*/sQuery,/*boolean?*/fIsAlert){
			if(fCmd.indexOf('删除')>-1){
				if(!window.confirm('执行['+fCmd+'],将删除数据(不可恢复)？'))
				return false;
			}
		var q = 'f='+encodeURI(fCmd)+'&'+sQuery;
		this.IsAlert = fIsAlert;
		var rtnValue = false;
		var myAjax = new Ajax.Request('/aspx/xmlhttp.aspx',{asynchronous:false,parameters: q ,method: 'get',
																	onComplete:function(r){
																		/*处理返回的数据*/
																		rtnValue =  PG.doResult(r.responseText);
																	}});
		return rtnValue;
	},
	doResult: function(fC){
		if(!fC){alert("提交服务器操作失败,请联系管理员!!!     ");return false;}
		try{
			if(fC.split(",")[0].toString()=='1'||fC.split(",")[0].toString()=='2'){
				var message="操作成功!!!";
				if(fC.split(",").length>1)
					if(fC.split(",")[1].toString().length>0)
						var message=fC.split(",")[1].toString();
				/*是否回显提示*/
				if(this.IsAlert) _window.Alert(message, '提示');
				return true;
			}else if(fC.split(",")[0].toString()=='102'){
				alert('找不到此更新的内容！！！('+fC.split(",")[0]+')');
				return false;
			}else if(fC.split(",")[0].toString()=='403'){
				PST.openLoginWin()
				return false;
			}else if(fC.split(",")[0].toString()=='103'){
				if($('vCodeLine')) $('vCodeLine').style.display='';
				alert('验证码填写出错，请检查！！！('+fC.split(",")[0]+')');
				return false;
			}else{
				if(fC.split(",").length>1) var message = fC.split(",")[1].toString()
				_window.Alert(message + "("+ fC.split(",")[0].toString() + ")", '提示','resize=no');
				//alert(message + "("+ fC.split(",")[0].toString() + ")");
				return false;
			}
		}catch(e){alert(e.message);}
		return false;
	},
	/* 复选框 全选 / 取消 /反选*/
	CheckBoxSelect : function(fId,flag){
		var obj=document.getElementsByTagName("INPUT");
		for(var i=0;i<obj.length;i++)
			if(obj[i].type=="checkbox"&&!obj[i].disabled)
			{
				if((!fId)||obj[i].id==fId||obj[i].name==fId){
					if(flag==2)
					{
						obj[i].checked=!obj[i].checked;
					}else{
						obj[i].checked=flag;
					}
				}
			}
	},
	doError : function(/*string*/text){
		alert(text)
	}	
}
PG.SWFPlayer = function(/*Object Id*/Obj,swf_width,swf_height){
	if(Object.isString(Obj)) Obj=$(Obj);
	if(Obj==null) return;
	Element.hide(Obj);
	var files='',links='',texts='';
	$$('#'+Obj.id+' ul li a').each(
		function(item){
			texts+=((texts=='')?'':'|')+item.title;
			links+=((links=='')?'':'|')+item.href;
		}
	)
	$$('#'+Obj.id+' ul li img').each(
		function(item){
			files+=((files=='')?'':'|')+item.src;
		}
	)
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
	document.write('<param name="movie" value="/swf/bcastr3.swf"><param name="quality" value="high">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'">');
	document.write('<embed src="/swf/bcastr3.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); 
	document.write('</object>'); 
}
/*******************************************************************/
function Slider(container, frequency, direction) {
  if (typeof(container) == 'string') {
    container = document.getElementById(container);
  }
  this.container = container;
  this.frequency = frequency;
  this.direction = direction;
  this.films = [];
  this._playTimeoutId = null;
  this._slideTimeoutId = null;
  this._slidable = true;
	this._current = 0;

  var divs = this.container.getElementsByTagName('li');
  for (var i = 0; i < divs.length; i++) {
      divs[i].onmouseover = function(self){return function(){self._mouseover()};}(this);
      divs[i].onmouseout = function(self){return function(){self._mouseout()};}(this);
  }
  this._loop();
}

Slider.prototype = {
  _loop : function() {
    var sb = this;
    this._playTimeoutId = setTimeout(function(){sb._slide()}, this.frequency);
  },

  _slide : function() {
    var sb = this;
		//$('test').innerHTML+=sb.container.id+'='+sb._slidable+'<br/>';
		if(sb._slidable){
			var c = sb.container;
			Effect.Fade(c.getElementsByTagName('li')[this._current],{duration:1,from:0.8,to:0});
			this._current++;
			if(this._current>=c.getElementsByTagName('li').length){
					this._current=0
			}
			Effect.Appear(c.getElementsByTagName('li')[this._current]);
		}
    this._playTimeoutId = setTimeout(function(){sb._slide()}, this.frequency);
  },

  _mouseover : function() {
    this._slidable = false;
  },

  _mouseout : function() {
    this._slidable = true;
  }
}
/*******************************************************************/
/*-----------------以下为_Window 对象----------------*/
function _window(features)
{
	this.id=this.name="_W_"+(++_window.wIndex);
	this.string="_window.windows."+this.id;
	this.zIndex=++_window.zIndex;
	this.className=_window.getFeature(features,"class")||_window.ClassName;
	this.bodyWidth=parseInt(_window.getFeature(features,"width"))||_window.Width;
	this.bodyHeight=parseInt(_window.getFeature(features,"height"))||_window.Height;
	this.left=_window.getFeature(features,"left");
	this.top=_window.getFeature(features,"top");
	this.right=_window.getFeature(features,"right");
	this.bottom=_window.getFeature(features,"bottom");
	this.move=_window.getFeature(features,"move").toLowerCase()||"move";
	this.isModal=_window.getFeature(features,"ismodal")?true:false; //独立
	this.button=_window.getFeature(features,"button").toUpperCase();
	this.resize=_window.getFeature(features,"resize").toLowerCase()||"resize";
	this.buttons={};
	_window.windows[this.id]=this;
}

_window.Version="Fonshen JS Window V1.00.08.01.03";
_window.ClassName="NOKIA";
_window.Width=400;
_window.Height=-1;
_window.Timer=10;
_window.windows={};
_window.wIndex=0;
_window.zIndex=0;
_window.clientWidth=0;
_window.clientHeight=0;
_window.onmousemove=null;
_window.onmouseup=null;
_window.onselectstart=null;

_window.getFeature=function(source,name)
{
	var reg=new RegExp("(^|,|\\s)"+ name +"\\s*=\\s*([^,]*)(\\s|,|$)","i");
	if (reg.test(source)) return RegExp.$2;
	return "";
};
_window.getMaxNumber=function()
{
	var num=0;
	for(var i=0;i<arguments.length;i++) if(arguments[i]>num) num=arguments[i];
	return num;
};

_window.Open=function(content,title,features)
{
	document.body.style.position="static";
	var obj=new _window(features);
	obj.Creat(content,title);
	return obj;
};
_window.Alert=function(content,title,features)
{
	var obj=new _window(features);
	obj.button="OK";
	obj.isModal = true;
	obj.Creat(content,title||"Alert");
	obj.buttons["OK"].focus();
	return obj;
};
_window.Confirm=function(content,title,features)
{
	var obj=new _window(features);
	obj.button="OK|CANCEL";
	obj.isModal = true;
	obj.Creat(content,title||"Confirm");
	obj.buttons["OK"].focus();
	return obj;
};

_window.prototype.Creat=function(content,title)
{
	if(this.isModal)
	{
		this.modal=document.createElement("div");
		this.modal.className="MODAL";
		this.modal.style.position="absolute";
		this.modal.style.zIndex=this.zIndex;
		this.modal.style.width=document.documentElement.scrollWidth+"px";
		this.modal.style.height=document.documentElement.scrollHeight+"px";
		this.modal.style.left="0px";
		this.modal.style.top="0px";
		this.modal.appendChild(document.createElement("iframe"));
		document.body.appendChild(this.modal);
		this.zIndex=++_window.zIndex;
	}
	this.board=document.createElement("div");
	this.board.className=this.className;
	this.board.style.position="absolute";
	this.board.style.zIndex=this.zIndex;
	this.board.style.visibility="hidden";
	document.body.appendChild(this.board);
	if(!_window.clientHeight)
	{
		this.board.style.left = "100%";
		this.board.style.top = "100%";
		_window.clientWidth = this.board.offsetLeft;
		_window.clientHeight = this.board.offsetTop;
	}
	var styles=new Array("LEFT_TOP","TOP","RIGHT_TOP","RIGHT","RIGHT_BOTTOM","BOTTOM","LEFT_BOTTOM","LEFT","CONTENT","TITLE");
	this.sides=new Array();
	if(this.button)
	{
		styles[4]="RIGHT_BOTTOM_BY_BUTTON";
		styles[5]="BOTTOM_BY_BUTTON";
		styles[6]="LEFT_BOTTOM_BY_BUTTON";
		styles[styles.length]="BUTTON";
	}
	if(this.resize!="no") styles[styles.length]="RESIZE";
	styles[styles.length]="CLOSE";
	var sAttachFocus="obj.onmousedown=function(e){ "+this.string+".Focus();};";
	var sAttachPreMove=this.move=="no"?sAttachFocus:"obj.onmousedown=function(e){ "+this.string+".PreMove(e?e:window.event);};";
	for(var i=0;i<styles.length;i++)
	{
		var obj=document.createElement("div");
		obj.className=styles[i];
		obj.style.position="absolute";
		this.board.appendChild(obj);
		switch(styles[i])
		{
			case "CONTENT":
				this.contentCase=obj;
				obj.style.width=this.bodyWidth+"px";
				this.SetContent(content);
				obj.style.height=this.bodyHeight+"px";
				obj.style.left=(this.sides[7].width+obj.offsetLeft)+"px";
				obj.style.top=(this.sides[1].height+obj.offsetTop)+"px";
				eval(sAttachFocus);
				this.width=this.bodyWidth+this.sides[3].width+this.sides[7].width;
				this.height=this.bodyHeight+this.sides[1].height+this.sides[5].height;
				this.board.style.height=this.height+"px";
				this.board.style.width=this.width+"px";
				this.minWidth=_window.getMaxNumber(this.sides[0].width+this.sides[2].width,this.sides[3].width+this.sides[7].width,this.sides[4].width+this.sides[6].width)+20;
				this.minHeight=_window.getMaxNumber(this.sides[0].height+this.sides[6].height,this.sides[1].height+this.sides[5].height,this.sides[2].height+this.sides[4].height)+2;
				break;

			case "TITLE":
				this.titleCase=obj;
				obj.style.width=this.width+"px";
				this.titleCase.dx=obj.offsetWidth-this.width;
				if(this.minWidth<this.titleCase.dx) this.minWidth=this.titleCase.dx;
				if(this.width>this.titleCase.dx) obj.style.width=(this.width-this.titleCase.dx)+"px";
				this.SetTitle(title);
				eval(sAttachPreMove);
				break;

			case "BUTTON":
				this.buttonCase=obj;
				obj.style.width=this.width+"px";
				obj.style.bottom="0px";
				this.buttonCase.dx=obj.offsetWidth-this.width;
				if(this.minWidth<this.buttonCase.dx) this.minWidth=this.buttonCase.dx;
				if(this.width>this.buttonCase.dx) obj.style.width=(this.width-this.buttonCase.dx)+"px";
				var buttons=this.button.split("|");
				for(var j=0;j<buttons.length;j++)
				{
					var o=document.createElement("button");
					o.className=buttons[j];
					o.title=buttons[j];
					obj.appendChild(o);
					eval("o.onclick=function(e){ "+this.string+".On"+buttons[j]+"();};");
					this.buttons[buttons[j]]=o;
				}
				break;

			case "RESIZE":
				obj.style.cursor="se-resize";
				eval("obj.onmousedown=function(e){ "+this.string+".PreResize(e?e:window.event);};");
				break;

			case "CLOSE":
				eval("obj.onclick=function(e){ "+this.string+".Close();};");
				break;

			default:
				this.sides[i]=obj;
				this.sides[i].width=obj.offsetWidth;
				this.sides[i].height=obj.offsetHeight;
				eval(sAttachPreMove);
				break;
		}
	}
	this.sides[1].dx=this.sides[0].width+this.sides[2].width;
	if(this.width>this.sides[1].dx) this.sides[1].style.width=(this.width-this.sides[1].dx)+"px";
	this.sides[3].dy=this.sides[2].height+this.sides[4].height;
	if(this.height>this.sides[3].dy) this.sides[3].style.height=(this.height-this.sides[3].dy)+"px";
	this.sides[5].dx=this.sides[4].width+this.sides[6].width;
	if(this.width>this.sides[5].dx) this.sides[5].style.width=(this.width-this.sides[5].dx)+"px";
	this.sides[7].dy=this.sides[6].height+this.sides[0].height;
	if(this.height>this.sides[7].dy) this.sides[7].style.height=(this.height-this.sides[7].dy)+"px";

	this.sides[0].style.left="0px";
	this.sides[0].style.top="0px";
	this.sides[1].style.left=this.sides[0].width+"px";
	this.sides[1].style.top="0px";
	this.sides[2].style.right="0px";
	this.sides[2].style.top="0px";
	this.sides[3].style.right="0px";
	this.sides[3].style.top=this.sides[2].height+"px";
	this.sides[4].style.right="0px";
	this.sides[4].style.bottom="0px";
	this.sides[5].style.left=this.sides[6].width+"px";
	this.sides[5].style.bottom="0px";
	this.sides[6].style.left="0px";
	this.sides[6].style.bottom="0px";
	this.sides[7].style.left="0px";
	this.sides[7].style.top=this.sides[0].height+"px";
	this.left=this.left?parseInt(this.left):(this.right?_window.clientWidth-this.width-parseInt(this.right):parseInt((_window.clientWidth-this.width)/2));
	this.top=this.top?parseInt(this.top):(this.bottom?_window.clientHeight-this.height-parseInt(this.bottom):parseInt((_window.clientHeight-this.height)/2));
/*	alert('_window.clientHeight='+_window.clientHeight);
	alert('this.height='+this.height);*/
	if(this.left<0) this.left=0;
	if(this.top<0) this.top=0;
	this.left+=document.documentElement.scrollLeft;
	this.top+=document.documentElement.scrollTop;
	this.board.style.left=this.left+"px";
	this.board.style.top=this.top+"px";
	this.board.style.visibility="visible";
	this.status=1;
};

_window.prototype.SetContent=function(content)
{
	var type=content.slice(0,5),tent=content.slice(5);
	if(this.oldcase)
	{
		this.oldcase.appendChild(this.oldcontent);
		this.oldcase = null;
	}
	if(type=="[xml]")
	{
		var myAjax = new Ajax.Updater(this.contentCase,'/xmlhttp.aspx?f='+encodeURI(tent), {method: 'get'});
	}
	else if(type=="[url]")
	{
		if(this.iframe)
		{
			if(this.contentCase.firstChild!=this.iframe) this.contentCase.replaceChild(this.iframe,this.contentCase.firstChild);
			this.iframe.src=tent;
		}
		else
		{
			var str=(this.bodyHeight<0)?"onload=\"if("+this.string+".bh<2)"+this.string+".ResizeBy(0,frames[frames.length-1].document.documentElement.scrollHeight);\"":"";
			var id="_F"+this.id;
			this.contentCase.innerHTML="<iframe id=\""+id+"\" name=\""+id+"\" "+str+" onfocus=\""+this.string+".Focus()\" src=\""+tent+"\" frameBorder='0' marginHeight='0' marginWidth='0' width='100%' charset='utf-8' height='100%'></iframe>";
			if(this.bodyHeight<0) this.bodyHeight=1;
			this.iframe=document.getElementById(id);
			this.frame=eval(id);
			this.frame.document.charset='utf-8';
		}
	}
	else
	{
		if(this.form)
		{
			if(this.contentCase.firstChild!=this.form) this.contentCase.replaceChild(this.form,this.contentCase.firstChild);
		}
		else
		{
			this.form=document.createElement("div");
			this.form.className="FORM";
			this.form.style.zIndex=-1;
/*			this.form.method="post";
			eval("this.form.onsubmit=function(e){ return false;}");*/
			if(this.contentCase.hasChildNodes())this.contentCase.replaceChild(this.form,this.contentCase.firstChild);
			else this.contentCase.appendChild(this.form);
		}
		if(type=="[obj]"||content.slice(0,4)=="[id]")
		{
			if(type=="[obj]")this.oldcontent=eval(tent);
			else this.oldcontent=document.getElementById(content.slice(4));
			this.oldcontent.style.display='';//修正Style.Display 的值　By Leo
			this.oldcase=this.oldcontent.parentNode;
			this.form.appendChild(this.oldcontent);
		}
		else
		{
			Element.Methods.update(this.form,content);
		}
		
		if(this.bodyHeight<0) this.bodyHeight=(this.contentCase.offsetHeight)+1;
		this.contentCase.style.overflow="auto";
	}
	this.content=content;
};
_window.prototype.SetTitle=function(title)
{
	title=title||"选择Window";
	if(this.title==title) return false;
	this.titleCase.innerHTML=title;
	this.title=title;
};

_window.prototype.Focus=function()
{
	if(this.zIndex<_window.zIndex) this.board.style.zIndex=this.zIndex=++_window.zIndex;
};
_window.prototype.Close=function()
{
	this.Hidden();
	delete _window.windows[this.id];
	for(var key in this) delete this[key];
};
_window.prototype.Hidden=function()
{
	document.body.style.position="relative";
	if (typeof(this.MoveTimer)!="undefined") clearTimeout(this.MoveTimer);
	if (typeof(this.ResizeTimer)!="undefined") clearTimeout(this.ResizeTimer);
	document.body.removeChild(this.board);
	if(this.isModal) document.body.removeChild(this.modal);
	if(this.oldcase) this.oldcase.appendChild(this.oldcontent);
	if(this.oldcontent) this.oldcontent.style.display='none';//修订隐藏后不显示 By Leo
	this.status=0;
};
_window.prototype.Show=function()
{
	if(this.oldcase) this.form.appendChild(this.oldcontent);
	if(this.isModal) document.body.appendChild(this.modal);
	document.body.appendChild(this.board);
	this.status=1;
};

_window.prototype.Duplicate=function()
{
	this.copy=document.createElement("DIV");
	document.body.appendChild(this.copy);
	this.copy.style.cssText="position:absolute;left:"+(this.left-2)+"px;top:"+(this.top-2)+"px;width:"+this.width+"px;height:"+this.height+"px;border:2px dotted #000000;";
	this.copy.style.zIndex=this.zIndex+1;
};
_window.prototype.DetachEvent=function(e)
{
	document.body.style.cursor="default";
	document.onmousemove=_window.onmousemove;
	document.onmouseup=_window.onmouseup;
	document.onselectstart=_window.onselectstart;
	if(this.board.releaseCapture) this.board.releaseCapture();
};
_window.prototype.AttachEvent=function(e)
{
	_window.onmousemove=document.onmousemove;
	_window.onmouseup=document.onmouseup;
	_window.onselectstart=document.onselectstart;
	if(e.preventDefault) e.preventDefault();
	else
	{
		document.onselectstart=function(){return false;};
		if(this.board.setCapture) this.board.setCapture();
	}
};

_window.prototype.PreResize=function(e)
{
	if (typeof(this.ResizeTimer)!="undefined") clearTimeout(this.ResizeTimer);
	this.Focus();
	this.Duplicate();
	this.resizeX=e.clientX-this.width-4;
	this.resizeY=e.clientY-this.height-4;
	document.body.style.cursor="se-resize";
	this.AttachEvent(e);
	eval("document.onmousemove=function(e){"+this.string+".Resize(e?e:window.event);};");
	eval("document.onmouseup=function(e){"+this.string+".Resized(e?e:window.event);};");
};
_window.prototype.Resize=function(e)
{
	if(this.resize!="resize-y")
	{
		var w=e.clientX-this.resizeX;
		if(w >= this.minWidth) this.copy.style.width=w+"px";
	}
	if(this.resize!="resize-x")
	{
		var h=e.clientY-this.resizeY;
		if(h >= this.minHeight) this.copy.style.height=h+"px";
	}
};
_window.prototype.Resized=function(e)
{
	this.DetachEvent(e);
	var dx=0,dy=0;
	if(this.resize!="resize-y")
	{
		var w=e.clientX-this.resizeX-4;
		w=(w>this.minWidth)?w:this.minWidth;
		dx=w-this.width;
	}
	if(this.resize!="resize-x")
	{
		var h=e.clientY-this.resizeY-4;
		var h=(h>this.minHeight)?h:this.minHeight;
		dy=h-this.height;
	}
	if(_window.Timer>0&&this.width >= this.minWidth&&this.height >= this.minHeight) this.ActResizeBy(dx,dy);
	else  this.ResizeBy(dx,dy);
	document.body.removeChild(this.copy);
	this.copy=null;
};
_window.prototype.ResizeBy=function(dx,dy)
{
	if(dx)
	{
		this.width+=dx;
		this.board.style.width=this.width+"px";
		this.sides[1].style.width=(this.width-this.sides[1].dx)+"px";
		this.sides[5].style.width=(this.width-this.sides[5].dx)+"px";
		this.titleCase.style.width=(this.width-this.titleCase.dx)+"px";
		if(this.buttonCase) this.buttonCase.style.width=(this.width-this.buttonCase.dx)+"px";
		this.bodyWidth+=dx;
		this.contentCase.style.width=this.bodyWidth+"px";
	}
	if(dy){this.height+=dy;
	this.board.style.height=this.height+"px";
	this.sides[3].style.height=(this.height-this.sides[3].dy)+"px";
	this.sides[7].style.height=(this.height-this.sides[7].dy)+"px";
	this.bodyHeight+=dy;
	this.contentCase.style.height=this.bodyHeight+"px";
	}
};
_window.prototype.ActResizeBy=function(dx,dy)
{
	if(dx||dy)
	{
		var x=dx/10;
		x=(x>0)?Math.ceil(x):Math.floor(x);
		var y=dy/10;
		y=(y>0)?Math.ceil(y):Math.floor(y);
		this.ResizeBy(x,y);
		dx-=x;
		dy-=y;
		this.ResizeTimer=window.setTimeout(this.string+".ActResizeBy("+dx+","+dy+")",_window.Timer);
	}
};

_window.prototype.PreMove=function(e)
{
	if (typeof(this.MoveTimer)!="undefined") clearTimeout(this.MoveTimer);
	this.Focus();
	this.Duplicate();
	this.moveX=e.clientX-this.left+2;
	this.moveY=e.clientY-this.top+2;
	document.body.style.cursor="move";
	this.AttachEvent(e);
	eval("document.onmousemove=function(e){"+this.string+".Move(e?e:window.event);};");
	eval("document.onmouseup=function(e){"+this.string+".Moved(e?e:window.event);};");
};
_window.prototype.Move=function(e)
{
	if(this.move!="move-y") this.copy.style.left=(e.clientX-this.moveX)+"px";
	if(this.move!="move-x") this.copy.style.top=(e.clientY-this.moveY)+"px";
};
_window.prototype.Moved=function(e)
{
	this.DetachEvent(e);
	var tx=(this.move=="move-y")?null:(e.clientX-this.moveX+2);
	var ty=(this.move=="move-x")?null:(e.clientY-this.moveY+2);
	if(_window.Timer>0) this.ActMoveTo(tx,ty);
	else  this.MoveTo(tx,ty);
	document.body.removeChild(this.copy);
	this.copy=null;
};
_window.prototype.MoveTo=function(tx,ty)
{
	if(tx!=null)
	{
		this.left=tx;
		this.board.style.left=tx+"px";
	}
	if(ty!=null)
	{
		this.top=ty;
		this.board.style.top=ty+"px";
	}
};
_window.prototype.ActMoveTo=function(tx,ty)
{
	if((tx==null||tx==this.left)&&(ty==null||ty==this.top)) return;
	if(tx!=null)
	{
		var dx=(tx-this.left)/10;
		dx=(dx>0)?Math.ceil(dx):Math.floor(dx);
		this.left+=dx;
		}if(ty!=null){var dy=(ty-this.top)/10;
		dy=(dy>0)?Math.ceil(dy):Math.floor(dy);
		this.top+=dy;
	}
	this.MoveTo(this.left,this.top);
	this.MoveTimer=window.setTimeout(this.string+".ActMoveTo("+tx+","+ty+")",_window.Timer);
};

_window.prototype.DisableButton=function(name,style)
{
	name=name.toUpperCase();
	this.buttons[name].disabled=true;
	this.buttons[name].className=(style?style:"DISABLED")+" "+name;
};
_window.prototype.EnableButton=function(name)
{
	name=name.toUpperCase();
	this.buttons[name].disabled=false;
	this.buttons[name].className=name;
};

_window.prototype.OnBACK=function()
{
	if(!this.step) this.step=0;
	if(this.OnBACKS){ if(this.step>0) this.OnBACKS[--this.step]();}
};
_window.prototype.OnNEXT=function()
{
	if(!this.step) this.step=0;
	if(this.OnNEXTS){ if(this.step<this.OnNEXTS.length) this.OnNEXTS[this.step++]();}
};
_window.prototype.OnOK=function()
{
	this.Close();
};
_window.prototype.OnCANCEL=function()
{
	this.Close();
};
function ColorTable(instance){
	this.Instance = new String(instance);
	this.Color = "#000000";
	this.Callback = null;
	var flag = -1;
	var PreviewCellID = Global.GetUniqueID();
	var RGBID = Global.GetUniqueID();
	var LayerID = Global.GetUniqueID();
	var Colors = "#000000,#000000,#000000,#000000,#003300,#006600,#009900,#00cc00,#00ff00,#330000,#333300,#336600,#339900,#33cc00,#33ff00,#660000,#663300,#666600,#669900,#66cc00,#66ff00,#000000,#333333,#000000,#000033,#003333,#006633,#009933,#00cc33,#00ff33,#330033,#333333,#336633,#339933,#33cc33,#33ff33,#660033,#663333,#666633,#669933,#66cc33,#66ff33,#000000,#666666,#000000,#000066,#003366,#006666,#009966,#00cc66,#00ff66,#330066,#333366,#336666,#339966,#33cc66,#33ff66,#660066,#663366,#666666,#669966,#66cc66,#66ff66,#000000,#999999,#000000,#000099,#003399,#006699,#009999,#00cc99,#00ff99,#330099,#333399,#336699,#339999,#33cc99,#33ff99,#660099,#663399,#666699,#669999,#66cc99,#66ff99,#000000,#cccccc,#000000,#0000cc,#0033cc,#0066cc,#0099cc,#00cccc,#00ffcc,#3300cc,#3333cc,#3366cc,#3399cc,#33cccc,#33ffcc,#6600cc,#6633cc,#6666cc,#6699cc,#66cccc,#66ffcc,#000000,#ffffff,#000000,#0000ff,#0033ff,#0066ff,#0099ff,#00ccff,#00ffff,#3300ff,#3333ff,#3366ff,#3399ff,#33ccff,#33ffff,#6600ff,#6633ff,#6666ff,#6699ff,#66ccff,#66ffff,#000000,#ff0000,#000000,#990000,#993300,#996600,#999900,#99cc00,#99ff00,#cc0000,#cc3300,#cc6600,#cc9900,#cccc00,#ccff00,#ff0000,#ff3300,#ff6600,#ff9900,#ffcc00,#ffff00,#000000,#00ff00,#000000,#990033,#993333,#996633,#999933,#99cc33,#99ff33,#cc0033,#cc3333,#cc6633,#cc9933,#cccc33,#ccff33,#ff0033,#ff3333,#ff6633,#ff9933,#ffcc33,#ffff33,#000000,#0000ff,#000000,#990066,#993366,#996666,#999966,#99cc66,#99ff66,#cc0066,#cc3366,#cc6666,#cc9966,#cccc66,#ccff66,#ff0066,#ff3366,#ff6666,#ff9966,#ffcc66,#ffff66,#000000,#ffff00,#000000,#990099,#993399,#996699,#999999,#99cc99,#99ff99,#cc0099,#cc3399,#cc6699,#cc9999,#cccc99,#ccff99,#ff0099,#ff3399,#ff6699,#ff9999,#ffcc99,#ffff99,#000000,#00ffff,#000000,#9900cc,#9933cc,#9966cc,#9999cc,#99cccc,#99ffcc,#cc00cc,#cc33cc,#cc66cc,#cc99cc,#cccccc,#ccffcc,#ff00cc,#ff33cc,#ff66cc,#ff99cc,#ffcccc,#ffffcc,#000000,#ff00ff,#000000,#9900ff,#9933ff,#9966ff,#9999ff,#99ccff,#99ffff,#cc00ff,#cc33ff,#cc66ff,#cc99ff,#ccccff,#ccffff,#ff00ff,#ff33ff,#ff66ff,#ff99ff,#ffccff,#ffffff".split(",");
	this.ShowTable = function(callBack,x,y){
		if(flag != 1){
			return;
		}
		if("function" != typeof(callBack)) return;
		this.Callback = callBack;
		document.getElementById(LayerID).style.display = "";
		document.getElementById(LayerID).style.top = parseInt(y,10);
		document.getElementById(LayerID).style.left = parseInt(x,10);
	}
	
	this.Init = function(){
		if(flag != (-1)){
			return;
		}
		if(window[this.Instance] != this){
			throw new Error(-1,"");
		}
		flag = 0;
	}
	this.SetColor = function(color){
		if(flag != 1){
			return;
		}
		this.Color = new String(color).toUpperCase();
		document.getElementById(PreviewCellID).style.backgroundColor = this.Color;
		document.getElementById(RGBID).innerHTML = this.Color;
	}
	
	this.Select =  function(color){
		if(flag != 1){
			return;
		}
		this.Color = new String(color).toUpperCase();
		if("function" == typeof(this.Callback))
			this.Callback(this.Color);
		this.Hide();
	}
	this.Draw = function(){
		if(flag == (-1)){
			this.Init();
		}
		if(flag != 0){
			return ;
		}
		var shtml = "";
		shtml += '<div id="' + LayerID + '" style="position:absolute;display:none;top:0px;left:0px;width:214px;height:145px;overflow:visible;border:0px;z-index:999999;">';
		shtml += this.GetTable();
		shtml += '</div>';
		
		document.write(shtml);
		flag = 1;
	}
	
	this.Hide = function(){
		if(flag != 1){
			return;
		}
		document.getElementById(LayerID).style.display = "none";
	}
	this.GetTable = function(){
		var shtml = '\
			<table width="214" onmousedown="event.cancelBubble=true;" height="145" border="0" cellpadding="0" cellspacing="0" style="border:solid 1px #000000">\n\
			<tr>\n\
				<td height="20" bgcolor="#D4D0C8" scope="col"><table width="100%" style="margin:2px;" border="0" cellspacing="0" cellpadding="0">\n\
				<tr>\n\
					<td width="24%" height="20" style="background-color:#ffffff;border:solid 1px #000000" scope="col" id="' + PreviewCellID + '">&nbsp;</td>\n\
					<td width="43%" height="20" scope="col"><div align="center" style="font-family:宋体;font-size:9pt;" id="' + RGBID + '"></div></td>\n\
					<td width="33%" height="20" scope="col"><div align="center"></div></td>\n\
				</tr>\n\
				</table></td>\n\
			</tr>\n\
			<tr>\n\
				<td>';
		shtml += '<table border="0" cellspacing="1" bgcolor="#000000">';
		shtml += '<tr height="10">';
		for(var i=0,l=Colors.length;i<l;i++){
			if(i%21 == 0){
				shtml += "</tr><tr>";
			}
			shtml += '<td height="10" width="10" bgcolor="' + Colors[i] + '" style="cursor:hand;" onmouseover="' + this.Instance + '.SetColor(bgColor)" onmousedown="' + this.Instance + '.Select(bgColor)"></td>';
		}
		shtml += '</table>';
		shtml += '	</td>\n\
					</tr>\n\
				</table>';
		return shtml;
	}
}