$(document).ready(function(){initiateImageCarousel();initiateImageZoomer();if(typeof(HideProductTabs)!='undefined'&&HideProductTabs==0){GenerateProductTabs();if(CurrentProdTab&&CurrentProdTab!=""){ActiveProductTab(CurrentProdTab);document.location.href='#ProductTabs';}}else{$('.ProductSectionSeparator').show();}
if($('.videoRow').size()>0){$('.videoRow').bind('click',function(){var videoId=$(this).attr('id').replace('video_','');$('#FeaturedVideo').html('<object width="320" height="265">'
+'<param name="movie" value="http://www.youtube.com/v/'+ videoId+'?fs=1"></param>'
+'<param name="allowFullScreen" value="true"></param>'
+'<param name="allowscriptaccess" value="always"></param>'
+'<embed src="http://www.youtube.com/v/'+ videoId+'?&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed>'
+'</object>');selectCurrentVideo(videoId);});}
if($('.sideVideoRow').size()>0){$('.sideVideoRow a').bind('click',function(){var videoId=$(this).attr('id').replace('sidevideo_','');if(config.ProductImageMode=='lightbox'){$('#VideoContainer object').css('visibility','hidden');$.iModal({data:'<object width="480" height="385">'
+'<param name="movie" value="http://www.youtube.com/v/'+ videoId+'?fs=1"></param>'
+'<param name="allowFullScreen" value="true"></param>'
+'<param name="allowscriptaccess" value="always"></param>'
+'<embed src="http://www.youtube.com/v/'+ videoId+'?&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed>'
+'</object>',title:$(this).find('img').attr('title'),width:510,buttons:'<input type="button" onclick="$.iModal.close();" value="  '+ lang.Close+'  " />',onBeforeClose:function(){$('#VideoContainer object').css('visibility','visible');}});}else{showVideoPopup(videoId);}
return false;});}
$(".VariationSelect:gt(0)").attr('disabled','disabled');var prodVarSelectionMap={}
$(".VariationSelect").change(function(){var mapIndex=0;$('.VariationSelect').each(function(){prodVarSelectionMap[mapIndex]=this.value;mapIndex++;});var index=$('.VariationSelect').index($(this));if(this.selectedIndex==0){$('.VariationSelect:gt('+ index+')').attr('disabled','disabled')
updateSelectedVariation($('body'));return;}
else{$('.VariationSelect:gt('+(index+ 1)+')').attr('disabled','disabled')}
var optionIds='';$('.VariationSelect:lt('+(index+ 1)+')').each(function(){if(optionIds!=''){optionIds+=',';}
optionIds+=$(this).val();});$.getJSON(config.AppPath+'/remote.php?w=GetVariationOptions&productId='+ productId+'&options='+ optionIds,function(data){if(data.hasOptions){$('.VariationSelect:eq('+(index+ 1)+') option:gt(0)').remove();$('.VariationSelect:eq('+(index+ 1)+')').append(data.options).attr('disabled','').focus();var preVal=prodVarSelectionMap[(index+ 1)];if(preVal!=''){var preOption=$('.VariationSelect:eq('+(index+ 1)+') option[value='+preVal+']');if(preOption){preOption.attr('selected',true);$('.VariationSelect:eq('+(index+ 1)+')').trigger('change');}}}
else if(data.comboFound){updateSelectedVariation($('body'),data,data.combinationid);}});});$('.ProductOptionList input[type=radio]').click(function(){var optionId=$(this).val();$.getJSON(config.AppPath+'/remote.php?w=GetVariationOptions&productId='+ productId+'&options='+ optionId,function(data){if(data.comboFound){updateSelectedVariation($('body'),data,data.combinationid);}});});});
