﻿
(function(d){d.fn.floatUp=function(a){a=d.extend({},a||{});return this.each(function(){$this=d(this);var c=$this.height();$this.css({height:0,opacity:0});$this.show();var b=$this.position().top;XDTOOL.empty($this.data("top"))?$this.data("top",b):(b=$this.data("top"),$this.css("top",b));$this.animate({height:c+"px",top:b-c+"px",opacity:"1"},a.time||1E3)})};d.fn.floatDown=function(a){a=d.extend({},a||{});return this.each(function(){$this=d(this);var c=$this.height(),b=$this.position().top;XDTOOL.empty($this.data("top"))?$this.data("top",b):(b=$this.data("top"),$this.css("top",b));$this.animate({height:"0px",top:b+c+"px",opacity:"0"},a.time||1E3,function(){$this.remove()})})};XD={FX_Item_Array:{},FX_Item_Id_Array:{},FX_Images_Array:"",FX_Shop_Array:"",Globe_Textarea_Auto_Height:function(a){var c=a.height(),b=function(){c<0&&(c=a.height());(d.browser.mozilla||d.browser.safari)&&a.height(c);var b=a[0].scrollHeight,e=b<c?c:b,e=e<c*1.5?c:b;a.height(e)};a.bind("keyup",b).bind("input",b).bind("propertychange",b).bind("focus",b)},Globe_Item_URL_Support:function(a){var c=/tmall.com/i,b=/auction\d?.paipai.com/i,g=/buy.caomeipai.com\/goods/i,d=/www.360buy.com\/product/i,f=/product.dangdang.com\/Product.aspx\?product_id=/i,h=/book.360buy.com/i,i=/www.vancl.com\/StyleDetail/i,j=/www.vancl.com\/Product/i,k=/vt.vancl.com\/item/i,l=/item.vancl.com\/\d+/i,m=/mbaobao.com\/pshow/i,n=/[www|us].topshop.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay/i,o=/quwan.com\/goods/i,p=/nala.com.cn\/product/i,q=/maymay.cn\/pitem/i;return/item(.lp)?.taobao.com\/(.?)[item.htm|item_num_id|item_detail|itemID|item_id|default_item_id]/i.test(a)||c.test(a)||h.test(a)||d.test(a)||b.test(a)||g.test(a)||f.test(a)||i.test(a)||j.test(a)||k.test(a)||l.test(a)||m.test(a)||n.test(a)||o.test(a)||p.test(a)||q.test(a)},Globe_Input_Text:function(a,c){c=c||a.val();a.focus(function(){XDTOOL.trim(a.val())==c&&a.val("");a.css("color","#000")});a.blur(function(){XDTOOL.trim(a.val())==""&&(a.val(c),a.css("color","#999"))})},FX_Word_Count:function(a,c){if(d("#"+a)[0]){var b=function(){var b=0,b=c?XDTOOL.getMsgLength(d("#"+c).val()):XDTOOL.getMsgLength(d("#"+
a).find(".pub_txt").val()),e=140-b;b==0?d("#"+a).find(".word_count").html("140"):(d("#"+a).find(".word_count").html(e),b>140?d("#"+a).find(".word_count").addClass("out"):d("#"+a).find(".word_count").removeClass("out"))};b();c?d("#"+c).bind("keyup",b).bind("input",b).bind("propertychange",b):d("#"+a).find(".pub_txt").bind("keyup",b).bind("input",b).bind("propertychange",b)}},Globe_Check_Login:function(){if(XDPROFILE.uid=="")return XD.user_handsome_login_init(),XD.user_handsome_login(),false;return true},Globe_Short_Link_From:function(){d(".mg_slink").live("click",function(){var a=this,c=a.href,b=d(a).attr("s"),g=d(a).attr("c");if(g=="")g=XDPROFILE.userid;var e=c,f="",f=c.indexOf("?")==-1?"?c="+g+"&s="+b:"&c="+g+"&s="+b;e+=f;a.href=e;setTimeout(function(){a.href=c},500)})},Globe_Bind_Keybord_Submit:function(a,c,b){b=b||"need_focus";b=="need_focus"&&(a.focus(function(){d("body").unbind("keydown");d("body").bind("keydown",function(a){a.ctrlKey&&a.keyCode==13&&c.click()})}),a.blur(function(){d("body").unbind("keydown")}));b=="not_need_focus"&&d(document).bind("keydown",function(a){a.ctrlKey&&a.keyCode==13&&(c.click(),d("body").unbind("keydown"))})}};XDTOOL={distance2Bottom:function(a){var c=d(document).scrollTop(),b=d(window).height(),g=d(document).height();return c+b+a>=g?!0:!1},trim:function(a){return a.replace(/(^\s*)|(\s*$)/g,"").replace(/(^\u3000*)|(\u3000*$)/g,"")},isURl:function(a){return/([\w-]+\.)+[\w-]+.([^a-z])(\/[\w-.\/?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(\/[\w-.\/?%&=]*)?/i.test(a)?!0:!1},byteLength:function(a){var c=a.match(/[^\x00-\x80]/g);return a.length+(!c?0:c.length)},getMsgLength:function(a){var c=a.length;if(c>0){for(var b=a,a=a.match(/http[s]?:\/\/[a-zA-Z0-9-]+(\.[a-zA-Z0-9]+)+([-A-Z0-9a-z_\$\.\+\!\*\(\)\/\/,:;@&=\?\~\#\%]*)/gi)||[],d=0,e=0,c=a.length;e<c;e++){var f=XDTOOL.byteLength(a[e]);/^(http:\/\/weirang.com)/.test(a[e])||(d+=/^(http:\/\/)+(weirang.net|weirang.com)/.test(a[e])?f<=41?f:f<=140?24:f-140+24:f<=140?24:f-140+24,b=b.replace(a[e],""));}
return Math.ceil((d+XDTOOL.byteLength(b))/2);}else return 0},jsMbSubstr:function(a,c){if(!a||!c)return"";for(var b=0,d=0,e="",d=0;d<a.length;d++){a.charCodeAt(d)>255?b+=2:b++;if(b>c*2)return e;e+=a.charAt(d)}
return a},getAbsoluteLocation:function(a){if(arguments.length!=1||a==null)return null;var c=d(a),b=c.offset(),g=b.top,b=b.left,c=c.height(),e=d(window).height(),f=d(document).scrollTop();return{absoluteTop:g,absoluteLeft:b,isInView:g>=f&&g<=f+e,isLoad:g+c+200>=f&&g-400<=f+e}},objToJson:function(a){var c="{",b;for(b in a)a[b]!=null&&(c+=typeof a[b]==="object"?'"'+b+'":'+XDTOOL.objToJson(a[b])+",":'"'+b+'":"'+a[b]+'",');c+="}";return c=c.replace(/,}/g,"}")},getPicExtension:function(a){return a.toLowerCase().substring(a.lastIndexOf(".")+1)},empty:function(a){return void 0===a||null===a||""===a},emptyObj:function(a){for(var c in a)return!1;return!0},isParent:function(a,c){for(;a!=void 0&&a!=null&&a.tagName.toUpperCase()!="BODY";){if(a==c)return!0;a=a.parentNode}
return!1},setCookie:function(a,c,b){b=b||{};if(c===null)c="",b.expires=-1;var d="";if(b.expires&&(typeof b.expires=="number"||b.expires.toUTCString))typeof b.expires=="number"?(d=new Date,d.setTime(d.getTime()+b.expires*864E5)):d=b.expires,d="; expires="+d.toUTCString();var e=b.path?"; path="+b.path:"",f=b.secure?"; secure":"",h="";null!=b.domain||void 0!=b.domain?h="; domain="+b.domain:(h=document.domain.toString().split("."),h="; domain=."+h[1]+"."+h[2]);document.cookie=[a,"=",encodeURIComponent(c),d,e,h,f].join("")},getCookie:function(a){a=document.cookie.match(RegExp("(^| )"+a+"=([^;]*)(;|$)"));if(a!=null)return unescape(a[2]);return""},getMousePosition:function(a){var c=0,b=0;if(!a)a=window.event;if(a.pageX||a.pageY)c=a.pageX,b=a.pageY;else if(a.clientX||a.clientY)c=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,b=a.clientY+document.body.scrollTop+document.documentElement.scrollTop;return{x:c,y:b}},getQueryString:function(a){if(RegExp("(^|\\?|&)"+a+"=([^&]*)(\\s|&|$)","i").test(location.href))return unescape(RegExp.$2.replace(/\+/g," "));return""},isIOS:function(){return/\((iPhone|iPad|iPod)/i.test(navigator.userAgent)}};XDLANG={msgTimeout:"网络连接超时",msgNologin:"您尚未登录"};XDTEMPLATE={lightBox:'<div id="{id}" class="alert_bg"><div class="alert_box"><div class="alert_top"><span>{title}</span><a href="javascript:;" class="alert_close"></a></div><div class="alert_content">{body}</div></div></div>',lightBoxLoading:'',addPicUp:'',picFeed:'',picFeedFashionElement:'',itemFeed:'',addItemStart:'',addItemResult:'',addShopUp:'',addFollow:'',uInfoTip:''};XDFACE={faceTab:'',facePage:{f1:''}};})(jQuery);$(function(){if($.browser.msie&&$.browser.version=="6.0"){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}
var u=XDTOOL.getQueryString("u");u!=""&&XDTOOL.getCookie("fromuid")==""&&XDTOOL.setCookie("fromuid",u,{expires:7,path:"/"});});
