var xmlHttpObj_1;var xmlHttpObj_2;var xmlHttpObj_3;var xmlHttpObj_4;var firstCall=true;var productOptionsContainer;var radioButtons;var accountInfoContainer;var filterAttribute='fid';var productsPriceContainer;function getFilter(){var a=$(document.body).getElements('select');var b=new Array();for(var i=0;i<a.length;i++)if(a[i].getAttribute(filterAttribute)=='1')b.push(a[i]);return b}function setFilter(a,b){var c=getFilter();for(var i=0;i<c.length;i++)if(c[i].get('id')==a)var d=c[i];if(!d)doForward();d.set('selected',b);doForward(d)}function getFilterAsParams(a,b){var c=getFilter();if(!b)for(var i=0;i<c.length;i++)c[i].set('disabled',true);var d=new Array();d.push('current_category_id='+CURRENT_CATEGORY_ID);var e=0;for(var i=0;i<c.length;i++){d.push(c[i].name+'='+(!e?c[i].get('value'):'-1'));if(a)if(c[i].name==a)e=1}return d}function fetchProducts(a){if(!xmlHttpObj_1)xmlHttpObj_1=new CXmlHttp();if(!xmlHttpObj_2)xmlHttpObj_2=new CXmlHttp();var b=$('productListContainer');xmlHttpObj_1.showLoadingScreen(b);var c=(a?a.name:undefined);var d=getFilterAsParams(c);if(!firstCall){if(xmlHttpObj_2.setXmlHttpObj()==null)return;xmlHttpObj_2.sendXmlHttp('fetchProductsFilter','fetch_products_filter.ajax.php',d.join("&"))}else{firstCall=false;xmlHttp_fetchProductsFilter('')}if(xmlHttpObj_1.setXmlHttpObj()==null)return;xmlHttpObj_1.sendXmlHttp('fetchProducts','fetch_products.ajax.php',d.join("&"))}function xmlHttp_fetchProducts(a){if(a.length>0){$('productListContainer').set('html',a);fetchSlidePid()}}function fetchSlidePid(a){if(!xmlHttpObj_4)xmlHttpObj_4=new CXmlHttp();var b=(a?a.name:undefined);var c=getFilterAsParams(b,true);if(xmlHttpObj_4.setXmlHttpObj()==null)return;xmlHttpObj_4.sendXmlHttp('fetchSlidePid','fetch_slide_pid.ajax.php',c.join("&"))}function xmlHttp_fetchSlidePid(a){if(a.length>0){try{eval(a)}catch(e){}}}function xmlHttp_fetchProductsFilter(a){if(a.length>0)$('productListFilterContainer').set('html',a);var b=getFilter();for(var i=0;i<b.length;i++)b[i].set('disabled',false)}function doForward(a){if(B_DO_FORWARD){if(!xmlHttpObj_4)xmlHttpObj_4=new CXmlHttp();var b=$('productListContainer');xmlHttpObj_4.showLoadingScreen(b);var c=(a?a.name:undefined);var d=getFilterAsParams(c);if(xmlHttpObj_4.setXmlHttpObj()==null)return;xmlHttpObj_4.sendXmlHttp('doForward','do_forward.ajax.php',d.join("&"))}else fetchProducts(a)}function xmlHttp_doForward(a){if(a.length>0)window.location.href=a}function fetchProductOptions(a){if(!xmlHttpObj_1)xmlHttpObj_1=new CXmlHttp();if(!xmlHttpObj_2)xmlHttpObj_2=new CXmlHttp();showPageOverlay();buildProductsOptionsContainer();var b=$('productOptionsContainerContent');xmlHttpObj_1.showLoadingScreen(b);enableEscapeKey();$('productTitle').set('html','');var c=getFilterAsParams(undefined,true);c.push('pid='+a);if(xmlHttpObj_2.setXmlHttpObj()==null)return false;xmlHttpObj_2.sendXmlHttp('fetchProductTitle','fetch_product_title.ajax.php',c.join("&")+"&price=1");if(xmlHttpObj_1.setXmlHttpObj()==null)return false;xmlHttpObj_1.sendXmlHttp('fetchProductOptions','fetch_product_options.ajax.php',c.join("&"));return false}function xmlHttp_fetchProductOptions(a){$('productOptionsContainerContent').set('html',a);if($('productTitleAlternative')){var b=$('productTitle').get('html');$('productTitleAlternative').set('html',b)}var c=$('firstOption');fetchOptionValues(c)}function xmlHttp_fetchProductTitle(a){$('productTitle').set('html',a)}function buildProductsOptionsContainer(){if(!productOptionsContainer){productOptionsContainer=new Element('div',{'id':'productOptionsContainer','class':'productOptionsContainer'});var a=new Element('div',{'id':'productOptionsContainerTitlebar','class':'productOptionsContainerTitlebar','html':'<div style="float:left;" id="productTitle"></div><div style="float:right;"><a href="javascript:hideProductOptions();"><img src="templates/'+CURRENT_TEMPLATE+'/buttons/'+CURRENT_LANGUAGE+'/icon_delete.gif" /></a></div><br class="clearBoth" /><div style="width:100%;height:0px;"><!-- IE 4TW --></div>'});productOptionsContainer.adopt(a);var b=new Element('div',{'id':'productOptionsContainerContent','class':'productOptionsContainerContent'});productOptionsContainer.adopt(b);$(document.body).adopt(productOptionsContainer);var c=getScrollTop();c=(c+200);productOptionsContainer.setStyle('top',c+'px');var e=true;var f=125;var d=new Drag(productOptionsContainer,{handle:$('productOptionsContainerTitlebar')})}if(window.addRoundedShadow){if(!b_productOptionsContainerShadow){b_productOptionsContainerShadow=true;addRoundedShadow(productOptionsContainer,'javascript:hideProductOptions()')}}var g=getClientWidth();var h=(g/2)-257;productOptionsContainer.setStyle('left',h+'px');productOptionsContainer.setStyle('display','block');productOptionsContainer.pin()}function hideProductOptions(){hidePageOverlay();filterAttribute='fid';if(CURRENT_CATEGORY_ID_bak)CURRENT_CATEGORY_ID=CURRENT_CATEGORY_ID_bak;productOptionsContainer.setStyle('display','none');disableEscapeKey()}function fetchOptionValues(b){b=$(b);var c=$('buttonInCart');c.set('disabled',true);radioButtons=$$('input[name="'+b.get('name')+'"]');radioButtons.each(function(a){a.set('disabled',true)});var d=$('inCartErrorContainer');d.setStyle('display','none');var e=$('productOptionsContainerContentOptionValues');if(!xmlHttpObj_3)xmlHttpObj_3=new CXmlHttp();xmlHttpObj_3.showLoadingScreen(e);var f=$('products_id').value;var g=getFilterAsParams(undefined,true);g.push('pid='+f);g.push('option='+b.value);if(xmlHttpObj_3.setXmlHttpObj()==null)return;xmlHttpObj_3.sendXmlHttp('fetchOptionValues','fetch_option_values.ajax.php',g.join("&"))}function xmlHttp_fetchOptionValues(b){$('productOptionsContainerContentOptionValues').set('html',b);radioButtons.each(function(a){a.set('disabled',false)});var c=$('buttonInCart');c.set('disabled',false)}function doInCartCheck(){var a=$('inCartCheckMandatory').value;var b=$('inCartCheck').value;if(a.length==0&&b.length==0)return true;var c=a.split(",");var d=b.split(",");var e=false;var f=false;for(var i=0;i<c.length;i++){f=false;var g=$('option_'+c[i]);if(!g)f=true;if(!f)if(g.get('value')==""||g.get('value')=="0")f=true;if(f&&!e)e=true;g.setStyle('border',(f?'1px solid #f00':'1px solid #9b9b9b'))}if(d.contains('4')&&d.contains('9')){var h=$('option_4');var j=$('option_9');if(h.value.toLowerCase()==j.value.toLowerCase()){h.setStyle('border','1px solid #f00');j.setStyle('border','1px solid #f00');e=true}}if(d.contains('17')&&d.contains('18')){var k=$('option_17');var l=$('option_18');if(!isNaN(parseInt(k.get('selected').get('text')))&&!isNaN(parseInt(l.get('selected').get('text')))){if(parseInt(k.get('selected').get('text'))>=parseInt(l.get('selected').get('text'))){k.setStyle('border','1px solid #f00');l.setStyle('border','1px solid #f00');e=true}}}if(e){var m=$('inCartErrorContainer');m.setStyle('display','block')}if(!e){for(var i=0;i<d.length;i++){var g=$('option_'+d[i]);if(g)if(g.get('value')==""||g.get('value')=="0")g.set('disabled',true)}}return!e}function showAccountInfo(a){showAccountInfoContainer();fetchAccountInfo(a)}function showAccountInfoContainer(){if(!accountInfoContainer){accountInfoContainer=new Element('div',{'id':'accountInfoContainer','class':'accountInfoContainer'});var a=new Element('div',{'id':'accountInfoTitleContainer','class':'accountInfoTitleContainer'});var b=new Element('div',{'id':'accountInfoTitle','class':'accountInfoTitle','html':'Account Details'});a.adopt(b);var c=new Element('div',{'id':'accountInfoClose','class':'accountInfoClose','html':'<a href="javascript:hideAccountInfo();"><img src="templates/'+CURRENT_TEMPLATE+'/buttons/'+CURRENT_LANGUAGE+'/icon_delete.gif" alt="close" /></a>'});a.adopt(c);accountInfoContainer.adopt(a);var d=new Element('div',{'id':'accountInfoContent','class':'accountInfoContent'});accountInfoContainer.adopt(d);$(document.body).adopt(accountInfoContainer)}var e=getClientWidth();var f=getClientHeight();var g=getScrollTop();var h=(e/2)-250;var g=(g+(f/2)-300);accountInfoContainer.setStyle('left',Math.floor(h)+'px');accountInfoContainer.setStyle('top',Math.floor(g)+'px');showPageOverlay();accountInfoContainer.setStyle('display','block');enableEscapeKey()}function hideAccountInfo(){if(accountInfoContainer)accountInfoContainer.setStyle('display','none');hidePageOverlay();disableEscapeKey()}function fetchAccountInfo(a){if(!xmlHttpObj_4)xmlHttpObj_4=new CXmlHttp();var b=$('accountInfoContent');xmlHttpObj_4.showLoadingScreen(b);var c=new Array();c.push('refid='+a);if(xmlHttpObj_4.setXmlHttpObj()==null)return;xmlHttpObj_4.sendXmlHttp('fetchAccountInfo','fetch_account_info.ajax.php',c.join("&"))}function xmlHttp_fetchAccountInfo(a){$('accountInfoContent').set('html',a)}function toggleAccountTwinks(a){if(a=='first'){for(var b in ar_id2twink){if(ar_id2twink.hasOwnProperty(b))a=b;break}}var c=(document.getElementById('slideContainer_'+ar_id2twink[a][0]).style.display=='none'?'':'none');for(var i=0;i<ar_id2twink[a].length;i++)document.getElementById('slideContainer_'+ar_id2twink[a][i]).style.display=c;var d=$('slideButton_'+a);d.set('src',(c=='none'?'templates/'+CURRENT_TEMPLATE+'/img/plus.gif':'templates/'+CURRENT_TEMPLATE+'/img/minus.gif'));var e=$('slideCell_'+a);e.setStyle('background-position','left center');e.setStyle('background-repeat','no-repeat');e.setStyle('background-image',(c=='none'?'url(\'\')':'url(\'templates/'+CURRENT_TEMPLATE+'/img/minus_bg.gif\')'))}var curLinkObj;function showContainerTable(a,b){if(!curLinkObj)curLinkObj=$('charList_All');if(b!='charList_All'){var c=document.getElementsByTagName('div');for(var i=0;i<c.length;i++)if(c[i].getAttribute('backToTop')=='1')$(c[i]).setStyle('display','none');for(var i=0;i<c.length;i++)if(c[i].getAttribute('containerTable')=='1')$(c[i]).setStyle('display','none');$('containerTable_'+a).setStyle('display','block')}else{var c=document.getElementsByTagName('div');for(var i=0;i<c.length;i++)if(c[i].getAttribute('backToTop')=='1')$(c[i]).setStyle('display','block');for(var i=0;i<c.length;i++)if(c[i].getAttribute('containerTable')=='1')$(c[i]).setStyle('display','block')}curLinkObj.set('class','smallText');curLinkObj=$(b);curLinkObj.set('class','smallBoldText')}function fetchLevelPrice(a){var b=false;var c=$('individual_start_'+a);var d=$('individual_end_'+a);if(isNaN(parseInt(c.get('selected').get('text')))||isNaN(parseInt(d.get('selected').get('text'))))b=true;if(!b)if(parseInt(c.get('selected').get('text'))>parseInt(d.get('selected').get('text')))d.set('selectedIndex',c.get('selectedIndex'));if(!b){if(!xmlHttpObj_1)xmlHttpObj_1=new CXmlHttp();productsPriceContainer=$('productsPriceContainer_'+a);xmlHttpObj_1.showLoadingScreen(productsPriceContainer);var e=new Array();e.push('current_category_id='+CURRENT_CATEGORY_ID);e.push('pid='+a);e.push('s='+c.get('value'));e.push('e='+d.get('value'));if(xmlHttpObj_1.setXmlHttpObj()==null)return;xmlHttpObj_1.sendXmlHttp('fetchLevelPrice','fetch_level_price.ajax.php',e.join("&"))}}function xmlHttp_fetchLevelPrice(a){productsPriceContainer.set('html',a)}function fetchLevelPricePOC(a,b,c){var d=false;var e=$('option_'+b);var f=$('option_'+c);if(isNaN(parseInt(e.get('selected').get('text')))||isNaN(parseInt(f.get('selected').get('text'))))d=true;if(!d)if(parseInt(e.get('selected').get('text'))>parseInt(f.get('selected').get('text')))f.set('selectedIndex',e.get('selectedIndex'));if(!d){if(!xmlHttpObj_1)xmlHttpObj_1=new CXmlHttp();productsPriceContainer=$('productsPriceContainer');xmlHttpObj_1.showLoadingScreen(productsPriceContainer);var g=new Array();g.push('current_category_id='+CURRENT_CATEGORY_ID);g.push('pid='+a);g.push('s='+e.get('value'));g.push('e='+f.get('value'));g.push('POC=1');if(xmlHttpObj_1.setXmlHttpObj()==null)return;xmlHttpObj_1.sendXmlHttp('fetchLevelPricePOC','fetch_level_price.ajax.php',g.join("&"))}}function xmlHttp_fetchLevelPricePOC(a){productsPriceContainer.set('html',a)}function fetchProductOptionsIL(a){filterAttribute='il_fid';return fetchProductOptions(a)}function fetchAlsoPurchased(a,b,c){fetchAlsoPurchasedPage(a,b,c);if(!xmlHttpObj_1)xmlHttpObj_1=new CXmlHttp();var d=new Array();d.push('pid='+a);d.push('offset='+b);d.push('direction='+c);if(xmlHttpObj_1.setXmlHttpObj()==null)return;var e=$('alsoPurchasedContainer');xmlHttpObj_1.showLoadingScreen(e);xmlHttpObj_1.sendXmlHttp('fetchAlsoPurchased','fetch_also_purchased.ajax.php',d.join("&"))}function xmlHttp_fetchAlsoPurchased(a){$('alsoPurchasedContainer').set('html',a)}function fetchAlsoPurchasedPage(a,b,c){if(!xmlHttpObj_2)xmlHttpObj_2=new CXmlHttp();var d=new Array();d.push('pid='+a);d.push('offset='+b);d.push('direction='+c);d.push('pageCount=1');if(xmlHttpObj_2.setXmlHttpObj()==null)return;xmlHttpObj_2.sendXmlHttp('fetchAlsoPurchasedPage','fetch_also_purchased.ajax.php',d.join("&"))}function xmlHttp_fetchAlsoPurchasedPage(a){$('alsoPurchasedPageContainer').set('html',a)}