
var HOMEPAGE="/index.html";
var defDatePattern='MM/dd/yyyy';
var __ctxPath = "";
var __mediaPath = "/media/";
var __defaultImage = "/images/default/00.jpg";
var __defaultCurrencySymbol = "$";
var __defDatePattern='MM/dd/yyyy';

var __vaMsg = {
	notPass:"Invalid input, Please check it again.",
	required:"This field is required.",
	number:"must be number.",
	integer:"must non negative integar.",
	short:"Please enter a integar no greater than 32767.",
	double:"must be Integar or Decimal.",
	long:"must be of type Long.",
	maxValue:"Value must be less than:",
	minValue:"Value must be greater than:",
	maxlength:"Length must be less than:",
	minlength:"Length must be greater than:",
	price:"Invalid Amount!",
	money:"Invalid Amount! Please enter in the format of XX.XX",
	code:"Invalid Code. Only combination of letters, digits, _ and - is accepted.",
	phone:"Invalid phone number. Please enter phone number with 6-8 digits.",
	mobile:"Invalid mobile no.! 9 to 11 digits required!",
	email:"Invalid Email Address.",
	positiveInteger:"must be positive integar which is greater than 1.",
	double4:"Invalid format! Please enter integar or decimal.",
	noHtml:"HTML not supported.",
	radio:"Please at least select one.",
	url:"Invalid URL.",
	date:"???validate.date???",
	bill_n:"This system doesn't provide invoices.",
	wrap_n:"We provide FREE gift packing for all orders!",
	gcno_null:"Please enter a valid Gift certificate Code"
};

var __FMT = {
	catalog_selecter_title:"Product/Category Selector",
	catalog_compare_title:"Product comparison",
	catalog_product_compareComment1:"You need to choose at least 2 products to compare.",
	catalog_product_compareComment2:"You may choose no more than 5 products to compare.",
	customer_account:"My Account",
	customer_login:"Login",
	customer_logout:"Logout",
	customer_signup:"Sign Up",
	customer_logining_tips:"Now logging in...",
	customer_login_success:"Login succeeded!",
	customer_username_isRequired:"Please enter a valid username.",
	customer_password_isRequired:"Please enter your password.",
	customer_login_fail:"Invalid username or password. Please try again. ",
	errors_password_mismatch:"Invalid username or password, please try again.",
	loginConfirm:"You need to login before proceed, would you like to login now?",
	wishlist_dg_checkName:"Wish list name must be filled!",
	wishlist_dg_selectItem:"Please select a wish list or create a new wish list.",
	wishlist_dg_addSuccess:"Product was added to wish list successfully!",
	wishlist_dg_addExist:"This product has exist in your selected wish list.",
	wishlist_dg_title:"Add to wish list",
    minicart_addToCartSuccess:"Shopping Bag updated!",
    minicart_addToCartAndFavoriteSuccess:"Some of the items were added to the Buy Later list.",
    minicart_cart:"Mini Cart",
    minicart_unit:"items",
    minicart_id_cookie:"shoppingcartInCookie",
    minicart_itemcount_cookie:"totalItemNo",
    minicart_totalprice_cookie:"cartTotalPrice",
    c_itemcount_cookie:"cartitemNo",
    f_itemcount_cookie:"favoriteitemNo",
    cannotMoveToC:"NOINVENTORY",
    noMoreInvetory:"NOMOREINVENTORY",
    move_stockNotEnough:"Can't add to cart, because of out of stock.",
    update_stockNotEnough:"Can't update, because of out of stock.",
    update_noMoreInventory:"Out of stock",
    favorite_:"Favorite",
    notAnonymousF:"Sorry! Please login first.",
    couponNull:"Please enter a valid Coupon Code",
    coupon_INVALID:"Invalid Coupon",
    coupon_INVALID_NOT_ACTIVE:"Invalid Coupon",
    coupon_INVALID_IS_END:"Coupon is expired",
    coupon_INVALID_NOT_START:"Invalid Coupon",
    coupon_INVALID_ZERO:"Invalid Coupon",
    coupon_INVALID_v:"0",
    coupon_INVALID_NOT_ACTIVE_v:"-1",
    coupon_INVALID_IS_END_v:"-2",
    coupon_INVALID_NOT_START_v:"-3",
    coupon_INVALID_ZERO_v:"-4",
    
    gc_INVALID_v:"0",
    gc_UNACTIVE_v:"-1",
    gc_UNDEAL_v:"-2",
    gc_EXPIRE_v:"-3",
    gc_NOT_ENOUGH_v:"-4",
    gc_AVAILABLE_v:"1",
    gc_MONEYNULL_v:"-5",
    
    gc_INVALID:"This is not Gift Certificate code",
    gc_UNACTIVE:"Gift Certificate is inactive",
    gc_UNDEAL:"Invalid Gift Certificate No.",
    gc_EXPIRE:"Gift Certificate is expire",
    gc_NOT_ENOUGH:"Gift Certificate is out of money",
    gc_MONEYNULL:"Gift Certificate is out of money",
    
    gc_used:"This Gift Certificate has already been used.",
    
    shippingBasePrice:"was:",
    checkou_conplictSorry:"Sorry, the order can not be shipped to your address for following reason(s):",
    checkout_timeout:"Session is expired, login again please.",
    checkout_wrap_conflict:"???checkout.wrap.conflict???",
    checkout_shipping_selectone:"???checkout.shipping.selectone???",
    checkout_shipping_fullAddr:"???checkout.shipping.fullAddr???",
    checkout_shipping_loading:"???checkout.shipping.loading???",
    checkout_payment_selectone:"???checkout.payment.selectone???",
    checkou_bill_y:"Invoice needed",
    checkou_bill_n:"No invoice",
    checkou_wrap_y:"I want",
    checkou_wrap_n:"No thanks",
    checkou_error:"We have some problem with network, this order is failed. Try again please.",
    button_clear:"Clear",
    button_close:"Close",
    button_select:"Select",
    catalog_product_productIsExisted:"This product is already in your comparison.",
    product_varition_notnull:"Attribute can't be null!",
    cart_promotion_title:"Promotion",
    product_emailYourFriendHint:"You have just sent an email to your friend!",
    product_emailYourFriendErr:"Sorry! Mail server is currently busy, please try again later!",
    emailYourFriend_recipientName_isRequired:"Please enter the recipient's name!",
    emailYourFriend_recipientEmail_isRequired:"Please enter the recipient's email!",
    emailYourFriend_emailformat_err:"Invalid email address!",
    emailYourFriend_sendName_isRequired:"Please enter your name!",
    emailYourFriend_sendEmail_isRequired:"Please enter your email!",
    product_feedback_add_success:"Thank you. Your feedback has been submitted.",
    product_feedback_add_unsuccess:"Our feedback system is currently unavailable. Please try again later.",
    product_feedback_subject_isRequired:"Please enter a topic!",
    product_feedback_content_isRequired:"Your feedback can not be empty!",
    product_addFavorite_success:"You have successfully added a product to you favorites!",
    product_addFavorite_failed:"Sorry, you are not allowed to bookmark this item due to your membership level.",
    product_addFavorite_repeated:"This product is already in your favorites!",
    productView_allRatingItem_isRquired:"All fields are mandatory.",
    product_addReview_success:"Thank you. Your review has been submitted.",
    productReview_subject_maxlength:"Title can be no longer than 128 characters!",
    productReview_subject_required:"Please give your review a title!",
    productReview_message_maxlength:"Your review can be no longer than 1024 characters!",
    productReview_message_required:"Oops! Looks like you forgot to fill in a required form field.",
    productReview_username_required:"Reviewer must be filled.",
    productReview_voteSuccess:"Thanks for the valuable feedback you provided to other reviewers. Your vote will be counted and will appear on the product page soon.",
    productReview_isVoted:"You have already voted on this review.",
    productReview_isSelfReview:"Sorry but you can not vote on your own review.",
    wishlist_my:"Add to Wish List",
    send_friend:"Tell a Friend",
    feed_kui:"Create a Feedback",
    add_Review:"Write a Review",
    first_login:"Login",
    image_btn_addtocart_on:"/images/btn/btn_add_to_cart.gif",
    image_btn_addtocart_preOrder:"/images/btn/btn_add_to_cart_preOrder.gif",
    image_btn_addtocart_backOrder:"/images/btn/btn_add_to_cart_preOrder.gif",
    image_btn_addtocart_off:"/images/btn/btn_add_to_cart_off.gif",
    productDetail_inventory_outof_stock:"缺货",
    productDetail_inventory_outof_stock_will_ship:"缺货,估计到货时间为：{0}",
    productDetail_inventory_preOrder:"可接受预订，预计的上市日期为：{0}",
    productDetail_inventory_backOrder:"可接受预订，预计的进货日期为：{0}",
    productDetail_inventory_will_ship:"可接受预订，预计即将到货",
    productDetail_wholesalePrices:"批发价",
    del:"Delete",
    addressDelete:"Are you sure you want to delete this address?",
    orderQueryTimeNull:"Query condition time is null",
    select:"select..."
    
};                           
if(!eCom){var eCom=new Object();}function $(el){if(arguments.length>1){for(var i=0,els=[],length=arguments.length;i<length;i++){els.push($(arguments[i]));}return els;}if(typeof el=="string"){el=document.getElementById(el);}if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")){return el;
}else{return Element.extend(el);}}function fnHide(el){$(el).style.display="none";}function fnShow(el){$(el).style.display="";}function addClass(el,className){removeClass(el,className);$(el).className+=" "+className;}function removeClass(el,className){var regex=new RegExp("(^|\\s)"+className+"(\\s|$)","g");
$(el).className=$(el).className.replace(regex,"");}function fnSetStyle(el,reomveClassName,addClassName){removeClass(el,reomveClassName);addClass(el,addClassName);}String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");};function trim(str){return str==null?null:str.trim();}function fnAppendUrl(url,paramName,paramValue){if(!url||!paramName||!paramValue){return url;
}var tmpUrl=removeParamFromUrl(url,paramName);return tmpUrl+(tmpUrl.indexOf("?")>-1?"&":"?")+paramName+"="+paramValue;}function removeParamFromUrl(url,paramName){return url.replace(new RegExp("("+paramName+"=[^&]*[&])|([?|&]"+paramName+"=[^&]*$)"),"");}function getEvent(){if(document.all){return window.event;
}var func=getEvent.caller;while(func!=null){var arg0=func.arguments[0];if(arg0){if((arg0.constructor==Event||arg0.constructor==MouseEvent)||(typeof(arg0)=="object"&&arg0.preventDefault&&arg0.stopPropagation)){return arg0;}}func=func.caller;}return null;}function getEventSourceObject(){var evt=getEvent();
return evt.srcElement||evt.target;}function _defaultAjaxErrorHandler(errMsg,xhr){alert(errMsg);}function log(sMsg){typeof console=="undefined"?alert(sMsg):console.log(sMsg);}function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");
}function getCookie(name){var prefix=name+"=";var start=document.cookie.indexOf(prefix);if(start==-1){return null;}start+=prefix.length;var end=document.cookie.indexOf(";",start);if(end==-1){end=document.cookie.length;}return unescape(document.cookie.substring(start,end));}function fnResizeImage(oImg,reqWidth,reqHeight){if(reqWidth>=oImg.width&&reqHeight>=oImg.height){return;
}if((oImg.width/oImg.height)>(reqWidth/reqHeight)){oImg.width=reqWidth;}else{oImg.height=reqHeight;}}function getElementPos(obj){var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf("opera")!=-1);var isIE=(ua.indexOf("msie")!=-1&&!isOpera);var el=obj;if(el.parentNode===null||el.style.display=="none"){return false;
}var parent=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var scrollTop=Math.max(document.documentElement.scrollTop,document.body.scrollTop);var scrollLeft=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);return{x:box.left+scrollLeft,y:box.top+scrollTop};
}else{if(document.getBoxObjectFor){box=document.getBoxObjectFor(el);var borderLeft=(el.style.borderLeftWidth)?parseInt(el.style.borderLeftWidth):0;var borderTop=(el.style.borderTopWidth)?parseInt(el.style.borderTopWidth):0;pos=[box.x-borderLeft,box.y-borderTop];}else{pos=[el.offsetLeft,el.offsetTop];
parent=el.offsetParent;if(parent!=el){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}if(ua.indexOf("opera")!=-1||(ua.indexOf("safari")!=-1&&el.style.position=="absolute")){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}}if(el.parentNode){parent=el.parentNode;
}else{parent=null;}while(parent&&parent.tagName!="BODY"&&parent.tagName!="HTML"){pos[0]-=parent.scrollLeft;pos[1]-=parent.scrollTop;if(parent.parentNode){parent=parent.parentNode;}else{parent=null;}}return{x:pos[0],y:pos[1]};}function getCurrentUserId(){return getCookie("UID")||-2;}function isLogined(){return getCurrentUserId()>0;
}function getCurrentUserName(loginRequired){return(!loginRequired||isLogined())&&getCookie("UNAME")||"";}function getLoginUserEmail(loginRequired){return(!loginRequired||isLogined())&&getCookie("UEMAIL")||"";}var bCancel=false;function isIE(){return(navigator.userAgent.toLowerCase().indexOf("msie")!=-1);
}var onloadHandlers=[];function addOnload(handler){if(handler){onloadHandlers.push(handler);}}function handleOnload(){for(var i=0;i<onloadHandlers.length;++i){onloadHandlers[i].call(this);}}function ___bindReady(){if(isIE()){try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);
return;}handleOnload();}else{document.addEventListener("DOMContentLoaded",handleOnload,false);}}___bindReady();function fnShowAllCategoryPop(){var allCategoryBoxDIV=$("allCategoryBox");if(allCategoryBoxDIV.innerHTML.trim()==""){var url=__ctxPath+"/siteAllCatalog.html?decorator=selecter";if(("https:"==document.location.protocol)){url=window.location.protocol+"//"+window.location.host+__ctxPath+"/siteAllCatalog_ssl.html?decorator=selecter";
}fillDivWithPage("allCategoryBox",url,null,null,"GET");}allCategoryBoxDIV.style.display="block";}function fnHideAllCategoryPop(e){e=e||window.event;o=e.relatedTarget||e.toElement;if(o==null){return;}while(o.parentNode&&o.id!="allCategoryBox"){o=o.parentNode;}if(o.id!="allCategoryBox"){$("allCategoryBox").style.display="none";
$("hideSelectorIFrame").style.display="none";}}function fillLoginPrompt(){var _str="";if(!isLogined()){_str=_str+'<a href="'+__ctxPath+'/myaccount/account.html">'+__FMT.customer_account+"</a>&nbsp;";}else{_str=_str+'Hi <a href="'+__ctxPath+'/myaccount/account.html">'+getCookie("UNAME")+"</a>&nbsp;";_str=_str+'(<a href="'+__ctxPath+'/j_acegi_logout">'+__FMT.customer_logout+"</a>)";
}if($("loginPromptHolder")!=undefined&&$("loginPromptHolder")!=null){$("loginPromptHolder").innerHTML=_str;}}function fnSelectTab(selectTabNumber,$tabFlag){var tab_flag="tab_";if($tabFlag){tab_flag=$tabFlag;}var tab_count=10;for(var d=1;d<=tab_count;d++){var head=$(tab_flag+"head_"+d);var content=$(tab_flag+"content_"+d);
if(head!=null){if(d==selectTabNumber){addClass(head,"selected");fnShow(content);}else{removeClass(head,"selected");fnHide(content);}}}}var _eComDialogs=new Array();var currentDialog=null;var _dialogZIndex=10000;var dialogIdPrefix="divDlg";eCom.SimpleDialog=function(config){var dialogId=config.dialogId;
var dlgModalDom=document.createElement("div");dlgModalDom.id=dialogIdPrefix+dialogId;dlgModalDom.style.display="none";dlgModalDom.className="dlg-modal";dlgModalDom.style.height=(document.documentElement.scrollHeight||document.body.scrollHeight)+"px";var dlgParentDom=config.parentDom||document.body;dlgParentDom.appendChild(dlgModalDom);
dlgModalDom.innerHTML=_getDlgBoxHtml(dialogId,config.dialogTitle);var divContentDom=$("_dlgContBox"+dialogId);var dialogContent=config.dialogContent;if(typeof dialogContent=="string"&&dialogContent.trim().length>=0){divContentDom.innerHTML=dialogContent;}else{if(dialogContent!==null){divContentDom.appendChild(dialogContent);
}}var staticDialogUrl=config.staticDialogUrl;var cacheEnabled=config.cacheEnabled||true;var onshowHandler=config.onshowHandler;var _savedOnshowHandler=null;var fillContentDivId=config.fillContentDivId||divContentDom;var savedDialogPageUrl=null;var _fnOnshowHandlerProxy=function(){if(_savedOnshowHandler){if(typeof _savedOnshowHandler=="function"){_savedOnshowHandler.call(this);
}else{eval(_savedOnshowHandler+"()");}}divContentDom.style.width=config.width||config.dialogWidth||"600px";divContentDom.style.height=config.height||config.dialogHeight||"300px";var dlgDom=$("_dlgBox"+dialogId);dlgDom.style.width=(parseInt(divContentDom.style.width)+40)+"px";dlgDom.style.left=config.left||Math.round(((parseInt(document.documentElement.clientWidth||document.body.clientwidth)-parseInt(dlgDom.style.width))/2))+"px";
dlgDom.style.top=config.top||Math.round(((parseInt(document.documentElement.clientHeight||document.body.clientHeight)-parseInt(divContentDom.style.height)-40)/2)+(document.documentElement.scrollTop||document.body.scrollTop))+"px";dlgModalDom.style.zIndex=_dialogZIndex+=10;dlgModalDom.style.display="block";
currentDialog=this;};return{showDialog:function(dynamicPageUrl,dynamicOnshowHandler){_savedOnshowHandler=dynamicOnshowHandler||onshowHandler;var _dialogPageUrl=dynamicPageUrl||staticDialogUrl;if(_dialogPageUrl&&(!cacheEnabled||_dialogPageUrl!=savedDialogPageUrl)){savedDialogPageUrl=_dialogPageUrl;_dialogPageUrl=fnAppendUrl(_dialogPageUrl,"inDialog","true");
fillDivWithPage(fillContentDivId,_dialogPageUrl,null,_fnOnshowHandlerProxy,"GET",true);}else{_fnOnshowHandlerProxy();}},closeDialog:function(){fnHide(dlgModalDom);currentDialog=null;},getDialogId:function(){return dialogId;}};};function getSimpleDialog(dialogId){for(i=0;i<_eComDialogs.length;i++){if(_eComDialogs[i].getDialogId()==dialogId){return _eComDialogs[i];
}}return null;}function _getDlgBoxHtml(dialogId,dialogTitle){return['<!--[if lte IE 6.5]><iframe></iframe><![endif]--><div id="_dlgBox',dialogId,'" class="dlg-box"><div class="dlg-title-box"><div class="dlg-title">',dialogTitle,'</div><div class="dlg-close-icon"><img src="',__ctxPath,'/images/dialog/close.gif" border="0" alt="',dialogId,'" onclick="closeSimpleDialog(this.alt);" /></div></div>','<div class="dlg-cont-box-out"><div class="dlg-cont-box-in" id="_dlgContBox',dialogId,'"></div></div></div>'].join("");
}function fnCreateSimpleDialog(dialogId,dialogTitle,dialogContent,config){var _dlg=getSimpleDialog(dialogId);if(!_dlg){config.dialogId=dialogId;config.dialogTitle=dialogTitle;config.dialogContent=dialogContent;_dlg=new eCom.SimpleDialog(config);_eComDialogs.push(_dlg);}return _dlg;}function showSimpleDialog(dialogId){var _dlg=getSimpleDialog(dialogId);
if(_dlg){_dlg.showDialog();}}function closeSimpleDialog(dialogId){var _dlg=getSimpleDialog(dialogId);if(_dlg){_dlg.closeDialog();}}function _ajaxReadyStateHandler(xhr,sUrl,ajaxCallback,ajaxErrorCallbackHandler){var readyState=xhr.readyState;if(readyState==4){var httpStatus=xhr.status;if(httpStatus>=200&&httpStatus<300){ajaxCallback.call(this,xhr.responseText);
}else{var errMsg="ERROR request: "+sUrl+"\n\nReadyState: "+readyState+"\nStatus: "+httpStatus+"\nHeaders: "+xhr.getAllResponseHeaders();var _ajaxErrorHandler=ajaxErrorCallbackHandler||_defaultAjaxErrorHandler;_ajaxErrorHandler.call(this,errMsg,xhr);}}}function ajaxCall(prmUrl,prms,postOrGet,async,ajaxCallback,ajaxErrorCallbackHandler){var xhr=null;
if(window.ActiveXObject){xhr=new ActiveXObject("Msxml2.XMLHTTP");}else{if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}}if(xhr==null){return alert("XMLHttpRequest is not supported!");}var sUrl=prmUrl;if((prms&&prms.length>0)&&(postOrGet!="POST")){sUrl+=(sUrl.match(/\?/)?"&":"?")+prms;}var _async=async==null?true:async;
if(_async){xhr.onreadystatechange=function(){_ajaxReadyStateHandler(xhr,sUrl,ajaxCallback,ajaxErrorCallbackHandler);};}xhr.open(postOrGet,sUrl,_async);xhr.send(postOrGet=="POST"?prms:null);if(!_async){_ajaxReadyStateHandler(xhr,sUrl,ajaxCallback,ajaxErrorCallbackHandler);}}function fillDivWithPage(prmDivId,prmUrl,prms,fillCallback,postOrGet,async){if(prms==null||prms==""){postOrGet="GET";
}ajaxCall(prmUrl,prms,postOrGet||"POST",async,function(responseText){var target=$(prmDivId);if(document.createRange){var rng=document.createRange();rng.setStartBefore(target);var htmlFrag=rng.createContextualFragment(responseText);while(target.hasChildNodes()){target.removeChild(target.lastChild);}target.appendChild(htmlFrag);
}else{target.innerHTML=responseText;}if(fillCallback){fillCallback.call(this);}});}function _isLoaded(url){var ss=document.getElementsByTagName(url.toLowerCase().lastIndexOf(".css")>0?"link":"script");for(i=0;i<ss.length;i++){var _url=ss.href||ss[i].src||ss[i].syncUrl;if(_url&&_url.indexOf(url)!=-1){return true;
}}return false;}function $importSync(url,defer){if(_isLoaded(url)){return;}ajaxCall(url.indexOf(__ctxPath)==0?url:(__ctxPath+url),null,"GET",false,function(responseText){if(responseText!=null){var oHead=document.getElementsByTagName("head")[0];var oScript=document.createElement("script");oScript.type="text/javascript";
oScript.defer=defer||true;oScript.text=responseText;oScript.syncUrl=url;oHead.appendChild(oScript);}},function(){alert("Failed to load script: "+url);});}function JsCssLoader(){this.load=function(url){if(_isLoaded(url)){this.onsuccess();return;}if(url.toLowerCase().lastIndexOf(".css")>0){var s=document.createElement("link");
s.setAttribute("rel","stylesheet");s.setAttribute("type","text/css");s.setAttribute("href",url);}else{var s=document.createElement("script");s.type="text/javascript";s.src=url;}var head=document.getElementsByTagName("head")[0];head.appendChild(s);var self=this;s.onload=s.onreadystatechange=function(){if(s.readyState&&s.readyState=="loading"){return;
}self.onsuccess(url);};s.onerror=function(){head.removeChild(s);self.onfailure(url,arguments);};};this.onsuccess=function(url){};this.onfailure=function(url,args){alert("Error loading JavaScript/StyleSheet: "+args[0]+" -- "+args[1]+" -- "+args[2]);};}function $import(urls,callback){if(!(urls instanceof Array)){alert("Invalid $import call syntax, must be array.");
return;}var _loader=new JsCssLoader();if(urls.length>1){_loader.onsuccess=function(){$import(urls.slice(1,urls.length),callback);};}else{if(callback){_loader.onsuccess=callback;}}_loader.load(urls[0].indexOf(__ctxPath)==0?urls[0]:(__ctxPath+urls[0]));}function $importDwr(callback){$import(["/scripts/dwr/engine.js","/scripts/dwr/util.js"],callback);
}function getJSON(url,param,callback){ajaxCall(url.indexOf(__ctxPath)==0?url:(__ctxPath+url),param,"GET",false,function(responseText){callback.call(this,eval("("+responseText+")"));},function(){alert("Failed to get JSON: "+url);});}function fnValidateEmail(obj){var str=obj.value;var patn=/^[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]*)*@[a-zA-Z0-9\-]+([\.][a-zA-Z0-9\-]+)+$/;
if(patn.test(str)){return true;}else{return false;}}function fnHidePop(e,id){e=e||window.event;o=e.relatedTarget||e.toElement;if(o==null){return;}while(o.parentNode&&o.id!=id){o=o.parentNode;}if(o.id!=id){$(id).style.display="none";}}addOnload(fillLoginPrompt);var ShoppingcartManager=function(){};function p_importCartDwr(callback){$import(["/scripts/dwr/engine.js","/scripts/dwr/util.js","/dwr/interface/shoppingcartDwr.js"],callback);}ShoppingcartManager.addToC=function(skuCode,pSkuCodes,quantity){this.$add(skuCode,pSkuCodes,quantity,1);};ShoppingcartManager.addToF=function(skuCode,pSkuCodes,quantity){this.$add(skuCode,pSkuCodes,quantity,0);
};ShoppingcartManager.$add=function(skuCode,pSkuCodes,quantity,type){if($cm.isBusy){return;}else{$cm.isBusy=true;setTimeout("$cm.isBusy=false",1000);}var obj=getEventSourceObject();var oldSrc="";var proSrc=__ctxPath+"/images/btn/btn_add_to_cart_loading.gif";if(type==0){if(pSkuCodes==null||pSkuCodes.length==0){p_importCartDwr(function(){shoppingcartDwr._addProductToFavorite(skuCode,quantity,function(data){if(data=="ok"){ShoppingcartManager.alert(skuCode,0,obj);
}else{alert(__FMT.notAnonymousF);}});});}else{p_importCartDwr(function(){shoppingcartDwr._addMultiProductToCart(skuCode,pSkuCodes,quantity,true,function(data){if(data=="ok"){ShoppingcartManager.alert(skuCode,0,obj);}else{alert(__FMT.notAnonymousF);}});});}}else{if(type==1){if(obj.src){oldSrc=obj.src;
var w=obj.offsetWidth;var h=obj.offsetHeight;obj.src=proSrc;}if(pSkuCodes==null||pSkuCodes.length==0){p_importCartDwr(function(){shoppingcartDwr._addProductToCart(skuCode,quantity,function(data){data=data.split(":");if(data[0]==__FMT.cannotMoveToC){alert(data[1]+__FMT.update_stockNotEnough);}else{if(data[0]==__FMT.noMoreInvetory){alert(data[1]+__FMT.update_noMoreInventory);
}else{ShoppingcartManager.alert(skuCode,1,obj);}}if(oldSrc.length>1){obj.src=oldSrc;}});});}else{p_importCartDwr(function(){shoppingcartDwr._addMultiProductToCart(skuCode,pSkuCodes,quantity,false,function(data){data=data.split(":");if(data[0]==__FMT.cannotMoveToC){alert(data[1]+__FMT.update_stockNotEnough);
}else{if(data[0]==__FMT.noMoreInvetory){alert(data[1]+__FMT.update_noMoreInventory);}else{ShoppingcartManager.alert(skuCode,1,obj);}}if(oldSrc.length>1){obj.src=oldSrc;}});});}}}};ShoppingcartManager.updateCartItem=function(cItemId,skuCode,quantity){p_importCartDwr(function(){shoppingcartDwr._updateItem(cItemId,skuCode,quantity,function(data){data=data.split(":");
if(data[0]==__FMT.cannotMoveToC){alert(data[1]+__FMT.update_stockNotEnough);return false;}else{if(data[0]==__FMT.noMoreInvetory){alert(data[1]+__FMT.update_noMoreInventory);ShoppingcartManager.goToCart();}else{ShoppingcartManager.goToCart();}}});});};ShoppingcartManager.moveToC=function(skuCode){var cartid=getCookie(__FMT.minicart_id_cookie);
p_importCartDwr(function(){shoppingcartDwr.moveFavoriteItemToCart(cartid,skuCode,function(data){data=data.split(":");if(data[0]==__FMT.cannotMoveToC){alert(data[1]+__FMT.move_stockNotEnough);return false;}else{if(data[0]==__FMT.noMoreInvetory){alert(data[1]+__FMT.update_noMoreInventory);}else{ShoppingcartManager.goToCart();
}}});});};ShoppingcartManager.moveToF=function(skuCode){var cartid=getCookie(__FMT.minicart_id_cookie);p_importCartDwr(function(){DWREngine.setAsync(false);shoppingcartDwr.moveCartItemToFavorite(cartid,skuCode,function(data){if(data=="ok"){ShoppingcartManager.goToCart();}else{alert(__FMT.notAnonymousF);
}});DWREngine.setAsync(true);});};ShoppingcartManager.clearC=function(){var cartid=getCookie(__FMT.minicart_id_cookie);p_importCartDwr(function(){shoppingcartDwr.clearC(cartid,function(data){ShoppingcartManager.goToCart();});});};ShoppingcartManager.clearF=function(){var cartid=getCookie(__FMT.minicart_id_cookie);
p_importCartDwr(function(){shoppingcartDwr.clearF(cartid,function(data){ShoppingcartManager.goToCart();});});};ShoppingcartManager.refresh=function(){p_importCartDwr(function(){shoppingcartDwr.refresh(getCookie(__FMT.minicart_id_cookie),function(data){ShoppingcartManager.goToCart();});});};ShoppingcartManager.deleteItem=function(itemId){var cartid=getCookie(__FMT.minicart_id_cookie);
p_importCartDwr(function(){shoppingcartDwr.deleteItem(cartid,itemId,function(data){ShoppingcartManager.goToCart();});});};ShoppingcartManager.goToCart=function(){window.location.href=__ctxPath+"/cart/shoppingcart.html";};ShoppingcartManager.useCoupon=function(no){p_importCartDwr(function(){shoppingcartDwr.useCoupon(no,function(data){if(data==__FMT.coupon_INVALID_v){alert(__FMT.coupon_INVALID);
return false;}else{if(data==__FMT.coupon_INVALID_NOT_ACTIVE_v){alert(__FMT.coupon_INVALID_NOT_ACTIVE);return false;}else{if(data==__FMT.coupon_INVALID_IS_END_v){alert(__FMT.coupon_INVALID_IS_END);return false;}else{if(data==__FMT.coupon_INVALID_NOT_START_v){alert(__FMT.coupon_INVALID_NOT_START);return false;
}else{if(data==__FMT.coupon_INVALID_ZERO_v){alert(__FMT.coupon_INVALID_ZERO);return false;}else{ShoppingcartManager.goToCart();}}}}}});});};ShoppingcartManager.notUseCoupon=function(){p_importCartDwr(function(){shoppingcartDwr.notUseCoupon(function(data){if(data=="ok"){ShoppingcartManager.goToCart();
}else{alert(data);}});});};ShoppingcartManager.alert=function(skucode,type,$obj){this.wins=[];var popuw=function(skucode,type){this.skucode=skucode;this.type=type;this.$obj=$obj;};popuw.prototype={id:"shoppingcartAlertWId_",skucode:"",type:1,messageDlgZIndex:1000,$obj:"",html:'<div class="zindex-color-top"><img src="/images/layout/cart_top.gif" /></div>'+'<div class="zindex-color">'+'<div class="zindex-content-color">'+'<div class="layer-btn">'+'<a href="javascript:void%200;" onclick="$cm.wins.pop().closeMessageDlg();"><img src="/images/btn/btn_close.gif" width="13px" height="13px"/></a>'+"</div>"+'<div class="layer-wrap">'+__FMT.minicart_addToCartSuccess+"<br/>"+"?type?(?Icount?&nbsp;)"+'<div class="dashed-line"></div><a href="'+__ctxPath+'/cart/shoppingcart.html"><img src="'+__ctxPath+'/images/btn/btn_add.gif" alt="view bag"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="'+__ctxPath+'/checkout/checkout.html"><img src="'+__ctxPath+'/images/btn/btn_check.gif" alt="checkout"/></a>'+"</div>"+"</div>"+"</div>",show:function(){var msg;
if(!$(this.id)){msg=document.createElement("div");msg.id=this.id;msg.className="cart-layer";}else{msg=$(this.id);}if(this.type==1){var itemcount=getCookie(__FMT.c_itemcount_cookie);itemcount=itemcount==null?"0":itemcount;var subtotal=getCookie(__FMT.minicart_totalprice_cookie);subtotal=subtotal==null?__defaultCurrencySymbol+"0.00":__defaultCurrencySymbol+subtotal;
this.html=this.html.replace("?Icount?",""+itemcount+""+__FMT.minicart_unit+""+subtotal+"");this.html=this.html.replace("?type?",__FMT.minicart_cart);}else{this.html=this.html.replace("?Icount?",getCookie(__FMT.f_itemcount_cookie));this.html=this.html.replace("?type?",__FMT.favorite_);}msg.innerHTML=this.html;
$obj.parentNode.appendChild(msg);if($mnc){$mnc.refresh();}},setPostion:function(o){var p=getElementPos(this.$obj);o.style.position="absolute";o.style.top=$obj.offsetHeight+p.y+5+"px";o.style.left=p.x-$obj.offsetWidth/2+"px";},closeMessageDlg:function(){var messageDlgDom=$(this.id);if(messageDlgDom){messageDlgDom.parentNode.removeChild(messageDlgDom);
}}};var win=new popuw(skucode,type);win.show();this.wins.push(win);};ShoppingcartManager.minicart=function(){};ShoppingcartManager.minicart.prototype={div:"minicartDiv",refresh:function(){var d=$(this.div);if(d!=null){var itemcount=getCookie(__FMT.c_itemcount_cookie);itemcount=itemcount==null?"0":itemcount;
var subtotal=getCookie(__FMT.minicart_totalprice_cookie);subtotal=subtotal==null?__defaultCurrencySymbol+"0.00":__defaultCurrencySymbol+subtotal;$(this.div).innerHTML=itemcount+" items in your bag";}}};var $mnc;addOnload(function(){$mnc=new ShoppingcartManager.minicart();$mnc.refresh();});$cm=ShoppingcartManager;
