var website="http://www.57tuan.com/";var Cookie_Domain=".57tuan.com";var uname="";function initLoginResult(){jQuery.ajax({type:"GET",url:"login.do?method=getLoginInfo",dataType:"Text",cache:false,complete:function(d){var c=d.responseText;if(c!=null){if(c.indexOf("OK")!=-1){var e=c.split(":");jQuery("#cityName").html(e[1]);if(e.length==4){jQuery("#login_top_li").hide();jQuery("#register_top_li").hide();var a=e[2];uname=a;if(a.length>23){jQuery("#myinfo_top_btn").html("欢迎您,"+a.substring(0,20)+"...")}else{jQuery("#myinfo_top_btn").html("欢迎您,"+a)}jQuery("#messageCount").html("("+e[3]+")");jQuery("#messageCount").css({"font-weight:":"bold"});jQuery("#myinfo_top_li").show();jQuery("#message_top_li").show();jQuery("#quit_top_li").show();var b=decodeURI(jQuery.cookie("qiandao"));if(b!=null&&b.indexOf("_"+a)!=-1){jQuery("#qiandao").hide()}else{jQuery("#qiandao").show()}}}else{jQuery("#cityName").html("北京")}}else{alert("访问接口失败")}}})}function qiandao(){if(!isLogin()){go2Login()}else{var a=jQuery.cookie("qiandao");if(a==null||a.indexOf("_"+uname)==-1){jQuery.ajax({type:"GET",url:"user.do?method=qiandao",cache:false,dataType:"Text",complete:function(c){var b=c.responseText;if(b!=null){if(b.indexOf("OK")!=-1){alert("恭喜您签到成功!57团送您10个积分，请查收~~~");jQuery("#qiandao").hide()}else{if(b.indexOf("LOGIN")!=-1){go2Login()}else{if(b.indexOf("OVER")!=-1){alert("亲爱的用户"+uname+"：您今天已经签过到了，请明天再来签到吧~~~");jQuery("#qiandao").hide()}else{alert("签到过程中出现异常了，请稍后再试~~~")}}}}else{alert("访问签到接口失败")}}})}else{alert("亲爱的用户"+uname+"：您今天已经签过到了，请明天再来签到吧~~~");jQuery("#qiandao").hide()}}}function isLogin(){if(jQuery("#myinfo_top_btn").html()!=""){return true}else{return false}}function login(){window.location.href=website+"user/login.jsp?url="+escape(location.href)}function go2Login(){alert("您还没有登录哦~~~请先登录");window.location.href=website+"user/login.jsp?url="+escape(location.href)}function addFavorite(){try{window.external.addFavorite("http://www.57tuan.com/","57团购导航")}catch(a){try{window.sidebar.addPanel("57团购导航","http://www.57tuan.com/","")}catch(a){alert("加入收藏失败，请使用Ctrl+D进行添加")}}}function setHome(b,c){try{b.style.behavior="url(#default#homepage)";b.setHomePage(c)}catch(a){if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(a){alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。")}}}}function init(){initLoginResult()}function show_div(a){jQuery("#"+a).show()}function hid_div(a){jQuery("#"+a).hide()}function hasClass(c,b){var a;var d=b.className;a=new RegExp("(?:^|\\s+)"+c+"(?:\\s+|$)");return a.test(d)?1:0}function show_time_div(a){if(hasClass("row",jQuery("#cargo_list"))){return}a.className="onecargo cargo_hover"}function hid_time_div(a){if(hasClass("row",jQuery("#cargo_list"))){return}a.className="onecargo"}var tempRank="sale_rank";function changeRank(b,c){if(b.id==tempRank){return}else{var a=document.getElementById(c);b.style.color="#FFF";b.style.background="url() no-repeat scroll 6px 12px #65C3D9";a.style.color="#666";a.style.background="url() no-repeat scroll 6px 12px #F3FAFD";tempRank=b.id;show_div(tempRank+"_list");hid_div(c+"_list")}}function changeTab(b,a){jQuery("#"+b).removeClass("on");jQuery("#"+b+"Content").hide();jQuery("#"+a).addClass("on");jQuery("#"+a+"Content").show()}function getElementsByClassName(e,d){var f=null;if(d.parentObj){f=typeof d.parentObj=="string"?document.getElementById(d.parentObj):d.parentObj}var a=[],c=(f==null?document:f).getElementsByTagName(d.tagName||"*");for(var b=0;b<c.length;b++){if(c[b].className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))){a[a.length]=c[b]}}return a}function getTimeInfo(a){return{second:a%60,minute:Math.floor(a/60)%60,hour:Math.floor(a/3600)%24,day:Math.floor(a/86400)}}function updateDIV(a,c){if(c==null){var b="此团购已结束"}else{var b="<em>"+c.day+"</em>天<em>"+c.hour+"</em>小时<em>"+c.minute+"</em>分<em>"+c.second+"</em>秒"}a.html(b)}function updateTime(){var a=(new Date()).getTime();jQuery("span.time_div[alt]").each(function(){var b=Math.floor((parseInt(jQuery(this).attr("alt"))-a)/1000);if(b>=0){updateDIV(jQuery(this),getTimeInfo(b))}else{updateDIV(jQuery(this),null)}})}function changeToGridMode(){jQuery("#grid_button").attr("class","grid_button_on");jQuery("#row_button").attr("class","row_button_out");jQuery("#cargo_list").removeClass("row");jQuery("#cargo_list").addClass("grid");jQuery("#fourCargo_list").removeClass("row");jQuery("#fourCargo_list").addClass("grid");jQuery("#fourCargo_list").css("width","960px")}function changeToRowMode(){jQuery("#grid_button").attr("class","grid_button_out");jQuery("#row_button").attr("class","row_button_on");jQuery("#cargo_list").removeClass("grid");jQuery("#cargo_list").addClass("row");jQuery("#fourCargo_list").removeClass("grid");jQuery("#fourCargo_list").addClass("row");jQuery("#fourCargo_list").css("width","715px")}function addFavorites(c,a){var b=new Date();$.ajax({type:"GET",url:"favorite.do?method=addFavorite&id="+c+"&area="+a,dataType:"Text",cache:false,complete:function(e){var d=e.responseText;if(d!=null){if(d.indexOf("OK")!=-1){if($("#productFavNumber").length>0){$("#productFavNumber").html(parseInt($("#productFavNumber").html())+1)}alert("已经添加收藏夹")}else{alert(d)}}else{alert("访问接口失败")}}})}function changeBtnClassOn(a){document.getElementById(a).className="dayfenlei1_attach"}function changeBtnClassOut(a){var b="${categoryNamePinYin}";if(b+"_button"==a){return}document.getElementById(a).className="dayfenlei_link"}function goToSite(b,f,h,c){var d="site.do?method=outsite&id="+b;try{if(f){var a=jQuery("#myinfo_top_btn").html();if(a.length==0){jQuery("#inter_veil").show();jQuery("#fanli_sitename").html(h);jQuery("#fanli_fanli").html(c);jQuery("#fanli_sid").val(b);jQuery("#flboxshow").show()}else{window.open(d)}}else{window.open(d)}}catch(g){window.open(d)}}function goToTuan(b,h,g,c){var d="tuan.do?method=outtuan&id="+b;try{if(isFanLi){var a=jQuery("#myinfo_top_btn").html();if(a.length==0){jQuery("#inter_veil").show();jQuery("#fanli_sitename").html(g);jQuery("#fanli_fanli").html(c);jQuery("#fanli_sid").val(sid);jQuery("#flboxshow").show()}else{window.open(d)}}else{window.open(d)}}catch(f){window.open(d)}}function newSearchSubmit(){jQuery("#searchOrder").val(0);jQuery("#searchPageNo").val(1)}function getCategory(a){switch(a){case 1:return typeof(moreTuan_1)=="undefined"?[]:moreTuan_1;case 2:return typeof(moreTuan_2)=="undefined"?[]:moreTuan_2;case 3:return typeof(moreTuan_3)=="undefined"?[]:moreTuan_3;case 4:return typeof(moreTuan_4)=="undefined"?[]:moreTuan_4;case 5:return typeof(moreTuan_5)=="undefined"?[]:moreTuan_5;case 6:return typeof(moreTuan_6)=="undefined"?[]:moreTuan_6;default:return[]}}function showMoreTuan(d,c){var a="moretuan_"+d+"_content";var e="moretuan_"+d+"_tuancontent";var b=jQuery("#"+e).html();if(b==""){jQuery("#"+a).removeClass("moretuan");jQuery("#moretuan_"+d).html("点击关闭"+c+"个");jQuery("#tuan_template").tmpl(getCategory(d)).appendTo(jQuery("#"+e))}else{if(jQuery("#"+a).hasClass("moretuan")){jQuery("#moretuan_"+d).html("点击关闭"+c+"个");jQuery("#"+a).removeClass("moretuan")}else{jQuery("#moretuan_"+d).html("点击展开"+c+"个");jQuery("#"+a).addClass("moretuan")}}}function jubao(a,c,b){if(b!=0){window.location.href=website+"bbs.do?method=tojubao&sign="+a+"&id="+c+"&url="+escape(location.href)+"%23site_"+b}else{window.location.href=website+"bbs.do?method=tojubao&sign="+a+"&id="+c+"&url="+escape(location.href)}}function isCookieExist(a,b,d){var e=document.cookie.indexOf(a+"=");if(e==-1){return false}var c="请先休息一下，"+(d/60)+"分钟后，可以再次发帖！";if(b=="reply"){c="请先休息一下，"+d+"秒钟后，可以再次回复！"}else{if(b=="comment"){c="请先休息一下，"+d+"秒钟后，可以再次评论！"}else{if(b=="zhanneixin"){c="请先休息一下，"+(d/60)+"分钟后，再次发送站内信！"}}}showmessage(c);return true}function setTimeoutCookie(b,c){var a=new Date();a.setTime(a.getTime()+(c*1000));jQuery.cookie(b,b,{expires:a,path:"/"});return true}function showmessage(a){$("#show_message").html(a);$("#show_message").show()}function hideShowMessage(){$("#show_message").hide()};
