$.extend($,{strlen:function(a){if(typeof a!="string"){return 0}return a.replace(/[^\x00-\xff]/gi,"xx").length}});
var G={};
G.createFnQueue=function(a){
	var b=[];return{add:function(c){if($.isFunction(c)){b.push(c)}},exec:function(f){if(a!==false){while(b.length>0){b.shift()(f)}}else{for(var d=0,c=b.length;d<c;d++){if(b[d](f)===false){return false}}}},clear:function(){b.length=0}}
};
G.util={};
G.util.cookie={get:function(b){var c=new RegExp("(^|;|\\s+)"+b+"=([^;]*)(;|$)");var a=document.cookie.match(c);return(!a?"":unescape(a[2]))},add:function(c,b,h,a,g){var f=c+"="+escape(b)+"; path="+(h||"/")+(g?("; domain="+g):"");if(a>0){var i=new Date();i.setTime(i.getTime()+a*1000);f+=";expires="+i.toGMTString()}document.cookie=f},del:function(a,b){document.cookie=a+"=;path=/;"+(b?("domain="+b+";"):"")+"expires="+(new Date(0)).toGMTString()}};

G.logic={};
G.logic.constants={
	tipsLevel:{0:"info",1:"warn",2:"error",3:"right",4:"help"},
	allowedWhInfo:{"1":"上海","1001":"广东","2001":"北京","3001":"湖北"},
	getTipStr:function(h,i,g,d){
	if(h==null){return""}
	if(i==null||!(i in G.logic.constants.tipsLevel)){i=0}
	if(i==0||i==4){i=1}
	var a=G.logic.constants.tipsLevel[i],c="";
	if(d=="big"){
		if($.type(h)!="array"){h=[h]}
		var f=[];
		if(h.length>1){
			var b=h.shift();$.each(h,function(j,l){f.push("<p>"+l+"</p>")});h.unshift(b)
		}
		if(f.length>0){f='<div class="bd">'+f.join("")+"</div>"}else{f=""}
		c='<div class="inner"> <b class="icon icon_msg3 icon_msg3_'+a+'"></b><div class="hd"><strong class="tit">'+(h.length>0?h[0]:"")+"</strong></div>"+f+"</div>";c=g?c:'<div class="para_blo para_'+a+'">'+c+"</div>"}else{c='<b class="icon icon_msg0 icon_msg0_'+a+'"></b><span class="para_tit">'+h+"</span>";c=g?c:'<p class="para_inb para_'+a+'">'+c+"</p>"}
		return c
	},
	getSmallUrl:function(a,b){return this._getPicUrl(a,"small",b)},
	_getPicUrl:function(f,a,g){
		if(f.length>10){f=f.substr(0,10)}var d=f.substr(0,2),c=f.substr(3,3),b=f.substr(7,3);return"http://img"+(parseInt(b)%2?"1":"2")+".icson.com/product/"+a+"/"+d+"/"+c+"/"+f+(g==0?"":("-"+(g<10?("0"+g):g)))+".jpg"
	},
	getWhId:(function(){
		function d(){
			if(location.href.indexOf("www.51buy.com/sh")>0){G.util.cookie.add("wsid",1,"/",30*24*3600,".51buy.com");G.util.cookie.del("ws_c",".51buy.com")}
			if(location.href.indexOf("www.51buy.com/sz")>0){G.util.cookie.add("wsid",1001,"/",30*24*3600,".51buy.com");G.util.cookie.del("ws_c",".51buy.com")}
			if(location.href.indexOf("www.51buy.com/bj")>0){G.util.cookie.add("wsid",2001,"/",30*24*3600,".51buy.com");G.util.cookie.del("ws_c",".51buy.com")}
			if(location.href.indexOf("www.51buy.com/wh")>0){G.util.cookie.add("wsid",1,"/",30*24*3600,".51buy.com");G.util.cookie.add("ws_c",3001,"/",30*24*3600,".51buy.com")}
			var f=G.util.cookie.get("wsid");
			//G.logic.constants.allowedWhInfo[f]="3001";
			//if(G.logic.constants.allowedWhInfo[f]){return(G.util.cookie.get("ws_c")=="3001")?"3001":f}else{return false}
		}
		var a=G.createFnQueue(),c=0,b=d();return function(f){
			a.add(f);if(c==2||b!==false){a.exec(b);return}if(c==1){return}c=1;$.get("http://"+G.DOMAIN.BASE_ICSON_COM+"/json.php?mod=user&act=getwhid",function(g){c=2;b=1;if(g&&g.errno==0){
			//if(G.logic.constants.allowedWhInfo[g.data]){b=g.data}
			}
			G.util.cookie.add("wsid",b,"/",30*24*3600,".51buy.com");a.exec(b)},"jsonp")
		}
	})()
};
G.app={};
G.ui={};
if($.browser.msie&&parseInt($.browser.version,10)<7){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}
G.util.post=function(c,g,b){
	/*
	G.util.post.pIndex=(G.util.post.pIndex||0)+1;
	var d=$('<iframe name="pIframe_'+G.util.post.pIndex+'" src="about:blank" style="display:none" width="0" height="0" scrolling="no" allowtransparency="true" frameborder="0"></iframe>').appendTo($(document.body));
	var a=[];$.each(g,function(i,h){a.push('<input type="hidden" name="'+i+'" value="" />')});
	if(!/(\?|&(amp;)?)fmt=[^0 &]+/.test(c)){c+=(c.indexOf("?")>0?"&":"?")+"fmt=1"}
	var f=$('<form action="'+c+'" method="post" target="pIframe_'+G.util.post.pIndex+'">'+a.join("")+"</form>").appendTo($(document.body));
	$.each(g,function(i,h){f.children("[name="+i+"]").val(h)});
	d[0].callback=function(h){if(typeof b=="function"){b(h)}$(this).src="about:blank";$(this).remove();f.remove();d=f=null};
	if($.browser.msie&&$.browser.version==6){d[0].pIndex=G.util.post.pIndex;d[0].ie6callback=function(){f.target="pIframe_"+this.pIndex;f.submit()};
	d[0].src=location.protocol+"//st.51buy.com/static_v1/htm/ie6post.htm"}else{f.submit()}
*/
	var sdata = "inajax=1";
	for(var a in g){
		if(a!="suborders"){
			sdata += "&"+a+"="+(g[a]);
		}
	}
	$.ajax({
		type:"POST",
		url:c,
		data:sdata,
		cache:false,
		dataType:"json",
		success:function(data){
			b(data);
		},
		error:function(x,t,e){
			var tmp = "Ajax Error";
			if(G.util.cookie.get("userId")==2){
				tmp += x.responseText;
			}
			G.ui.popup.showMsg(tmp);
			$("#btn_order")[0].disabled=false;
		}
	});
};
G.util.parse={
	url:function(){
		var a=function(f){var f=(f+"").replace(/(&amp;|\?)/g,"&").split("&");var g={};var j=f.length;for(var d=0;d<j;d++){var h=f[d].indexOf("=");if(-1==h){continue}g[f[d].substr(0,h).replace(/[^a-zA-Z0-9_]/g,"")]=unescape(f[d].substr(h+1))}return g};var b=location.href.toString().indexOf("#");if(b<0){b=""}else{b=location.href.toString().substring(b,location.href.toString().length)}return{search:a(location.search.substr(1)),hash:a(b)}
	},
	encodeHtml:function(a){
		return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;")
	},
	decodeHtml:function(a){return a.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#0?39;/g,"'").replace(/&quot;/g,'"').replace(/&amp;/g,"&")},
	timeFormat:function(c,a){
		var f=G.util.parse.getTimeInfo(c);var b={y:f.year,m:f.month,d:f.date,h:f.hour,i:f.minute,s:f.sec,w:f.week};$.each(b,function(g,d){if(g!="y"&&d<10){b[g]="0"+d}});return a.replace(/(?!\\)(y|m|d|h|i|s|w)/gi,function(g,d){return b[d.toLowerCase()]})
	},
	getTimeInfo:function(b){
		var a=["星期天","星期一","星期二","星期三","星期四","星期五","星期六"];
		var c=new Date(b*1000);
		return{year:c.getFullYear(),month:c.getMonth()+1,date:c.getDate(),hour:c.getHours(),minute:c.getMinutes(),sec:c.getSeconds(),week:a[c.getDay()]}
	}
};

G.logic.validate={
	checkURL:function(b){
		var a=/^(https?:\/\/|ftp:\/\/)?(([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;\/]*)?)?(#[a-z][a-z0-9+_\-\.%=&amp;\/]*)?$/i;
		return a.test(b)
	},
	checkMobilePhone:function(b){var a=/^((\(\d{3}\))|(\d{3}\-))?1\d{10}$/;return a.test(b)},
	checkEmail:function(a){return/^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/i.test(a)},
	checkTelephone:function(d,a){var c=/^([0-9]{3}|0[0-9]{3})-[1-9][0-9]{6,7}(-[0-9]{1,6})?$/,b=/^[0-9]{4}-([0-9]{3}|0[0-9]{3})-[0-9]{7,8}$/,a=a||(1|2);if(((a&1)==1)&&c.test(d)){return true}if(((a&2)==2)&&b.test(d)){return true}return false},
	checkPhone:function(a){return this.checkTelephone(a)||this.checkMobilePhone(a)},
	checkNumber:function(a){return/^[1-9]\d*$/.test(a)},
	checkChars:function(c,a){var b="^[";a=a||(1|2|4);if((a&1)==1){b+="\u4E00-\u9FA5"}if((a&2)==2){b+="a-zA-Z"}if((a&4)==4){b+="0-9"}b+="]*$";return(new RegExp(b,"")).test(c)},
	checkOrderId:function(a){return a&&a.length==10&&G.logic.validate.checkNumber(a)},
	lenMon:function(b){
			if(!b||!b.target){return null}
			b={target:b.target,minLen:b.minLen||0,maxLen:b.maxLen||Infinity,sucClass:b.sucClass||"",failClass:b.failClass||"",defaultValue:b.defaultValue||"",tipCtrl:b.tipCtrl||null,charLenStyle:b.charLenStyle||false};
			function a(){
				var c=$(b.target).val(),d=b.charLenStyle?$.strlen(c):c.length;d=c==b.defaultValue?0:d;if(b.tipCtrl){$(b.tipCtrl).html("<b>"+d+"</b>/"+b.maxLen);
				if(d<b.minLen||d>b.maxLen){$("b",b.tipCtrl).removeClass(b.sucClass).addClass(b.failClass)}else{$("b",b.tipCtrl).removeClass(b.failClass).addClass(b.sucClass)}}
			}a();
			return $(b.target).keyup(a).bind("paste",a)
	}
};

G.ui={};
G.prefix={st:"/",ssl:false,st_ssl:"/"};
G.ui.drag=(function(){
	var l=null;var j=null;var h=0;var g=0;var m=false;var k=false;var c={};
	function f(q){
		q.stopPropagation();
		q.preventDefault();
		if(!l||!j){return}
		var o=$(window).scrollLeft();
		var p=$(window).scrollTop();
		var n=h+q.clientX+o;
		var r=g+q.clientY+p;
		n=Math.min(Math.max(n,o),$(window).width()-$(l).outerWidth()+o);
		r=Math.min(Math.max(r,p),$(window).height()-$(l).outerHeight()+p);
		if(n<0){n=0}if(r<0){r=0}
		if($(l).css("position")=="fixed"){$(l).offset({left:n,top:r})}else{$(l).offset({left:n,top:r})}
		m=n;k=r
	}
	function b(p){
		p.stopPropagation();p.preventDefault();if(!l||!j){return}var n=$(window).scrollLeft();var o=$(window).scrollTop();h=l.offsetLeft-p.clientX-n;g=l.offsetTop-p.clientY-o;if($(l).css("position")=="fixed"){h+=n;g+=o}m=false;k=false;var q=j&&j.setCapture?j:document;$(q).bind("mousemove.moving",f).bind("mouseup.stop",d);a(q)
	}
	function d(p){
		if(!j){return}var q=j&&j.setCapture?j:document;$(q).unbind("mousemove.moving");$(q).unbind("mouseup.stop");if(typeof c.onstop=="function"){c.onstop.apply(j)}if(c.fixed&&m!==false&&k!==false){var n=$(window).scrollLeft();var o=$(window).scrollTop();$(l).fixedPosition({fixedTo:"top",fixedTop:k<o?0:(k-o),fixedLeft:m<n?0:(m-n)})}l=null;j=null;h=0;g=0;i(q)
	}
	function a(n){
		if(n.setCapture){n.setCapture()}else{if(window.captureEvents||document.captureEvents){(window.captureEvents||document.captureEvents)(Event.MouseMove|Event.MouseUp)}}
	}
	function i(n){
		if(n.releaseCapture){n.releaseCapture()}else{if(window.releaseEvents||document.releaseEvents){(window.releaseEvents||document.releaseEvents)(Event.MouseMove|Event.MouseUp)}}
	}
	return{
		enable:function(p,o,n){
			if(typeof o=="string"){o=$("#"+o).get(0)}
			if(typeof p=="string"){if(!o){o=$("#"+p+"_head").get(0)}p=$("#"+p).get(0)}
			if(!p||!o){return}
			c=n||{};
			$(o).mousedown(function(q){l=p;j=o;b(q)})
		}
	}
})();

G.ui.modal=(function(){
	var a=null;
	return{
		create:function(c,b){
			var d=null;
			if(!c){
				d=a&&a.length>0?a:$('<iframe src="javascript:void(0)"></iframe>').css({opacity:0,background:"#000",left:"0",display:"none",zIndex:1100,top:"0",position:"absolute"});
				d.css({width:$(window).width()+"px",height:$(window).height()+"px"});
				d.appendTo($("body")).show();
				if(b){
					d.fixedPosition({fixedTo:"top",fixedTop:0,fixedLeft:0})
				}else{
						d.css({left:$(window).scrollLeft(),top:$(window).scrollTop()})
				}
			}else{
				d=$('<iframe style="z-index:-1;width:'+$(c).innerWidth()+"px;height:"+$(c).innerHeight()+'px" src="javascript:void(0)" frameborder="0" scrolling="no" width="100%" height="100%"></iframe>').css({opacity:0,background:"#FFF",left:"0",top:"0",position:"absolute"});
				d.appendTo(c)
			}
			return d
		}
	}
})();

G.ui.popup={
	_cssLoaded:false,
	_loadCss:function(){
		if(this._cssLoaded){return}
		this._cssLoaded=true;
		var a=G.prefix.st+"static/package/package.css";
		if(G.prefix.ssl){a=G.prefix.st_ssl+"static/package/package.css"}
		var b=false;
		$("link").each(function(){if($(this).attr("href")==a){b=true;return false}});
		if(!b){$('<link href="'+a+'" rel="stylesheet" type="text/css" charset="utf-8" />').appendTo($("head"))}
	},
	_zIndex:1101,
	create:function(b){
		this._loadCss();
		var j=null,h=null,f=b||{},g=f.height>50;
		f.width=f.width||500;
		f.fixed=f.fixed===false?false:true;
		var c=$('<div style="box-shadow:2px 2px 4px rgba(0, 0, 0, 0.5);z-index:'+(++this._zIndex)+";"+(g?("height:"+f.height+"px"):"")+";width:"+f.width+'px;" class="layer_global"><div class="layer_global_main"><div class="layer_global_title"><h3><span class="jian">&gt;</span>'+(f.title||"温馨提示")+'<span></span></h3><button title="关闭" ytag="84777"><span class="none">?</span></button></div><div class="layer_global_cont layer_cont_15"></div></div></div>');
		c.appendTo($("body"));
		if(f.fixed){c.fixedPosition({fixedTo:"top"})}
		j=c.find(".layer_global_main .layer_global_title")[0];
		h=c.find(".layer_global_main .layer_global_cont")[0];
		if(b.contWidth=="30"){$(h).removeClass("layer_cont_15").addClass("layer_cont_30")}
		function i(k){c.mIframe=G.ui.modal.create(k,c.ifFixedPosition())}
		function d(l,n){
			if(null==l){l=c.width()}
			if(null==n){n=c.height()}
			var o=$(window).width(),k=$(window).height();
			var q=(f.fullscreen&&o<l?0:(o/2-l/2)),m=(f.fullscreen&&k<n?0:(k/2-n/2));
			if(c.ifFixedPosition()){
				c.fixedPosition({fixedTo:"top",fixedLeft:q,fixedTop:m})
			}else{
				c.css("left",$(window).scrollLeft()+q+"px");
				c.css("top",$(window).scrollTop()+m+"px")
			}
			if(f.fullscreen&&!c.mDiv){
				var p=$("<div></div>").css({opacity:0.05,background:"#000",display:"none",zIndex:1101,width:$(window).width()+"px",height:$(window).height()+"px"}).appendTo("body");
				if(c.ifFixedPosition()){p.fixedPosition({fixedTo:"top",fixedLeft:0,fixedTop:0})}else{p.css({left:$(window).scrollLeft(),top:$(window).scrollTop(),position:"absolute"})}
				p.show();
				if(!c.ifFixedPosition()){if($.browser.msie){$("html").css({overflow:"hidden"})}else{$("body").css({overflow:"hidden"})}}
				c.mDiv=p
			}
			if($.browser.msie&&$.browser.version>=6&&!c.mIframe){i(f.fullscreen?null:c)}
		}
		function a(k){
			if(f.fullscreen&&c.mDiv){
				c.mDiv.remove();
				c.mDiv=null;
				if(c.mIframe){c.mIframe.remove();c.mIframe=null}
				if(!c.ifFixedPosition()){if($.browser.msie){$("html").css({overflow:"scroll","overflow-x":"hidden"})}else{$("body").css({overflow:"scroll","overflow-x":"hidden"})}}
			}
			if(k!==false&&$.isFunction(f.closeFn)){f.closeFn.apply(null)}
			c.hide()
		}
		$(j).children("button").click(a);
		!f.disableDrag&&G.ui.drag.enable(c.get(0),j,{fixed:c.ifFixedPosition()});
		if(g){d(f.width,g?f.height:300)}else{a()}
		return{
			onclose:function(k){f.closeFn=k},
			close:a,hide:a,
			show:function(){c.show();d()},
			paint:function(k){
				if(!$.isFunction(k)){return}
				var l={header:j,content:h};
				return k.apply(c,[l])
			},
			setAtCenter:d,
			resize:function(k){
					if(!$.isPlainObject(k)){return}
					if(k.width){c.css("width",k.width+"px")}
					if(k.height>50){c.css("height",k.height+"px");$(h).height(k.height-50)}
					d()
			}
		}
	},
	_msgPopup:null,
	showMsg:function(d){
		var a=arguments,b=a[1]||{};
		if($.type(b)!="object"){
			b={};
			$.each({1:"type",2:"okFn",3:"closeFn",4:"cancelFn",5:"okText",6:"cancelText"},function(g,f){
				if(a[g]!=null){b[f]=a[g]}
			});
			if(b.okText&&b.cancelText){b.btns=3}
		}
		if(!this._msgPopup){
			this._msgPopup=G.ui.popup.create({title:"提示",width:500,height:170,fullscreen:1})
		}
		var c={1:"warn",2:"error",3:"right"};
		if(!(b.type in c)){b.type=1}
		if(!$.isArray(d)){d=[d]}
		b.btns=b.btns||1;
		this._msgPopup.paint((function(f){
			return function(g){
				$(g.content).empty().html(' <div class="layer_global_mod">	<b class="icon icon_msg4 icon_msg4_'+c[b.type]+'"></b>'+(d.length>=1?('<h4 class="layer_global_tit">'+d[0]+"</h4>"):"")+"	"+(d.length>=2?("<p>"+d[1]+"</p>"):"")+(d.slice(2,d.length).join(""))+'	<div class="wrap_btn"><a class="btn_strong" href="#" onclick="return false">'+(b.okText||"确定")+'</a> <a class="btn_common" href="#" onclick="return false">'+(b.cancelText||"Cancel")+"</a></div>	</div>");
				$(".wrap_btn .btn_strong",g.content).click(function(){
					var h=true;
					if($.isFunction(b.okFn)){h=b.okFn()!==false}
					if(h){f.hide(false)}
				})[(b.btns&1)?"show":"hide"]();
				$(".wrap_btn .btn_common",g.content).click(function(){
					var h=true;
					if($.isFunction(b.cancelFn)){h=b.cancelFn()!==false}
					if(h){f.hide(false)}
				})[(b.btns&2)?"show":"hide"]();
				f.show()
			}
		})(this._msgPopup));
		this._msgPopup.onclose($.isFunction(b.closeFn)?b.closeFn:$.noop);
		return this._msgPopup
	}
};

G.ui.tips={
	err:function(c,b,a){this._set(c,2,b,a)},
	info:function(c,b,a){this._set(c,0,b,a)},
	warn:function(c,b,a){this._set(c,1,b,a)},
	suc:function(c,b,a){this._set(c,3,b,a)},
	help:function(c,b,a){this._set(c,4,b,a)},
	none:function(b,a){this._set(false,0,b,a)},
	_set:function(h,b,f,d){
		d=$.extend({autoHide:true,style:""},d||{});
		if(d.style!="inner"&&d.style!="bigtop"){d.style=""}
		var a="tips"+d.style,c="tipstimeout"+d.style;
		if($(f).data(c)){
			clearTimeout($(f).data(c));
			$(f).removeData(c)
		}
		var g=$(f).data(a),j=d.style=="bigtop"?"big":"";
		if(!g||g.parent().length==0){
			g=$(G.logic.constants.getTipStr(h,b,false,j));
			$(f).data(a,g);
			if(d.style=="inner"){
				f.empty().append(g)
			}else{
					if(d.style=="bigtop"){g.insertBefore(f)}else{g.insertAfter(f)}
			}
		}
		g.hide();
		if(h===false){return}
		if(b==null||!(b in G.logic.constants.tipsLevel)){b=0}
		var i="";
		if(d.style=="bigtop"){
			i="para_blo para_"+G.logic.constants.tipsLevel[b]
		}else{
			i="para_inb para_"+G.logic.constants.tipsLevel[b]
		}
		g.empty().html(G.logic.constants.getTipStr(h,b,true,j)).removeClass().addClass(i).fadeIn(200);
		if(d.autoHide){$(f).data(c,setTimeout(function(){g&&g.fadeOut(200)},$.type(d.autoHide)=="boolean"?5000:d.autoHide))}
	},
	setLoading:function(a){},
	unsetLoading:function(a){},
	swapInput:function(a){
		if(!a||!a.target){return null}
		a.defaultValue=a.defaultValue||"";
		a.focusClass=a.focusClass||"";
		a.blurClass=a.blurClass||"";
		$(a.target).focus({opt:a},function(c){
			var b=$(this).val();
			(b==c.data.opt.defaultValue||b=="")&&$(this).val("");
			$(this).removeClass(c.data.opt.blurClass).addClass(c.data.opt.focusClass)
		}).blur({opt:a},function(c){
				var b=$(this).val();
				if(b==c.data.opt.defaultValue||b==""){$(this).val(c.data.opt.defaultValue).removeClass(c.data.opt.focusClass).addClass(c.data.opt.blurClass)}else{$(this).removeClass(c.data.opt.blurClass).addClass(c.data.opt.focusClass)}
		});
		$(a.target).blur();
		return $(a.target)
	}
};

(function(h){
	var f={},
		c=0,
		b=null,
		a=function(){
			if(b===null){
				var j=h('<span id="supportsPositionFixed" style="position:fixed;width:1px;height:1px;top:25px;"></span>').appendTo(h("body"));
				var i=j.offset();
				j.remove();
				b=(i.top-h(window).scrollTop())===25
			}
			return Boolean(b)
		},
		g=false,
		d=function(){
				if(g!==false){return}
				var j=h("body");
				var i="http://st.icson.com/static_v1/img/blank.gif";
				if(G.prefix.ssl){i=G.prefix.st_ssl+"/static_v1/img/blank.gif"}
				if((j.css("background-image"))=="none"){j.css({"background-image":"url("+i+")","background-attachment":"fixed"})}else{j.css("background-attachment","fixed")}
				g=true
		};
	h.fn.ifFixedPosition=function(){
		if(!this.attr("id")||this.attr("id").length==0){return false}
		return !!f[this.attr("id")]
	},
	h.fn.fixedPosition=function(i){
			var j={fixedTo:"bottom",fixedTop:0,fixedBottom:0,fixedLeft:false,effect:false,effectSpeed:1000};
			var i=h.extend(j,i);
			return this.each(function(){
				var k=h(this);
				if(!k.attr("id")||k.attr("id").length==0){k.attr("id","positionFixedID"+(c++))}
				if(!a()){
					d();
					var l="";
					if(i.fixedTo=="top"){l="$(document).scrollTop()";if(i.fixedTop>0){l+="+"+i.fixedTop}}else{l='$(document).scrollTop() - $("#'+k.attr("id")+'").outerHeight() + (document.documentElement.clientHeight || document.body.clientHeight)';if(i.fixedBottom>0){l+="-"+i.fixedBottom}}
					k.css("position","absolute");
					if(k.length>0&&k[0].style&&k[0].style.setExpression){k[0].style.setExpression("top","eval("+l+")")}else{k.css("top",(i.fixedTop||0)+"px")}
					if(i.fixedLeft!==false){k.css("left",h(document).scrollLeft()+(i.fixedLeft-0)+"px")}
				}else{
					k.css("position","fixed");
					if(i.fixedTo=="top"){k.css("top",(i.fixedTop||0)+"px")}else{k.css("bottom",(i.fixedBottom||0)+"px")}
					if(i.fixedLeft!==false){k.css("left",i.fixedLeft+"px")}
				}
				f[h(this).attr("id")]=1;
				if(i.effect){
					switch(i.effect){case"fadeIn":k.hide().fadeIn(i.effectSpeed);break;case"slideDown":k.hide().slideDown(i.effectSpeed);break}
				}
			})
	}
})(jQuery);



G.app={};
G.ui.template={fillWithTPL:function(g,h,f,a,b){if(!h){return}if(!f&&f!==false){f=g+"_tpl"}a=(f===false)?(a||""):$("#"+f).html().replace(/^\s*<!--/,"").replace(/-->\s*$/,"");var d={};a=a.replace(/<@([0-9a-zA-Z_-]+)@>((.|\s)*?)<@_\1@>/g,function(k,j,i){d[j]=i;return"[#"+j+"#]"});$.each(d,function(j,i){var k=[],l=h[j];if(l){$.each(l,function(m,n){k.push(G.ui.template.fillWithTPL(false,n,false,i.replace(/<_index_>/g,m-0+1)))})}d[j]=k.join("")});var c=a.replace(/\{([0-9a-zA-Z_-]+)\}/g,function(j,i){return h[i]!==undefined?h[i]:""}).replace(/\[#([0-9a-zA-Z_-]+)#\]/g,function(j,i){return d[i]!==undefined?d[i]:i}).replace(/^\s+/,"");if(b||g===false){return c}else{$("#"+g).html(c)}}};
G.logic.login={_refer:null,_refUrl:"",_loginUser:false,_loginPopup:false,_userFnQueue:G.createFnQueue(),_qqloginFnQueue:G.createFnQueue(),_loginFnQueue:G.createFnQueue(false),_logoutFnQueue:G.createFnQueue(false),_loginNameCutLen:8,cutString:function(b,a){if(a<=0||b.replace(/[^\x00-\xff]/g,"**").length<=a){return b}var c=b;while(c.replace(/[^\x00-\xff]/g,"**").length>a){c=c.substr(0,c.length-1)}if(c.length<b.length){c+="..."}return c},
	popup:function(b){
		var a="https://base.51buy.com/login.html?url="+encodeURIComponent(typeof b=="string"?b:location.href);
		location.href=a;
		return true
	},login:function(d,c,a,b){G.util.post("https://"+G.DOMAIN.BASE_ICSON_COM+"/json.php?mod=login&fmt=1",{account:d,password:c},function(f){if(f&&f.errno==0){if($.isFunction(a)){a()}}else{if($.isFunction(b)){b(f&&f.errno?f.errno:null)}}})},updateHead:function(){G.logic.constants.getWhId(function(a){if(!G.logic.constants.allowedWhInfo[a]){location.replace("http://www.51buy.com/");return}G.logic.login.getLoginUser(function(q){var j=$("#PageToolbar"),v=$("#PageLoginStatusbar"),x=$("#PageWelcome"),t=$("#PageMyOrderLi");if(x.length>0){x.remove()}else{$("#PageLogin").remove();$("#PageLoginByQQBtn").remove();$("#PageRegLi").remove()}if(q&&q.errno==0){var u=q.data,s="";if(u.icsonid.toString().indexOf("Login_QQ_")==0||"true"===G.util.cookie.get("__BINDQQACCOUNT")){s='<i class="icon_qq">&nbsp;</i>QQ用户，';var f=G.util.cookie.get("cps_msg").split("|");if(f.length>=2&&f[0]==u.uid){f.shift();s=G.util.parse.encodeHtml(f.join("|"));if(G.util.cookie.get("cps_src")=="qqcb"){var c='<div class="mod_top_banner"><div class="main_area"><div class="sale_tip"><strong>QQ彩贝联盟商家：</strong>易迅-QQ会员购物成功最高返<span class="redf">4320</span>彩贝积分，普通用户最高返2880彩贝积分<a ytag="06807" href="http://cb.qq.com/get_jifen.html" target="_blank" title="积分详情">(详情)</a></div><div class="login_status"><span class="qqUser login_btn"><span class="name">'+s+'</span>，您好！</span><a ytag="06808" href="http://cb.qq.com/my/my_jifen_source.html" target="_blank" title="我的彩贝积分" class="my_caibei">我的彩贝积分</a></div></div></div>';setTimeout(function(){$("body").prepend(c)},500)}}else{var k=G.util.cookie.get("qq_nick").split("|");if(k.length>=2&&k[0]==u.uid){k.shift();s+=G.logic.login.cutString(G.util.parse.encodeHtml(k.join("|")),G.logic.login._loginNameCutLen);s+="，"}}}else{if(u.icsonid.toString().indexOf("Login_Alipay_")==0){var r=parseInt(q.data.status_bits&(1<<0));if(1==r){s="欢迎您，支付宝VIP："+G.logic.login.cutString(G.util.parse.encodeHtml(u.name||u.icsonid),G.logic.login._loginNameCutLen)+"，"}else{s=G.logic.login.cutString(G.util.parse.encodeHtml(u.name||u.icsonid),G.logic.login._loginNameCutLen)+" 您好"}}else{if(/^\d+@51fanli$/.test(u.icsonid.toString())){var f=G.util.cookie.get("cps_msg").split("|");if(f.length>=2&&f[0]==u.uid){s=f[1]}}else{s=G.logic.login.cutString(G.util.parse.encodeHtml(u.icsonid),G.logic.login._loginNameCutLen)+" 您好"}}}v.prepend('<li id="PageWelcome" class="item"><span class="welcome">'+s+'</span>[<a ytag="06300" href="javascript:;" name="quit" hotName="I.INDEX.HEAD_EXIT" onclick="return false">退出</a>]</li>');v.find("a[name=quit]").click(G.logic.login.logout);var g="正在加载...";t.find("div.mod_order").html(g);G.logic.login.mouseEnterAndOut(t.find("div.menu"),function(d){if(d.find("div.mod_order").html()==g){G.util.post("http://"+G.DOMAIN.WWW_ICSON_COM+"/json.php?mod=index&act=getmyorders&fmt=1",{},function(C){if(C&&"errno" in C&&"data" in C){if(C.errno==0){if($.isArray(C.data)){var A="";var B=6302;if(C.data.length>0){A+="<ul>";for(var z=0,y=C.data.length;z<y;z++){A+='<li>	<div class="pic_wrap">		<a ytag="0'+(B++)+'" href="http://item.51buy.com/item-'+C.data[z].product_id+'.html" target="_blank"><img alt="'+C.data[z].product_name+'" src="'+C.data[z].product_img+'"></a>	</div>	<div class="order_info">		<dl>			<dt><a ytag="0'+(B++)+'" href="http://base.51buy.com/orderdetail-'+C.data[z].order_id+'.html" target="_blank">'+C.data[z].order_id+"</a></dt>			<dd>"+C.data[z].order_date+'</dd>		</dl>	</div>	<div class="order_status"><span class="wait">'+C.data[z].order_status+"</span></div></li>"}A+="</ul>";A+='<p class="order_old"><a ytag="06301" title="更早订单" href="http://base.51buy.com/myorder.html?YTAG=1.100000003">更早订单<i class="dot_arrow"></i></a></p>'}else{A+="没有记录"}d.find("div.mod_order").html(A);return}else{if($.type(C.data)=="string"){d.find("div.mod_order").html(C.data);return}}}}d.find("div.mod_order").html("订单信息加载失败，请您稍后重试")})}},null,"menu_hover")}else{var b="登录";var h="注册";var i="https://base.51buy.com/register.html";var m="";if(location.href.match(/^http:\/\/b\.51buy\.com/)||(location.href=="http://event.51buy.com/event/478cfee.html")||(location.href=="http://event.51buy.com/event/4819461.html")||(location.href=="http://event.51buy.com/event/479d18f.html")){b="大客户登录";h="大客户注册";i="http://b.51buy.com/retailerreg.html";m=" item_login_distributor"}var p=window.LOGIN_NO_JUMP?(LOGIN_NO_JUMP===true?"http://www.51buy.com/":LOGIN_NO_JUMP):location.href,n='<li id="PageLogin" class="item'+m+'"><a ytag="06800" href="https://base.51buy.com/login.html?url='+encodeURIComponent(location.href)+'" >'+b+'</a></li><li id="PageLoginByQQBtn" class="item loginbyqq"><a ytag="06805" href="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=215585&redirect_uri=http%3A%2F%2Fbase.51buy.com%2Findex.php%3Fmod%3Duser%26act%3Dloginqqauthcode"><i class="dot_qq"></i><span class="hide_clip">QQ登录</span></a></li><li id="PageRegLi" class="item"><a ytag="06806" id="PageRegBtn" href="'+i+'">'+h+"</a></li>";v.prepend(n);var w=G.util.parse.url();w=w.search.url||w.hash.url||location.href;if(!/^http:\/\/([a-zA-Z0-9_-]+\.|)51buy\.com/.test(w)){w=""}G.logic.login._refUrl=w;if(w){var l="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=215585&redirect_uri="+encodeURIComponent("http://base.51buy.com/index.php?mod=user&act=loginqqauthcode&url="+encodeURIComponent(w));$("#qqauthlogin").attr("href",l);$("#PageLoginByQQBtn a").attr("href",l);$("#ali_login").attr("href","http://base.51buy.com/index.php?mod=user&act=toalipaylogin&url="+encodeURIComponent(w));$("#PageRegBtn").attr("href",i+"?url="+encodeURIComponent(w));$("#PageLogin a.menu_hd").attr("href","https://base.51buy.com/login.html?url="+encodeURIComponent(w))}G.logic.login.bindHeadLoginHandler($("#PageLogin div.menu"));$("#PageMyOrderLi div.mod_order").html('<p class="empty"><a ytag="06807" href="https://base.51buy.com/login.html?url='+encodeURIComponent(location.href)+'">登录</a>后查看最近的订单信息</p>');G.logic.login.mouseEnterAndOut($("#PageMyOrderLi div.menu"),null,null,"menu_hover")}})})},mouseEnterAndOut:function(d,c,f,g){var k=300,b=null,h=g||"hover",j=function(){if(b){clearTimeout(b);b=null}},i=function(){j();d.addClass(h);if(c){c(d)}},a=function(){j();b=setTimeout(function(){d.removeClass(h);if(f){f(d)}},k)};d.hover(i,a)},bindHeadLoginHandler:function(d){var f=d.find("div.mod_login_bd dd.item_submit button"),c=d.find('div.mod_login_bd input[type="text"]'),j=d.find('div.mod_login_bd input[type="password"]'),k=d.find("div.mod_login_bd dd.error");var l=function(){b();c.val("");j.val("")};G.logic.login.mouseEnterAndOut(d,null,l,"menu_hover");var a=function(n,m){n&&n.addClass("status_error");k.html('<i class="dot_error"></i>'+m).show()};var b=function(){c.removeClass("status_error");j.removeClass("status_error");k.hide().html("")};var i=function(){b();var m=false;if($.trim(c.val())==""){a(c,"请输入您的易迅帐号")}else{if($.trim(j.val())==""){a(j,"请输入您的易迅密码")}else{m=true}}return m};var g=function(){var m=$.trim(location.href);if(G.logic.login._refUrl&&G.logic.login._refUrl!=m){location.replace(G.logic.login._refUrl)}else{G.logic.login.updateHead()}};var h=function(m){switch(m){case 66:a(j,"密码错误，请您重新填写");break;case 67:a(c,"该登录帐号不存在");break;default:a(false,"对不起，登录失败");break}};f.click(function(n){var m=i();if(m){G.logic.login.login($.trim(c.val()),$.trim(j.val()),g,h)}})},
	getLoginUid:function(){
		var a=G.util.cookie.get("userId");
		if(G.logic.validate.checkNumber(a)){return a}
		return false
	},forceFlushUser:function(){var a=Math.random();G.util.cookie.add("randpro",a,"/",24*3600,".51buy.com");return a},
	_getLoginUser:function(i,h){
			var d=G.logic.login,b=$.isFunction(i)?i:$.noop,f=d.getLoginUid();
			if(d._loginUser!=false&&d._loginUser.uid==f){b(d._loginUser);return}
			d._userFnQueue.add(b);
			if(d._userLoading){return}
			d._userLoading=true;
			var c=G.util.cookie.get("randpro");
			if(h){c=d.forceFlushUser()}
			var a=G.util.cookie.get("qplus_nick");
			var g="";if(a!=""){g="&"+new Date().getTime()}
			$.ajax({
				type:"POST",
				url:"/user/profile/",
				data:"inajax=1&act=data",
				dataType:"json",
				success:function(j){d._userLoading=false;d._userFnQueue.exec(j);d._loginUser=j},
				cache:false,
				error:function(e,r,s){
					
				}
			});
	},
	_getLoginQQUser:function(d){
		return;
		var b="http://a1.shop.qq.com/act.php?mod=checkuserq&func=redirect&id=icson&url="+encodeURIComponent("http://base.51buy.com/index.php?mod=user&act=loginqq&url="+encodeURIComponent("http://st.51buy.com/static_v1/htm/loginjump.htm"))+"&furl="+encodeURIComponent("http://st.51buy.com/static_v1/htm/loginjump.htm"),c=$('<iframe src="about:blank" style="display:none"></iframe>');$("body").prepend(c);var a=$.isFunction(d)?d:$.noop;c[0].callback=function(){a();$(this).src="about:blank";$(this).remove();this.callback=null};if($.browser.msie&&parseInt($.browser.version)<9){G.util.post.pIndex=(G.util.post.pIndex||0)+1;c[0].pIndex=G.util.post.pIndex;c[0].ie6callback=function(){this.src=b};c[0].src=location.protocol+"//st.51buy.com/static_v1/htm/ie6post.htm"}else{c[0].src=b}},
		getLoginUser:function(g,c,d){
			var a=G.logic.login,b=a.getLoginUid();
			a._refer=(a._refer===null)?document.referrer:a._refer;
			if(!b){
				var f=G.util.cookie.get("cps_info");
				if(c!==false&&((/^\s*linktech\|\|A100060164/i.test(f)&&G.util.cookie.get("QQACCT")==2)||(((a._refer!=""&&!/^http:\/\/([a-z0-9]+\.|)51buy\.com/i.test(document.referrer))||!G.util.cookie.get("QQACCT"))&&!f))){
					a._qqloginFnQueue.add(g);if(a._qquserLoading){return}a._qquserLoading=true;
					a._getLoginQQUser(function(){
						a.getLoginUser(function(h){
							a._refer="";
							if(h&&h.errno==0){G.util.cookie.add("QQACCT",h.data.icsonid.replace(/^Login_QQ_/i,""),"/",0,".51buy.com")}a._qquserLoading=false;a._qqloginFnQueue.exec(h)},false,d)
					})
				}else{
						a._refer="";$.isFunction(g)&&g(false)
				}
				return
			}
			a._refer="";
			a._getLoginUser(g,d)
		},logout:function(a){G.util.cookie.del("uid",".51buy.com");G.util.cookie.del("skey",".51buy.com");G.util.cookie.del("cps_src",".51buy.com");G.util.cookie.del("BOUND_QQACCT",".51buy.com");G.util.cookie.del("__BINDQQACCOUNT",".51buy.com");G.logic.login._logoutFnQueue.exec();$.isFunction(a)&&a();if(window.LOGIN_NO_JUMP){location.replace(LOGIN_NO_JUMP===true?"http://www.51buy.com/":LOGIN_NO_JUMP)}else{G.logic.login.updateHead();G.logic.header.getShoppingCart()}},onlogout:function(a){$.isFunction(a)&&G.logic.login._logoutFnQueue.add(a)},
	ifLogin:function(c,b){return true;
		var a=G.logic.login.getLoginUid();
		if(!a){
			G.logic.login.popup(c&&b?(function(d){
				return function(){return false;
					var f=[];
					for(var g=d.length-1;g>=0;g--){f.unshift(d[g])}
					d.callee.apply(c,f)
				}})(b):$.noop);return false
		}
		return true
	},ifLoginJump:function(){var b=G.logic.login.getLoginUid();if(!b){var a="http://www.51buy.com/";if(!window.skipJumpPage){a="https://base.51buy.com/login.html?url="+encodeURIComponent(location.href)}location.replace(a);return false}return true},jump:function(){}};

G.util.localShare=(function(){
	return;
	var c=G.createFnQueue(),a=0,b=false;return function(f){
		c.add(f);
		if(a==2&&b){c.exec(b);return}
		if(a==1){return}a=1;
		var d="1.1";
		$.ajax({url:"http://st.icson.com/static_v1/js/app/localShare.js?v="+d,dataType:"script",crossDomain:true,cache:true,scriptCharset:"gb2312",
			success:function(){
				G.app.localShare(function(){a=2;b=this,c.exec(b)})
			}
		})
	}
})();

$.Template={
	parse:function(c,a,b){
		var d=[];
		$.each(c,function(i,e){
			d.push(a.replace(/{(\w+)}/g,function(g,f){return e[f]!==undefined?e[f]:g}))
		});
		return d.join(b||"")
	},
	stuff:function(e,f,c,d){//alert(f)
			c=jQuery("#"+(c||f)+"_tpl").val();
			f=$("#"+f);
			var a=c.match(/<#([\s\S]+)#>/);
			var b=a[1];
			//alert(this.parse(e,b,d))
			//alert(a[0]);
			f.html(c.replace(a[0],this.parse(e,b,d)));
			f.attr("visibility","visible");
	}
}

