//Code For FCKEditorfunction Text2Html(text) { 	if ( typeof( text ) != "string" )		text = text.toString() ;	text = text.replace(/\r\n/g,"<br>");	text = text.replace(/\n/g,"<br>");	return text;}function Html2Text(text) { 	if ( typeof( text ) != "string" )		text = text.toString() ;	text = text.replace(/\r\n/g,"");	text = text.replace(/\n/g,"");	text = text.replace(/<BR>/g,"\n");	text = text.replace(/<BR>/g,"\n");	text = text.replace(/<BR \/>/g,"\n");	text = text.replace(/<br>/g,"\n");	text = text.replace(/<br \/>/g,"\n");	text = text.replace(/<br\/>/g,"\n");	text = text.replace(/&quot;/g, "\"");	text = text.replace(/&lt;/g, "<");	text = text.replace(/&gt;/g, ">");	text = text.replace(/&#39;/g, "'");	text = text.replace(/&amp;/g, "&") ;	text = text.replace(/&nbsp;/g, " ") ;	text = text.replace(/&ldquo;/g, "“") ;	text = text.replace(/&rdquo;/g, "”") ;	return text;}function encodeTextArea(instanceName) {	if (document.getElementById(instanceName).style.display == "block")	{		document.getElementById(instanceName).value = Text2Html(document.getElementById(instanceName).value);	}	//document.getElementById('topicsubmit').disabled = true;	return true;}function switchEditMode(instanceName,switcher) {	if (document.getElementById(instanceName + '___Frame').style.visibility == "hidden") {		var sAgent = navigator.userAgent.toLowerCase() ;		// Internet Explorer		if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )	{			var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;			var isCompatible = ( sBrowserVersion >= 5.5 ) ;		} else if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 && !( typeof(opera) == 'object' && opera.postError ) ) {			// Gecko (Opera 9 tries to behave like Gecko at this point).			var isCompatible = true;		}		if (!isCompatible) {			alert("Sorry,Please Use FireFox Or Internet Explorer 5 or above!");		} else {			document.getElementById(instanceName + '___Frame').style.visibility = "visible";			document.getElementById(instanceName + '___Frame').style.display = "block";			document.getElementById(instanceName).value = Text2Html(document.getElementById(instanceName).value);			document.getElementById(instanceName).style.display = "none";			document.getElementById(instanceName + '___Frame').src = "/fckeditor/editor/fckeditor.html?InstanceName=" + instanceName + "&Toolbar=Simple";			document.getElementById(switcher).value="返回文本编辑框";			//document.getElementById(switcher).disabled=true;		}	} else {		document.getElementById(instanceName + '___Frame').src = "about:blank";		document.getElementById(instanceName + '___Frame').style.visibility = "hidden";		document.getElementById(instanceName + '___Frame').style.display = "none";		document.getElementById(instanceName).style.display = "block";		var oEditor = FCKeditorAPI.GetInstance(instanceName) ;		// Get the editor contents in XHTML. "true" means you want it formatted.		document.getElementById(instanceName).value = Html2Text(oEditor.GetXHTML( false ));		document.getElementById(switcher).value="显示高级编辑器";		//document.getElementById(instanceName).focus();	}}function SubmitTextarea(instanceName) {	if (document.getElementById(instanceName + '___Frame').style.visibility == "visible") {		var oEditor = FCKeditorAPI.GetInstance(instanceName) ;		document.getElementById(instanceName).value = Html2Text(oEditor.GetXHTML( false ));	}	document.getElementById(instanceName).value = Text2Html(document.getElementById(instanceName).value);}//图片自动调整的模式，1为按比例调整 ，2 按大小调整。var resizemode=2function imgresize(o){	if (resizemode==2 || o.onmousewheel){		if(o.width > 500 ){			o.style.width='500px';		}		if(o.height > 800){			o.style.height='800px';		}	}else{		var parentNode=o.parentNode.parentNode;		if (parentNode){			if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';		}else{			var parentNode=o.parentNode			if (parentNode){				if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';			}		}	}}//Code For Form in Edit Modefunction InitInput(theObj,theValue) {	theObj.value = theValue;}function InitSelect(theObj,theValue) {	/*第一种方式*///	theObj = document.getElementById(instanceName);	for(i=0;i<theObj.options.length;i++) {		if(theObj.options[i].value == theValue) {			theObj.options[i].selected = true;		}	}	/*第二种方式*/	//theObj.value = theValue;}function InitRadio(theObj,theValue) {	for(i=0;i<theObj.length;i++) {		if(theObj[i].value == theValue) {			theObj[i].checked = true;			break;		}	}}function InitCheckbox(theObj,theValue) {	var checklist=eval("theValue.split(',')"); 	for(i=0; i<theObj.length; i++) {				theObj[i].checked=false;		for(j=0; j<checklist.length; j++) {					if (theObj[i].value==checklist[j]) {				theObj[i].checked=true;				break;			}		}	}}function InitTextarea(theObj,theValue) {	theObj.value = HtmlToText(theValue);}function SubmitCheckbox(theObj,theObj2, border) {	//form1.elements['season[]']	var str = "";	for(i=0; i<theObj.length; i++) {				if (theObj[i].checked==true) {			str = str + theObj[i].value + ",";		}	}	if (border==1) {		theObj2.value = "," + str;	} else {		theObj2.value = str.substr(0,(str.length-1));	}}//两层级联菜单用function ListChild(obj_parent,obj_child,value_child) {	obj_child.selectedIndex = 0;	for (var i=obj_child.options.length-1; i >= 0; i--) {		obj_child.options[i] = null;	}	for (var i=0; i<posi.length; i++) {		if (posi[i][1] == obj_parent.options[obj_parent.selectedIndex].value) {			var namelist = posi[i][2].split(',');			var codelist = posi[i][3].split(',');			break;		}	}		obj_child.options.length = codelist.length;	for(var j=0; j<codelist.length; j++) {		obj_child.options[j].value = codelist[j];		obj_child.options[j].text = namelist[j];		if(codelist[j]==value_child) {			obj_child.selectedIndex = j;		}	}}function ListParent(obj_parent,value_parent) {	obj_parent.options.length = posi.length;	for(var i=0; i<posi.length; i++) {		obj_parent.options[i].value = posi[i][1];		obj_parent.options[i].text = posi[i][0];		if (posi[i][1] == value_parent) {			obj_parent.selectedIndex = i;		}	}}function InitUnion(obj_parent,obj_child,value_parent,value_child) {	ListParent(obj_parent,value_parent);	ListChild(obj_parent,obj_child,value_child);}//email verifyfunction checkemail(data, allowednull){  var datastr = data;  var lefttrim = datastr.search(/\S/gi);    if (lefttrim == -1) {    if (allowednull) {      return 1;    } else {      alert("请输入一个正确的E-mail地址！");      return -1;    }  }  var myRegExp = /[a-z0-9](([a-z0-9]|[_\-\.][a-z0-9])*)@([a-z0-9]([a-z0-9]|[_\-][a-z0-9])*)((\.[a-z0-9]([a-z0-9]|[_\-][a-z0-9])*)*)/gi;  var answerind = datastr.search(myRegExp);  var answerarr = datastr.match(myRegExp);    if (answerind == 0 && answerarr[0].length == datastr.length)  {    return 0;  }    alert("请输入一个正确的E-mail地址！");  return -1;}function switchCell(n) {	nc=document.getElementsByName("navcell");	if(nc){		t=document.getElementsByName("tb")		for(i=0;i<nc.length;i++){			nc.item(i).className="tab-off";			t.item(i).className="hide-table";		}		nc.item(n-1).className="tab-on";		t.item(n-1).className="tab-content show-table";	}else if(navcell){		for(i=0;i<navcell.length;i++){			navcell[i].className="tab-off";			tb[i].className="hide-table";		}		navcell[n-1].className="tab-on";		tb[n-1].className="tab-content show-table";	}}function processSearch() {	theform=document.getElementById("searchform");	if (theform.keyword.value == '') {		alert('请输入关键字！');		theform.keyword.focus();	} else {		if (theform.searchtype.value == 'article') {			theform.action="/article/search.php";			theform.target="_self";			theform.submit();		}		if (theform.searchtype.value == 'album') {			theform.search.value=theform.keyword.value;			theform.album.value="search";			theform.type.value="full";			theform.action="/album/thumbnails.php";			theform.target="_self";			theform.submit();		}		if (theform.searchtype.value == 'sitesearch') {			theform.q.value=theform.keyword.value;			theform.action="http://www.google.cn/search";			theform.target="_blank";			theform.submit();		}	}}function showHide(objname) {	var obj = document.getElementById(objname);	if(obj.style.display=="none") {		obj.style.display = "block";	} else {		obj.style.display="none";	}}//多Tab页面处理function setTab(area,id) {	var tabArea=document.getElementById(area);	var contents=tabArea.childNodes;	for(i=0; i<contents.length; i++) {		if(contents[i].className=='tabcontent'){contents[i].style.display='none';}	}	document.getElementById(id).style.display='';	var tabs=document.getElementById(area+'tabs').getElementsByTagName('span');	for(i=0; i<tabs.length; i++) { tabs[i].className=''; }	document.getElementById(id+'tab').className='active';}function nocopy() {    var str=document.selection.createRange().text;    //取得选中的内容    var content=document.body.innerHTML;        //取得全部内容    clipboardData.setData('text',str);            //复制选中内容    document.body.innerHTML=content.replace(str,"");    //将选中的内容替换掉}(function() {	window.clk=function(id){		if(document.images){			(new Image).src="http://www.withbike.com/net/index.php?id="+id;		}		return true	};})();