$(document).ready(function(){if(document.all){$('#Menu li.HasSubMenu').hover(function(){$(this).addClass('over');return false;},function(){$(this).removeClass('over');});}});function get_cookie(name){name=name+="=";var cookie_start=document.cookie.indexOf(name);if(cookie_start>-1){cookie_start=cookie_start+name.length;cookie_end=document.cookie.indexOf(';',cookie_start);if(cookie_end==-1){cookie_end=document.cookie.length;}
return unescape(document.cookie.substring(cookie_start,cookie_end));}}
function set_cookie(name,value,expires)
{if(!expires){expires="; expires=Wed, 1 Jan 2020 00:00:00 GMT;"}else{expire=new Date();expire.setTime(expire.getTime()+(expires*1000));expires="; expires="+expire.toGMTString();}
document.cookie=name+"="+escape(value)+expires;}
var num_products_to_compare=0;var product_option_value="";function showProductImage(filename,product_id){var l=(screen.availWidth/2)-350;var t=(screen.availHeight/2)-300;var variationAdd='';if($('body').attr('currentVariation')!=''&&typeof($('body').attr('currentVariation'))!="undefined"){variationAdd='&variation_id='+$('body').attr('currentVariation');}
window.open(filename+"?product_id="+product_id+variationAdd,"imagePop","toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=600,top="+t+",left="+l);}
function check_add_to_cart(form,required){if(required&&!$(form).find('.CartVariationId').val()||($(form).find('select').get(0)&&$(form).find('select').get(0).selectedIndex>0&&!$(form).find('.CartVariationId').val())){alert(lang.OptionMessage);var select=$(form).find('select').get(0);if(select){select.focus();}
var radio=$(form).find('input[type=radio]').get(0);if(radio){radio.focus();}
return false;}
return true;}
function compareProducts(compare_path){var pids="";if(num_products_to_compare>=2){var cpids=document.getElementsByName('compare_product_ids');for(i=0;i<cpids.length;i++){if(cpids[i].checked)
pids=pids+cpids[i].value+"/";}
pids=pids.replace(/\/$/,"");document.location.href=compare_path+pids;return false;}
else{alert(lang.CompareSelectMessage);return false;}}
function product_comparison_box_changed(state){if(state)
num_products_to_compare++;else
num_products_to_compare--;}
function remove_product_from_comparison(id){if(num_compare_items>2){for(i=1;i<11;i++){document.getElementById("compare_"+i+"_"+id).style.display="none";}
num_compare_items--;}
else{alert(lang.CompareTwoProducts);}}
function show_product_review_form(){document.getElementById("rating_box").style.display="";document.location.href="#write_review";}
function jump_to_product_reviews(){document.location.href="#reviews";}
function g(id){return document.getElementById(id);}
function check_product_review_form(){var revrating=g("revrating");var revtitle=g("revtitle");var revtext=g("revtext");var revfromname=g("revfromname");var captcha=g("captcha");if(revrating.selectedIndex==0){alert(lang.ReviewNoRating);revrating.focus();return false;}
if(revtitle.value==""){alert(lang.ReviewNoTitle);revtitle.focus();return false;}
if(revtext.value==""){alert(lang.ReviewNoText);revtext.focus();return false;}
if(captcha.value==""&&HideReviewCaptcha!="none"){alert(lang.ReviewNoCaptcha);captcha.focus();return false;}
return true;}
function check_small_search_form(){var search_query=g("search_query");if(search_query.value==""){alert(lang.EmptySmallSearch);search_query.focus();return false;}
return true;}
function setCurrency(currencyId)
{var gotoURL=location.href;if(location.search!=='')
{if(gotoURL.search(/[&|\?]setCurrencyId=[0-9]+/)>-1)
gotoURL=gotoURL.replace(/([&|\?]setCurrencyId=)[0-9]+/,'$1'+currencyId);else
gotoURL=gotoURL+'&setCurrencyId='+currencyId;}
else
gotoURL=gotoURL+'?setCurrencyId='+currencyId;location.href=gotoURL;}
function sel_panel(id){}
function inline_add_to_cart(filename,product_id,quantity){if(typeof(quantity)=='undefined'){var quantity='1';}
$('body').append('<form action="'+filename+'/cart.php" method="post" id="inlineCartAdd"><input type="hidden" name="action" value="add" /><input type="hidden" name="qty" value="'+quantity+'" /><input type="hidden" name="product_id" value="'+product_id+'" /><\/form>');$('#inlineCartAdd').submit();}
var lang={};if(document.all){var isIE7=/*@cc_on@if(@_jscript_version>=5.7)!@end@*/false;if(isIE7==false){$(document).ready(function(){$('.ProductList li').hover(function(){$(this).addClass('Over');},function(){$(this).removeClass('Over');});$('.ComparisonTable tr').hover(function(){$(this).addClass('Over');},function(){$(this).removeClass('Over');});});}
$('.ProductList li:last-child').addClass('LastChild');}
$(document).ready(function(){$('.InitialFocus').focus();});if(typeof(ISSelectReplacement)=='undefined'){var ISSelectReplacement={init:function()
{if(window.addEventListener)
window.addEventListener('load',ISSelectReplacement.on_load,false);else
window.attachEvent('onload',ISSelectReplacement.on_load);},on_load:function()
{var selects=document.getElementsByTagName('SELECT');if(!selects)return false;for(var i=0;i<selects.length;i++)
{var select=selects[i];if(!select.multiple||select.className.indexOf('ISSelectReplacement')==-1||select.className.indexOf('ISSelectAlreadyReplaced')!=-1)continue;ISSelectReplacement.replace_select(selects[i]);}},replace_select:function(element)
{var name=element.name;element.style.visibility='hidden';var replacement=document.createElement('DIV');replacement.className="ISSelect "+element.className;replacement.className+=" ISSelectAlreadyReplaced";var hideSelectReplacement=false;if(element.offsetHeight==0)
{var clone=element.cloneNode(true);clone.style.position='absolute';clone.style.left='-10000px';clone.style.top='-10000px';clone.style.display='block';document.body.appendChild(clone);offset_height=clone.offsetHeight+"px";offset_width=clone.offsetWidth+"px";clone.parentNode.removeChild(clone);if(element.style.display&&element.style.display=='none'){var hideSelectReplacement=true;}}
else
{offset_height=element.offsetHeight+"px";offset_width=element.offsetWidth+"px";}
var style_offset_width=ISSelectReplacement.get_prop(element,'width');if(style_offset_width&&style_offset_width!="auto")offset_width=style_offset_width;var style_offset_height=ISSelectReplacement.get_prop(element,'height');if(style_offset_height&&style_offset_height!="auto")offset_height=style_offset_height;replacement.style.height=offset_height;if(parseInt(offset_width)<200){offset_width='200px';}
replacement.style.width=offset_width;if(element.id)
{replacement.id=element.id;element.id+="_old";}
if(hideSelectReplacement){replacement.style.display='none';}
replacement.select=element;replacement.options=element.options;replacement.selectedIndex=element.selectedIndex;this.select=element;this.replacement=replacement;if(element.onchange)
{replacement.onclick=function()
{$(this.select).trigger('change');}}
if(element.ondblclick)
{replacement.ondblclick=function()
{$(this.select).trigger('dblclick');}}
var innerhtml='<ul>';for(var i=0;i<element.childNodes.length;i++)
{if(!element.childNodes[i].tagName||element.nodeType==3)continue;if(element.childNodes[i].tagName=="OPTGROUP")
{innerhtml+=ISSelectReplacement.add_group(element,element.childNodes[i],i);}
else if(element.childNodes[i].tagName=="OPTION")
{innerhtml+=ISSelectReplacement.add_option(element,element.childNodes[i],i);}}
innerhtml+='</ul>';replacement.innerHTML=innerhtml;element.parentNode.insertBefore(replacement,element);element.style.display='none';},get_prop:function(element,prop)
{if(element.currentStyle)
{return element.currentStyle[prop];}
else if(document.defaultView&&document.defaultView.getComputedStyle)
{prop=prop.replace(/([A-Z])/g,"-$1");prop=prop.toLowerCase();return document.defaultView.getComputedStyle(element,"").getPropertyValue(prop);}},add_group:function(select,group,group_id)
{var extraClass='';if(group.className){extraClass=group.className;}
group_html='<li class="ISSelectGroup '+extraClass+'">'+
'<div>'+group.label+'</div>';if(group.childNodes)
{group_html+='<ul>';for(var i=0;i<group.childNodes.length;i++)
{if(!group.childNodes[i].tagName||group.childNodes[i].nodeType==3)continue;group_html+=ISSelectReplacement.add_option(select,group.childNodes[i],[group_id,i]);}
group_html+='</ul>';}
group_html+='</li>';return group_html;},add_option:function(select,option,id)
{var value,element_class,checked='';if(option.selected)
{element_class="SelectedRow";checked='checked="checked"'}
else{element_class='';}
var label=option.innerHTML;var whitespace=label.match(/^\s*(&nbsp;)*/);if(whitespace[0])
{label=label.replace(/^\s*(&nbsp;)*/,'');}
var disabled='';if(this.select.disabled){var disabled=' disabled="disabled"';}
var extraKey='';var extra='';if(option.className&&option.className.indexOf('forceKey')!=-1){var start=option.className.indexOf('forceKey');var end=option.className.indexOf(' ',start+1);if(end==-1){var end=option.className.length;}
var extraKey=option.className.substring(start+8,end);var extra='[]';}
html='<li id="ISSelect'+select.name.replace('[]','')+'_'+option.value+'" class="'+element_class+'" onselectstart="return false;" style="-moz-user-select: none;" onmouseover="ISSelectReplacement.on_hover(this, \''+id+'\', \'over\');"'+
'onmouseout=\"ISSelectReplacement.on_hover(this, \''+id+'\', \'out\');" onclick="ISSelectReplacement.on_click(this, \''+id+'\');">'+whitespace[0];if($(option).hasClass('freeform')){html+='<input type="textbox" name="ISSelectReplacement_'+select.name+'['+extraKey+']'+extra+'" value="'+option.value+'" onclick="ISSelectReplacement.on_click(this, \''+id+'\');" />';}
else{html+='<input type="checkbox" name="ISSelectReplacement_'+select.name+'['+extraKey+']'+extra+'" value="'+option.value+'" '+checked+disabled+'" onclick="ISSelectReplacement.on_click(this, \''+id+'\');" />'+label;}
html+='</li>';return html;},on_hover:function(element,id,action)
{var id=id.split(',');if(id.length==2)
{var replacement=element.parentNode.parentNode.parentNode.parentNode;var option=replacement.select.childNodes[id[0]].childNodes[id[1]];}
else
{var replacement=element.parentNode.parentNode;var option=replacement.select.childNodes[id[0]];}
if(action=='out'){if(element.className!="SelectedRow"){element.className="";}
$(option).trigger('mouseout');}
else{if(element.className!="SelectedRow"){element.className="ISSelectOptionHover";}
$(option).trigger('mouseover');}},scrollToItem:function(select_name,value,group)
{var item='ISSelect'+select_name.replace('[]','')+'_'+value;if(!document.getElementById(item))
return;var obj=document.getElementById(item);var top=obj.offsetTop-4;if(typeof(group)!='undefined'){top-=20;}
while(obj&&obj.tagName!='DIV')
{obj=obj.parentNode;if(obj&&obj.tagName=='DIV'){obj.scrollTop=top;break;}}},on_click:function(element,id)
{if(element.dblclicktimeout)
{return false;}
if(element.tagName=="INPUT")
{var checkbox=element;if(checkbox.disabled){return false;}
var element=element.parentNode;}
else
{var checkbox=element.getElementsByTagName('input')[0];if(checkbox.disabled){return false;}
checkbox.checked=!checkbox.checked;}
element.dblclicktimeout=setTimeout(function(){element.dblclicktimeout='';},250);var id=id.split(',');if(id.length==2)
{var replacement=element.parentNode.parentNode.parentNode.parentNode;var option=replacement.select.childNodes[id[0]].childNodes[id[1]];}
else
{var replacement=element.parentNode.parentNode;var option=replacement.select.childNodes[id[0]];}
option.selected=checkbox.checked;replacement.selectedIndex=replacement.select.selectedIndex;if(option.onclick)
{$(option).trigger('click');}
if(checkbox.checked)
{element.className="SelectedRow";}
else
{element.className='';}}};ISSelectReplacement.init();}
$(document).ready(function(){if(typeof(DesignMode)!='undefined'){return;}
var maxHeight=0;$('.Content .ProductList li').each(function(){if($(this).height()>maxHeight){maxHeight=$(this).height();}});$('.Content .ProductList li').css('height',maxHeight);});var QuickSearch={minimum_length:3,search_delay:125,cache:new Object(),init:function()
{$('#search_query').bind("keydown",QuickSearch.on_keydown);$('#search_query').bind("keyup",QuickSearch.on_keyup);$('#search_query').blur(QuickSearch.on_blur);$('#search_query').attr('autocomplete','off');var scripts=document.getElementsByTagName('SCRIPT');for(var i=0;i<scripts.length;i++)
{s=scripts[i];if(s.src&&s.src.indexOf('quicksearch.js')>-1)
{QuickSearch.path=s.src.replace(/quicksearch\.js$/,'../');break;}}},on_blur:function(event)
{if(!QuickSearch.item_selected&&!QuickSearch.over_all)
{QuickSearch.hide_popup();}},on_keydown:function(event)
{if(event.keyCode==13&&!event.altKey)
{if(QuickSearch.selected)
{try{event.preventDefault();event.stopPropagation();}catch(e){}
window.location=QuickSearch.selected.url;return false;}
else
{QuickSearch.hide_popup();}}
else if(event.keyCode==27)
{if(document.getElementById('QuickSearch'))
{try{event.preventDefault();event.stopPropagation();}catch(e){}}
QuickSearch.hide_popup();}},on_keyup:function(event)
{if(QuickSearch.timeout)
{clearTimeout(QuickSearch.timeout);}
if(event.keyCode==40&&QuickSearch.results)
{if(QuickSearch.selected&&QuickSearch.results.length>=QuickSearch.selected.index+1)
{QuickSearch.highlight_item(QuickSearch.selected.index+1,true);}
if(!QuickSearch.selected&&QuickSearch.results.length>0)
{QuickSearch.highlight_item(0,true);}
try{event.preventDefault();event.stopPropagation();}catch(e){}
return false;}
else if(event.keyCode==38&&QuickSearch.results)
{if(QuickSearch.selected&&QuickSearch.selected.index>0)
{QuickSearch.highlight_item(QuickSearch.selected.index-1,true);}
try{event.preventDefault();event.stopPropagation();}catch(e){}}
else if(event.keyCode==27)
{QuickSearch.hide_popup();}
else
{if($('#search_query').val()==QuickSearch.last_query)
{return false;}
QuickSearch.selected=false;if($('#search_query').val().replace(/^\s+|\s+$/g,'').length>=QuickSearch.minimum_length)
{QuickSearch.last_query=$('#search_query').val().replace(/^\s+|\s+$/g,'');if(QuickSearch.timeout)
{window.clearTimeout(QuickSearch.timeout);}
QuickSearch.timeout=window.setTimeout(QuickSearch.do_search,QuickSearch.search_delay);}
else{if(document.getElementById('QuickSearch'))
{$('#QuickSearch').remove();}}}},do_search:function()
{var cache_name=$('#search_query').val().length+$('#search_query').val();if(QuickSearch.cache[cache_name])
{QuickSearch.search_done(QuickSearch.cache[cache_name]);}
else
{$.ajax({type:'GET',url:QuickSearch.path+'search.php?action=AjaxSearch&search_query='+encodeURIComponent($('#search_query').val()),success:function(response){QuickSearch.search_done(response);}});}},search_done:function(response)
{var cache_name=$('#search_query').val().length+$('#search_query').val();QuickSearch.cache[cache_name]=response;if(window.ActiveXObject)
{var results_xml=new ActiveXObject("Microsoft.XMLDOM");results_xml.async=false;results_xml.loadXML(response);}
else
{var _parser=new DOMParser();var results_xml=_parser.parseFromString(response,"text/xml");}
var results=results_xml.getElementsByTagName('result');if(results&&results.length>0)
{QuickSearch.results=new Array();for(var i=0;i<results.length;i++)
{QuickSearch.results.push({title:results[i].getAttribute('title'),url:results[i].getAttribute('url'),price:results[i].getAttribute('price'),ratingimg:results[i].getAttribute('ratingimg'),image:results[i].getAttribute('image')});}
if(document.getElementById('QuickSearch'))
{$('#QuickSearch').remove();}
var popup_container=document.createElement('TABLE');popup_container.className='QuickSearch';popup_container.id='QuickSearch';popup_container.cellPadding="0";popup_container.cellSpacing="0";popup_container.border="0";var popup=document.createElement('TBODY');popup_container.appendChild(popup);var tr=document.createElement('TR');var td=document.createElement('TD');tr.className="QuickSearchTitle";td.colSpan="2";td.innerHTML=results_xml.getElementsByTagName('results')[0].getAttribute('type');tr.appendChild(td);popup.appendChild(tr);for(var i=0;i<QuickSearch.results.length;i++)
{var result=QuickSearch.results[i];var tr=document.createElement('TR');tr.id="QuickSearchResult"+i;tr.className="QuickSearchResult";var image_container=document.createElement('TD');image_container.className='QuickSearchResultImage';result.image=unescape(result.image);if(result.image.indexOf('http://')==0||result.image.indexOf('https://')==0)
{var image=document.createElement('IMG');image.src=result.image;image.alt='';image.title=unescape(result.title);image_container.appendChild(image);}
else
{image_container.className+=" QuickSearchResultNoImage";image_container.innerHTML=result.image.replace('+',' ');}
tr.appendChild(image_container);var meta=document.createElement('TD');meta.className="QuickSearchResultMeta";var link=document.createElement('A');link.className="QuickSearchResultName";link.title=unescape(result.title);link.href=result.url;link.innerHTML=unescape(result.title);meta.appendChild(link);var price=document.createElement('span');price.className="Price";price.innerHTML=unescape(result.price);meta.appendChild(price);if(result.ratingimg)
{var rating=document.createElement('IMG');rating.className="RatingIMG";rating.src=unescape(result.ratingimg);meta.appendChild(rating);}
tr.url=result.url;tr.index=i;tr.appendChild(meta);popup.appendChild(tr);tr.onmouseover=function(){QuickSearch.item_selected=true;QuickSearch.highlight_item(this.index,false);};tr.onmouseup=function(){window.location=this.url;};tr.onmouseout=function(){QuickSearch.item_selected=false;QuickSearch.unhighlight_item(this.index)};}
var all_results=results_xml.getElementsByTagName('results')[0].getAttribute('view_all');if(all_results)
{var tr=document.createElement('TR');var td=document.createElement('TD');tr.className="QuickSearchAllResults";tr.onmouseover=function(){QuickSearch.over_all=true;};tr.onmouseout=function(){QuickSearch.over_all=false;};td.colSpan=2;td.innerHTML=all_results;tr.appendChild(td);popup.appendChild(tr);}
var clone=popup.cloneNode(true);document.body.appendChild(clone);clone.style.top="10px";clone.style.left="10px";offset_height=clone.offsetHeight;offset_width=clone.offsetWidth;clone.parentNode.removeChild(clone);var offset_top=offset_left=0;var element=document.getElementById('search_query');if(typeof(QuickSearchAlignment)!='undefined'&&QuickSearchAlignment=='left'){offset_left=0;}
else{offset_left+=element.offsetWidth-$('#SearchForm').width();}
offset_top=-3;do
{offset_top+=element.offsetTop||0;offset_left+=element.offsetLeft||0;element=element.offsetParent;}while(element);popup_container.style.position="absolute";popup_container.style.left=offset_left+1+"px";popup_container.style.top=offset_top+document.getElementById('search_query').offsetHeight+"px";if(typeof(QuickSearchWidth)!='undefined'){popup_container.style.width=QuickSearchWidth;}
else{popup_container.style.width=document.getElementById('SearchForm').offsetWidth-2+"px";}
if($('#QuickSearch'))
{$('#QuickSearch').remove();}
document.body.appendChild(popup_container);popup_container.style.display='';}
else
{if(document.getElementById('QuickSearch'))
{$('#QuickSearch').remove();}}},hide_popup:function()
{$('#QuickSearch').remove();QuickSearch.selected=null;},highlight_item:function(index,keystroke)
{element=$('#QuickSearchResult'+index);if(keystroke==true)
{if(QuickSearch.selected)QuickSearch.selected.className='QuickSearchResult';QuickSearch.selected=document.getElementById('QuickSearchResult'+index);}
element.addClass("QuickSearchHover");},unhighlight_item:function(index)
{element=$('#QuickSearchResult'+index);element.removeClass('QuickSearchHover');}};$(document).ready(function()
{QuickSearch.init();});
