﻿function StrCode(str){if(encodeURIComponent) return encodeURIComponent(str);if(escape) return escape(str);}
function UnStrCode(str){if(decodeURIComponent ) return decodeURIComponent (str);if(unescape) return unescape(str);}
function Trim(s){var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);return (m == null)?"":m[1];}
function HtmlEncode(text){var re = {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'};for (i in re) text = text.replace(new RegExp(i,'g'), re[i]);return text;}
function HtmlDecode(text){var re = {'&lt;':'<','&gt;':'>','&amp;':'&','&quot;':'"'};for (i in re) text = text.replace(new RegExp(i,'g'), re[i]);return text;}
function gid(id){return document.getElementById?document.getElementById(id):null;}
function gna(id){return document.getElementsByName?document.getElementsByName(id):null;}
function gname(name){return document.getElementsByTagName?document.getElementsByTagName(name):new Array()}
var get_e_src = function(e){if(e) return e.target;if(window.event) return window.event.srcElement;return null;};
function addEvent(obj,evType,fn,useCapture ){if (obj.addEventListener){obj.addEventListener( evType, fn, useCapture );return true;}if (obj.attachEvent) return obj.attachEvent( "on" + evType, fn );alert( "Unable to add event listener for " + evType + " to " + obj.tagName );}
function Browser(){var ua, s, i;this.isIE = false;this.isNS = false;this.isOP = false;this.isSF = false;ua = navigator.userAgent.toLowerCase();s = "opera";if ((i = ua.indexOf(s)) >= 0){this.isOP = true;return;}s = "msie";if ((i = ua.indexOf(s)) >= 0) {this.isIE = true;return;}s = "netscape6/";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "gecko";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "safari";if ((i = ua.indexOf(s)) >= 0) {this.isSF = true;return;}}
function ClickButton(event, buttonid){var btnObj = gid(buttonid);if (btnObj){var e = (event||window.event);if (e.keyCode == 13){btnObj.click();return false;}}return true;}
function WarpClass(eID,tID,fID,ev){var eObj = document.getElementById(eID);var tObj = document.getElementById(tID);var fObj = document.getElementById(fID);if (eObj && tObj){if (!tObj.style.display || tObj.style.display == "block"){tObj.style.display = "none";eObj.className = "Warp";if (fObj) fObj.style.display = "none";}else{tObj.style.display = "block";eObj.className = "UnWarp";if (ev) eval(ev);if (fObj) fObj.style.display = "block";}}}

function mcl(show, div, btn, over, padd){var objdiv = gid(div);var objbtn = gid(btn);if (objdiv && objbtn){var browser = new Browser();if (show){objdiv.style.display = "block";if (browser.isIE && over){var allselect = gname("select");for (var i=0; i<allselect.length; i++){allselect[i].style.visibility = "hidden";}}objdiv.style.top = (objbtn.offsetTop + objbtn.offsetHeight - 2) + "px";objdiv.style.left = (objbtn.offsetLeft - (padd?0:50)) + "px";}else{objdiv.style.display = "none";if (browser.isIE && over){var allselect = gname("select");for (var i=0; i<allselect.length; i++){allselect[i].style.visibility = "visible";}}}}}
function Logout(){PostRequest(window.location.protocol + "//" + window.location.host + "/AJAX_Comm.aspx", "do=logout");}
function SelectTagGet(svalue,tvalue){if(svalue!=null){if(tvalue=="10")location.href = "/" + svalue + "/food";else if(tvalue=="20")location.href = "/" + svalue + "/shopping";else if(tvalue=="30")location.href = "/" + svalue + "/life";else if(tvalue=="40")location.href = "/" + svalue + "/service";else location.href = "/" + svalue + "/food";}}
function SearchClass(city, sel1, sel2, sel3){var sel1Obj = gid(sel1);var sel2Obj = gid(sel2);var sel3Obj = gid(sel3);if (sel1Obj && sel2Obj && sel3Obj){var sel1Value = sel1Obj.value;var sel2Value = sel2Obj.value;var sel3Value = sel3Obj.value;if (sel2Value == "0") sel2Value = "";if (sel3Value == "0"){sel3Value = "";} var SearchURL = "/search_m/" + city + "/" + sel1Value + "_" + sel2Value + sel3Value;TrackShop(1106);location.href=SearchURL;}}
function SearchKeyword(city, sel1, sel2){var sel1Obj = gid(sel1);var sel2Obj = gid(sel2);if (sel1Obj && sel2Obj){var sel1Value = sel1Obj.value;var sel2Value = sel2Obj.value;if (!sel2Value){alert("请输入搜索关键字!");sel2Obj.focus();return;}sel2Value = Trim(sel2Value);sel2Value = sel2Value.replace("%","");sel2Value = sel2Value.replace("\"","");var SearchURL = "/search_k/" + city + "/" + sel1Value + "_" + StrCode(sel2Value);location.href = SearchURL;}}

function InitRequest(){var C_req = null;try{C_req = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{C_req = new ActiveXObject("Microsoft.XMLHTTP");}catch(oc){C_req = null;}}if (!C_req && typeof XMLHttpRequest != "undefined"){try{C_req = new XMLHttpRequest();}catch(fa){alert("对不起!您的浏览器不支持该功能,请使用Internet Explorer 6.0或FireFox浏览器!");C_req = null;}}return C_req;}
function PostRequest(url, data){var AjaxRequestObj = InitRequest();if (AjaxRequestObj != null){AjaxRequestObj.onreadystatechange = function (){if (AjaxRequestObj.readyState == 4 && AjaxRequestObj.responseText){ProcessAjaxData(AjaxRequestObj.responseText);}};AjaxRequestObj.open("POST", url, true);AjaxRequestObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");AjaxRequestObj.send(data);}}
function ProcessAjaxData(data){eval(data);}
function ScreenConvert(){var browser = new Browser();var objScreen = gid("ScreenOver");if(!objScreen) var objScreen = document.createElement("div");var oS = objScreen.style;objScreen.id = "ScreenOver";oS.display = "block";oS.top = oS.left = oS.margin = oS.padding = "0px";if (document.body.clientHeight)	{var wh = document.body.clientHeight + "px";}else if (window.innerHeight){var wh = window.innerHeight + "px";}else{var wh = "100%";}oS.width = "100%";oS.height = wh;oS.position = "absolute";oS.zIndex = "3";if ((!browser.isSF) && (!browser.isOP)){oS.background = "#cccccc";}else{oS.background = "#cccccc";}oS.filter = "alpha(opacity=40)";oS.opacity = 40/100;oS.MozOpacity = 40/100;document.body.appendChild(objScreen);var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";}
function ScreenClean(){var objScreen = document.getElementById("ScreenOver");if (objScreen) objScreen.style.display = "none";var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";}
var t_DiglogX,t_DiglogY,t_DiglogW,t_DiglogH;
function DialogLoc(){var dde = document.documentElement;if (window.innerWidth){var ww = window.innerWidth;var wh = window.innerHeight;var bgX = window.pageXOffset;var bgY = window.pageYOffset;}else{var ww = dde.offsetWidth;var wh = dde.offsetHeight;var bgX = dde.scrollLeft;var bgY = dde.scrollTop;}t_DiglogX = (bgX + ((ww - t_DiglogW)/2));t_DiglogY = (bgY + ((wh - t_DiglogH)/2));}
function DialogShow(showdata,ow,oh,w,h){var objDialog = document.getElementById("DialogMove");if (!objDialog) objDialog = document.createElement("div");t_DiglogW = ow;t_DiglogH = oh;DialogLoc();objDialog.id = "DialogMove";var oS = objDialog.style;oS.display = "block";oS.top = t_DiglogY + "px";oS.left = t_DiglogX + "px";oS.margin = "0px";oS.padding = "0px";oS.width = w + "px";oS.height = h + "px";oS.position = "absolute";oS.zIndex = "5";oS.background = "#FFF";oS.border = "solid #000 3px";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}
function DialogShowPrompt(showdata,ow,oh,w,h){var objDialog = document.getElementById("DialogMove");if (!objDialog) objDialog = document.createElement("div");t_DiglogW = ow;t_DiglogH = oh;DialogLoc();objDialog.id = "DialogMove";var oS = objDialog.style;oS.display = "block";oS.top = t_DiglogY + "px";oS.left = t_DiglogX + "px";oS.margin = "0px";oS.padding = "0px";oS.width = w + "px";oS.height = h + "px";oS.position = "absolute";oS.zIndex = "5";oS.background = "#FFF";oS.border = "solid #000 1px";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}
function DialogShowProductPrompt(showdata,ow,oh,w,h){var objDialog = document.getElementById("DialogMove");if (!objDialog) objDialog = document.createElement("div");t_DiglogW = ow;t_DiglogH = oh;objDialog.id = "DialogMove";var oS = objDialog.style;oS.display = "block";oS.top = oh + "px";oS.left = ow + "px";oS.margin = "0px";oS.padding = "0px";oS.width = w + "px";oS.height = h + "px";oS.position = "absolute";oS.zIndex = "5";oS.background = "#FFF";oS.border = "solid #000 1px";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}
function DialogHide(){ScreenClean();var objDialog = document.getElementById("DialogMove");if (objDialog) objDialog.style.display = "none";}


function Track(id){var PostData = "do=track&id=" + id;PostRequest(window.location.protocol + "//" + window.location.host + "/AJAX_Comm.aspx", PostData);}
function TrackShop(id){var strhref=window.location.href;if((strhref.indexOf('shop')>-1)&&(strhref.indexOf('info')==-1)&&(strhref.indexOf('new')==-1)&&(strhref.indexOf('photos')==-1)&&(strhref.indexOf('review')==-1)&&(strhref.indexOf('wishlist')==-1)&&(strhref.indexOf('website')==-1)&&(strhref.indexOf('map')==-1)&&(strhref.indexOf('edit')==-1)&&(strhref.indexOf('upload')==-1))Track(id);}
function HeadSearch(cityid,shoptype){var objKeyword = gid("HeadKeyword");if(objKeyword!=null){if(objKeyword.value.length==0){objKeyword.focus();alert("请输入关键字！");}else{self.location = "/search_k/" + cityid + "/" + shoptype + "_" + StrCode(objKeyword.value);}}}
function GroupSearch(){var objKeyword = gid("HeadKeyword");if(objKeyword!=null){if(objKeyword.value.length==0){objKeyword.focus();alert("请输入关键字！");}else{self.location = "/group/allgroups/" + StrCode(objKeyword.value);}}}
function GroupNoteSearch(){var objKeyword = gid("HeadKeyword");if(objKeyword!=null){if(objKeyword.value.length==0){objKeyword.focus();alert("请输入关键字！");}else{self.location = "/group/alltopics/" + StrCode(objKeyword.value);}}}
function InfoSearch(EnCityName){var objKeyword = gid("HeadKeyword");if(objKeyword!=null){if(objKeyword.value.length==0){objKeyword.focus();alert("请输入关键字！");}else{self.location = "/" + EnCityName + "/info/" + StrCode(objKeyword.value);}}}

function NeedLogin(Title){ScreenConvert();var AJAX_LoginBody="<div id=\"DialogTitle\"><div id=\"DialogTitleText\">" + Title + "</div><div id=\"DialogTitleBtn\" onclick=\"return DialogHide();\" onmouseover=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #000000';\" onmouseout=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #EEE';\"></div></div><div id=\"DialogContent\">" + Title + "，请先登录或免费注册！</div><div id=\"DialogValidator\"></div><div id=\"DialogButtons\"><button id=\"AjaxMainLogin\" onclick=\"location.replace('/login/" + Title + "，请先登录?redir=" + StrCode(window.location.pathname) + "');\">立即登录</button>&nbsp;&nbsp;&nbsp;&nbsp;<button id=\"AjaxMainReg\" onclick=\"location.replace('/reg/" + Title + "，请先注册?redir=" + StrCode(window.location.pathname) + "');\">免费注册</button>&nbsp;&nbsp;&nbsp;&nbsp;<button id=\"AjaxMainCancle\" onclick=\"return DialogHide();\">取消</button></div>";DialogShow(AJAX_LoginBody,250,120,300,150);}
function DelForm(content)
{
    if(content.indexOf('<form')>-1)
    {
        content=content.replace('</form>','');
        content=content.substring(content.indexOf('>',content.indexOf('<form')+1)+1);
     }
    return content;
}
/*
//gb2312TOutf-8
//function utf8(wide) {
//var c, s;
//var enc = "";
//var i = 0;
//while(i<wide.length) {
//c= wide.charCodeAt(i++);
//// handle UTF-16 surrogates
//if (c>=0xDC00 && c<0xE000) continue;
//if (c>=0xD800 && c<0xDC00) {
//if (i>=wide.length) continue;
//s= wide.charCodeAt(i++);
//if (s<0xDC00 || c>=0xDE00) continue;
//c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
//}
//// output value
//if (c<0x80) enc += String.fromCharCode(c);
//else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
//else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
//else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
//}
//return enc;
//}

//var hexchars = "0123456789ABCDEF";
//function toHex(n) {
//return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF);
//}
//var okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
//function encodeURIComponentNew(s) {
//var s = utf8(s);
//var c;
//var enc = "";
//for (var i= 0; i<s.length; i++) {
//if (okURIchars.indexOf(s.charAt(i))==-1)
//enc += "%"+toHex(s.charCodeAt(i));
//else
//enc += s.charAt(i);
//}
//return enc;
//}
//function gb2utf8(fld)
//{
//if (fld == "") return false;
//var encodedField = "";
//var s = fld;
//if (typeof encodeURIComponent == "function")
//{
//// Use javascript built-in function
//// IE 5.5+ and Netscape 6+ and Mozilla
//encodedField = encodeURIComponent(s);
//}
//else 
//{
//// Need to mimic the javascript version
//// Netscape 4 and IE 4 and IE 5.0
//encodedField = encodeURIComponentNew(s);
//}
////alert ("New encoding: " + encodeURIComponentNew(fld) +
//// "\n escape(): " + escape(fld));
//return encodedField;
//}

// function genCodeStr(){
//    var codeRE = new RegExp("'(.*)' : '(.*)'","gi");
//    var tempStr,codeStr = "";
//    var myReader = new Reader();
//     myReader.loadFile('gb2312_utf.txt');//这里改成你的对照表存放的路径
//    while(!myReader.fStream.atEndofLine) {
//        tempStr = new String(myReader.fStream.readLine());
//        codeStr += tempStr.replace(codeRE,"$1") + ":" + tempStr.replace(codeRE,"$2") + ":";
//    }
//    Application("codeData") = codeStr;
//   
//}
//function getCodeStr(){
//    var codeStr = new String(Application("codeData"));
//    if(codeStr.indexOf("%a1%a1") == -1){
//        genCodeStr();
//    }
//    return new String(Application("codeData"));
//}
//function gb2utf(gbStr){
//    var codeStr = getCodeStr();
//    var codeRE = new RegExp("(%..%..)","gi");
//    var replaceRE = new RegExp("(%..%..)","i");
//    var gbCode;
//    var utfCode;
//    var gbStart;
//    while((codeRE.lastIndex < gbStr.length) && replaceRE.test(gbStr)){
//        codeRE.exec(gbStr);
//        gbCode = new String(RegExp.$1);
//        gbStart = new Number(codeStr.indexOf(gbCode.toLowerCase()));
//        var utfStart = 0;
//        if(gbStart != -1){
//            utfStart= gbStart + 7;
//            utfCode = codeStr.substring(utfStart,utfStart + 6);
//        }else{
//            utfCode = "%u3000";
//        }
//        gbStr = gbStr.replace(replaceRE,utfCode);
//    }
//    return gbStr;
//}

//function Reader() {                        //Class        Reader()
//    this.fso;                            //Private    fso
//    this.fUri;                            //Private    fUri
//    this.fStream;                        //Private    fStream
//    try{
//        this.fso = new ActiveXObject("Scripting.FileSystemObject");
//    }catch(exception) {
//        throw exception;
//    }
//    this.loadFile = function(file) {        //Public        loadFile(file)
//            this.fUri = Server.mappath(file);
//            //var fStream = fso.CreateTextFile(tfolder,true,false);
//            //fStream.WriteLine('test');
//            if(this.fso.fileExists(this.fUri)){
//                this.fStream = this.fso.openTextFile(this.fUri);
//            }else{
//                Response.write('file dos not exist');
//            }
//    }
//    this.readLineN = function(num) {
//        var i = 1;
//        while(i < num && !this.fStream.atEndOfLine) {
//            this.fStream.skipLine();
//            i++
//        }
//        return this.fStream.readLine();
//    }
//    this.closeFile = function() {
//        fStream.Close();
//        fso.Close;
//    }
//} 
*/

    function aa()
    {
         alert('aa');
         alert(temp);
         document.write(temp);
    }