var LOOPSURF=LOOPSURF||{};(function(){var c=navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1,f=navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1;LOOPSURF.loopImg=jQuery.browser.msie&&(c||f)?"gif":"png"})();
LOOPSURF.writeLoop=function(c,f,e,a){var b=LOOPSURF.splitTitleIfNec;document.write('<td align=center nowrap class="'+c+'"><img name="loopimg-'+f+'" src="images/loop_icon2.'+LOOPSURF.loopImg+'" alt="loop_icon" /><br/><a onfocus="this.hideFocus=true; " class="'+c+'" name="looptext-'+f+'" href=# >'+b(e)+"</a><br/>"+a+"</td>")};
LOOPSURF.splitTitleIfNec=function(c){var f=false;if(c.length>12){var e=c.length/2,a=e;for(e=e+1;f===false&&a>=0&&e<c.length;){var b=c.substring(a,a+1);if(b===" "){c=c.substring(0,a)+"<br/>"+c.substring(a);f=true}else{b=c.substring(e,e+1);if(b===" "){c=c.substring(0,e)+"<br/>"+c.substring(e);f=true}}a--;e++}}return c};
LOOPSURF.writeMenu=function(){document.write('<ul id="topmenu">');for(var c=LOOPSURF.loopData.pages,f=0;f<c.length;f++)document.write('<li><a name="pagemenu-'+f+'" id="pagemenu-'+f+'"href="#" '+(f==0?'class="first"':"")+">"+c[f]+"</a></li>");document.write('<li><a name="pagemenu-103" id="pagemenu-103" href="#">contact</a></li><li><a name="pagemenu-100" id="pagemenu-100" href="#">faq</a></li></ul>')};
LOOPSURF.writeLoops=function(){var c=LOOPSURF.writeLoop;LOOPSURF.loopImg==="png"?document.write('<div id="main-page-area" style="background-image:url(\'../images/waves_background3.png\');">'):document.write('<div id="main-page-area">');for(var f=LOOPSURF.loopData.pages,e=0;e<f.length;e++){document.write('<div id="page-'+e+'" class="'+(e==0?"active-page":"inactive-page")+' loop-page">');for(var a=LOOPSURF.loopData.categoryData[e].categoryList,b=LOOPSURF.loopData.categoryData[e].loops,d=0;d<a.length;d++){document.write('<span class="loop-row-title"><br/>'+
a[d]+"<br/></span>");document.write('<table class="loops"><tr>');for(var g=b[d],h=0;h<g.length;h++){var i=g[h];c("loops",i[0],i[1],e===0?"":"("+i[3]+" Items)");h%5==4&&e!==0&&document.write("</tr><tr>")}e==0&&document.write('<td align=center valign=middle nowrap class="loops"><a onfocus="this.hideFocus=true; " class="loops seeall" name="seeall-'+LOOPSURF.loopData.seeAll[d]+'" href=# ><br/><br/>SEE ALL<br/>BRANDS</a></td>');document.write("</tr></table>")}document.write("</div>")}};
LOOPSURF.writeLoopsEnd=function(){document.write("</div>")};LOOPSURF.writeSearch=function(){};LOOPSURF=LOOPSURF||{};LOOPSURF.mainPageConfig={windowWidth:450,windowHeight:700};LOOPSURF=LOOPSURF||{};
LOOPSURF.MainPage=function(){var c=this;this.activePageLink=this.activePage="0";var f=Math.floor(Math.random()*1E4),e=0;this.newWindowDataStore={};this.getNewWindowName=function(){return"win"+f+e++};this.trim=function(a){a.replace(/^\s*/,"").replace(/\s*$/,"");return a};this.getPriceRange=function(){var a=jQuery("#pricefilter input[type=radio]:checked").val();if(a==="any")return{};else if(a==="custom"){a=jQuery("#minprice").val();var b=jQuery("#maxprice").val();if(a===undefined||b===undefined){alert("Please enter a minimum and a maximum price value");
return null}a=this.trim(a);b=this.trim(b);if(a.length===0||b.length===0){alert("Please enter a minimum and a maximum price value");return null}if(a.match(/^[\d.]+$/)===null||b.match(/^[\d.]+$/)===null){alert("Please enter only numbers for price values");return null}return{MinimumPrice:a*100,MaximumPrice:b*100}}else{a=a.split("-");return{MinimumPrice:a[0]*100,MaximumPrice:a[1]*100}}};this.getRequestParams=function(a){var b={},d=jQuery("#keywordsfilter").val();if(d===undefined){alert("Please enter some keywords");
return null}d=this.trim(d);if(d.length===0){alert("Please enter some keywords");return null}b.Keywords=d;d=this.getPriceRange();if(d===null)return null;for(attrName in d)b[attrName]=d[attrName];if(a==="all")b.SearchIndex="All";else{a=jQuery("#department option:selected").val();b.SearchIndex=a}b.type="S";b.search="true";return b};this.loopClicked=function(a){a=a.target.name;if(a!==undefined){if(a==="department")return false;if(a.substring(0,6)==="seeall")return false;a=a.substring(a.indexOf("-")+1);
if(a==="all"||a==="dept"){a=this.getRequestParams(a);if(a===null)return false}else a=jQuery.extend(true,{},LOOPSURF.loopData.requestParams["loop"+a]);this.openNewWindow({loopSetupData:{requestParams:a,loopDelay:jQuery("#delayselect option:selected").val()}})}return false};this.openNewWindow=function(a){var b=LOOPSURF.mainPageConfig.windowWidth;if(b>window.screen.availWidth-20)b=window.screen.availWidth-20;var d=LOOPSURF.mainPageConfig.windowHeight;if(d>window.screen.availHeight-20)d=window.screen.availHeight-
20;var g=this.getNewWindowName();this.newWindowDataStore[g]=a;window.open("StartLoop.action",g,"width="+b+",height="+d+",menubar=1,resizable=1,scrollbars=1,status=0,toolbar=1,location=0").moveTo(1,1)};this.pageClicked=function(a){a=a.target.name;if(a!==undefined){var b=a.substring(a.indexOf("-")+1);jQuery("#page-"+this.activePage).removeClass("active-page");jQuery("#page-"+this.activePage).addClass("inactive-page");jQuery("#page-"+b).removeClass("inactive-page");jQuery("#page-"+b).addClass("active-page");
this.activePage=b;b=this.activePageLink.indexOf("bottom")>-1?"-bottom":"";var d=a.indexOf("bottom")>-1?"-bottom":"";jQuery("#"+this.activePageLink).removeClass("active-page-link"+b);jQuery("#"+this.activePageLink).addClass("inactive-page-link"+b);jQuery("#"+a).removeClass("inactive-page-link"+d);jQuery("#"+a).addClass("active-page-link"+d);this.activePageLink=a}return false};this.contactSubmitted=function(a){jQuery.ajax({type:"GET",timeout:1E4,url:"http://www.shoploops.com/Contact.action",data:{email:jQuery("#contactemail").val(),
text:jQuery("#contacttext").val()},dataType:"html",error:function(b,d,g){c.sendError(b,d,g)},success:function(b){c.sendSuccess(b)}});a.target.name="pagemenu-104";c.pageClicked(a);return false};this.sendError=function(){alert("Apologies - there was a problem sending your email. Please try again.")};this.sendSuccess=function(){};this.minMaxPriceChanged=function(){if(jQuery("#pricefilter input[type=radio]:checked").val()!=="custom"){jQuery("#pricefilter input[type=radio]:checked").attr("checked",false);
jQuery("#pricefiltercustom").attr("checked",true)}return false};this.clearFilters=function(){jQuery("#pricefilter input[type=radio]:checked").attr("checked",false);jQuery("#pricefilterany").attr("checked",true);jQuery("#keywordsfilter").val("");jQuery("#minprice").val("");jQuery("#maxprice").val("");return false};jQuery(document).ready(function(){jQuery(document).pngFix();jQuery(".loop-page").click(function(a){return c.loopClicked(a)});jQuery("#loop-all").submit(function(a){return c.loopClicked(a)});
jQuery("#topmenu").click(function(a){return c.pageClicked(a)});jQuery("#bottommenu").click(function(a){return c.pageClicked(a)});jQuery("#contact").submit(function(a){return c.contactSubmitted(a)});jQuery(".seeall").click(function(a){var b=a.target.name.substring(a.target.name.indexOf("-")+1);a.target.name="pagemenu-"+b;return c.pageClicked(a)});jQuery("#minprice").click(function(a){return c.minMaxPriceChanged(a)});jQuery("#maxprice").click(function(a){return c.minMaxPriceChanged(a)});jQuery("#clearfilters").click(function(a){return c.clearFilters(a)});
jQuery("#pagemenu-0").click()})};LOOPSURF.mainPage=new LOOPSURF.MainPage;

