function fValue(obj){if(obj.value==""){obj.focus();return false;}else{return true;}}function fEmail(obj){var pattern=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
if(obj.value!=""&&!(pattern.exec(obj.value))){obj.focus();return false;}else{return true;}};function fNum(obj){var pattern=/^\d+$/;if(obj.value!=""&&!(pattern.exec(obj.value))){obj.focus();return false;}else{return true;}}function fUrl(obj){var pattern=/((http|ftp):\/\/)(((([\d]+\.)+){3}[\d]+(\/[\w.\/]+)?)|([a-z]\w*((\.\w+)+){2,})([\/][\w.~]*)*)/;if(obj.value!=""&&!(pattern.exec(obj.value))){obj.focus();return false;}else{return true;}};function fConfirm(url){if(confirm("确定删除，不可恢复。")){self.location=url;}}function fLogin(oForm){if(!fValue(oForm.username)){alert("请输入用户名");return false;}if(!fValue(oForm.password)){alert("请输入密码");return false;}return true;}function fSetToolBar(sType){var oToolBar=document.getElementById("toolbarDiv");var oDiv1=null;var oDiv2=null;if(sType=="hide"){oDiv1=document.getElementById("hideToolbarDiv");oDiv2=document.getElementById("showToolbarDiv");oToolBar.style.display="none";oDiv1.style.display="none";oDiv2.style.display="block";}else{oDiv1=document.getElementById("showToolbarDiv");oDiv2=document.getElementById("hideToolbarDiv");oToolBar.style.display="block";oDiv1.style.display="none";oDiv2.style.display="block";}}function fSetContent(sId){var oDiv=document.getElementById(sId);var sHtml=oDiv.innerHTML;var nPage=fGetQuery("page");var sPageHtml="";if(sHtml.indexOf("$page$")>-1){aHtml=sHtml.split("$page$");if(!nPage){nPage=0;}if(!(nPage<aHtml.length&&nPage>-1)){nPage=0;}sPageHtml+='<p align="center">';if(nPage>0){sPageHtml+='<a href="'+fResetUrl(nPage-1)+'">上页</a>&nbsp;&nbsp;';}for(var i=0;i<aHtml.length;i++){var sCount=(i-0+1);if(i==nPage){sCount='<b>'+sCount+'</b>';}sPageHtml+='<a href="'+fResetUrl(i)+'">'+sCount+'</a>&nbsp;&nbsp;';}if(nPage<aHtml.length-1){sPageHtml+='<a href="'+fResetUrl(nPage-0+1)+'">下页</a>';}sPageHtml+='</p>';oDiv.innerHTML=aHtml[nPage]+sPageHtml;}oDiv.style.display="";function fResetUrl(num){var sUrl="";var sPage="page="+num;var sLocation=location.href;var re=/page=[\d]+/gi;
if(location.search.indexOf("page=")>-1){sUrl=sLocation.replace(re,sPage);}else{sUrl=sLocation+(sLocation.indexOf("?")==-1?"?"+sPage:"&"+sPage);};return sUrl;}};function fGetCookie(sName){var retValue;if(window.document.cookie==""){return "";}var cookieTemp=window.document.cookie;if(cookieTemp.indexOf(sName+";")>-1){return "";}var firstChar,laseChar;firstChar=cookieTemp.indexOf(sName+"=");var flag=false;if(firstChar==0){flag=true;}else{firstChar=cookieTemp.indexOf("; "+sName+"=");if(firstChar!=-1){flag=true;}};if(flag){if(firstChar==0){firstChar+=sName.length+1;}else{firstChar+=sName.length+3;};laseChar=cookieTemp.indexOf(";",firstChar);if(laseChar==-1){laseChar=cookieTemp.length;}retValue=cookieTemp.substring(firstChar,laseChar);return retValue;}else{return "";}}function fSetCookie(sName,sValue,sDomain,sPath,sDays){var oExDate=new Date();oExDate.setTime(oExDate.getTime()+sDays*24*60*60*1000);sName=sName+"="+sValue;sDomain=(typeof sDomain=="undefined"||sDomain=="")?"":";domain="+sDomain;sPath=(typeof sPath=="undefined"||sPath=="")?"":";path="+sPath;sDays=(typeof sDays=="undefined"||sDays==""||sDays==0)?"":";expires="+oExDate.toGMTString();window.document.cookie=sName+sDays+sPath+sDomain;}function fSetImageSize(oImg,iwidth,iheight,fixChanged){var oTmp=new Image();oTmp.src=oImg.src;if(!fixChanged&&(oTmp.width>oImg.width||oTmp.height>oImg.height)){return;}if(iwidth==0){var width=oTmp.width;}else{var width=iwidth;};if(iheight==0){var height=oTmp.height;}else{var height=iheight;};var p=(oTmp.height-0)/(oTmp.width-0);var h=width*p;var w=height/p;if(w>width){oImg.style.width=width+"px";oImg.style.height=Math.round(h)+"px";}if(h>height){oImg.style.width=Math.round(w)+"px";oImg.style.height=height+"px";}}function fResetAllImage(){var aList=document.getElementsByTagName("IMG");for(var i=0,m=aList.length;i<m;i++){if(!aList[i].onload){fSetImageSize(aList[i],500,0);}}}fAddObserve(window,"load",fResetAllImage,true);function fAddObserve(oElement,name,observer,useCapture){useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||oElement.attachEvent)){name='keydown';}if(oElement.addEventListener){oElement.addEventListener(name,observer,useCapture);}else if(oElement.attachEvent){oElement.attachEvent('on'+name,observer);}}function fDeleteObserve(oElement,name,observer,useCapture){useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||oElement.detachEvent)){name='keydown';}if(oElement.removeEventListener){oElement.removeEventListener(name,observer,useCapture);}else if(oElement.detachEvent){oElement.detachEvent('on'+name,observer);}}function fGetQuery(id){var sQuery=location.search;var sValue="";if(!sQuery){return sValue;}sQuery=sQuery.substring(1,sQuery.length);var aList=sQuery.split("&");for(var i=0;i<aList.length;i++){if(aList[i].indexOf(id+"=")==0){sValue=aList[i].replace(id+"=","");if(!sValue){sValue="";}break;}}return sValue;}function fReLoad(){try{var sLocation=window.location.toString();var sDomain=document.domain;var sUrl="";var isChange=false;var arr=[["style","fashion"],["forum","bbs"],["lift","car"]];if(sDomain.indexOf("chengtu.com")>-1){for(var i=0;i<arr.length;i++){if(sDomain.indexOf(arr[i][0])>-1){sUrl=sLocation.replace("http://"+arr[i][0],"http://"+arr[i][1]);isChange=true;break;}else if(sDomain.indexOf(arr[i][1])>-1){break;}}}else if(sDomain.indexOf("chengtu.net")==-1&&sDomain.indexOf("localhost")==-1){sUrl="http://www.chengtu.com/"+sLocation.replace("http://"+sDomain+"/","");isChange=true;}if(isChange){window.location=sUrl;}}catch(e){}}fReLoad();