function include_dom(script_filename){document.write('<'+'script');document.write(' language="javascript"');document.write(' type="text/javascript"');document.write(' src="'+script_filename+'">');document.write('</'+'script'+'>');}
$(document).ready(function(){$('#siteSearchForm').submit(function(){var url=$(this).attr('action');keyword=$('#siteSearchForm input[type=text]').val();url+='keyword/'+keyword;document.location.href=url;return false;});switch(page)
{case"contact_us":case"return_policy":case"link_us":$.meta.setType("attr","validate");$("#custInfo").validate();$.get(this_www_root+'ajax.php?cmd=set_form_token',function(data){var hdn='<input type="hidden" name="ts" value="'+data+'">'
$('#custInfo').append(hdn);});break;case"related_products":jQuery('#related-products').jcarousel({scroll:4,visible:3,initCallback:function(){jQuery('#loading-div').hide();jQuery('.jcarousel-skin-tango').css('visibility','visible');}});break;}});function append_script_to_header(script_path)
{var script=$('script').filter('[src="'+script_path+'"]');if(script.length==0)
{var str_include='<'+'script';str_include+=' language="javascript"';str_include+=' type="text/javascript"';str_include+=' src="'+script_path+'">';str_include+='</'+'script'+'>';$('head').append(str_include);}}
function append_script_to_footer(script_path)
{var script=$('script').filter('[src="'+script_path+'"]');if(script.length==0)
{var str_include='<'+'script';str_include+=' language="javascript"';str_include+=' type="text/javascript"';str_include+=' src="'+script_path+'">';str_include+='</'+'script'+'>';$('body').append(str_include);}}
function append_style_to_footer(style_path)
{var style=$('style').filter('[href="'+style_path+'"]');if(style.length==0)
{var str_include='<'+'link';str_include+=' rel="stylesheet"';str_include+=' type="text/css"';str_include+=' href="'+style_path+'"';str_include+=' />';$('body').append(str_include);}}
var popUpWin=0;function popUpWindow(URLStr,width,height)
{var left=50;var top=50;if(width<1)
width=420;if(height<1)
height=495;if(popUpWin)
{if(!popUpWin.closed)popUpWin.close();}
popUpWin=open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');}
function roundoff(number,decimal_places)
{number=""+number;dot_pos=number.indexOf(".");if(dot_pos==-1){number+=".";for(i=0;i<decimal_places;i++){number+="0";}
new_number=number;}else{num_part=dot_pos+decimal_places+1;new_number=number.substr(0,num_part);}
return new_number;}
function addCommasToNumbers(nStr)
{nStr+='';x=nStr.split('.');x1=x[0];x2=x.length>1?'.'+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+','+'$2');}
return x1+x2;}
function is_valid_email(email){return email.match(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i);}
function is_empty_string(str){if(str==''){return true;}else if(typeof str=="string"&&str.match(/^\s$/i)){return true;}else{return false;}}
function getMousePosX(e)
{var posx=0;if(!e)var e=window.event;if(e.pageX){posx=e.pageX;}
else if(e.clientX){posx=e.clientX+document.body.scrollLeft
+document.documentElement.scrollLeft;}
return posx;}
function getMousePosY(e)
{var posy=0;if(!e)var e=window.event;if(e.pageY){posy=e.pageY;}
else if(e.clientY){posy=e.clientY+document.body.scrollTop
+document.documentElement.scrollTop;}
return posy;}
function str_replace(search,replace,str)
{while(str.indexOf(search)!=-1){str=str.replace(search,replace);}
return str;}
var ajaxCartCounterInterval;function addToCart(formId){var options={beforeSubmit:showAddToCartLoader,success:callBackAddToCart,dataType:'json',failure:callBackFailedAddToCart,data:{is_ajax_cart:'1'},timeout:5000};$('#'+formId).ajaxSubmit(options);return false;}
function addToCartAjax(formId){showAddToCartLoader();var buyFormCommand=$('#'+formId+' input[name=ajax_cart_command]').val();var formAction=www_root+'cart.php?cmd='+buyFormCommand+'&';var formData=$('#'+formId).serialize()+"&is_ajax_cart=1";var cartUrl=formAction+formData;$.ajax({url:cartUrl,type:"GET",error:function(jqXHR,textStatus,errorThrown){callBackFailedAddToCart(jqXHR,textStatus,errorThrown)},dataType:'jsonp'});return false;}
function showAddToCartLoader(formData,jqForm,options){clearInterval(ajaxCartCounterInterval);$('#ajaxcart_dialog_progress_container').show();return true;}
function callBackAddToCart(responseText,error){$('#ajaxcart_dialog_progress_container').hide();$('#ajaxcart_dialog_detail_container').show();if(error==true){$('#ajaxcart_dialog_product_name_contaner').html(responseText);}else{$('#ajaxcart_dialog_detail_product_name').html(decodeURIComponent(responseText.Product_Name));}
var ajaxCartCountdownNumber=6;if(typeof ajaxCartCounterInterval!='undefined')clearInterval(ajaxCartCounterInterval);ajaxCartCounterInterval=setInterval(function(){ajaxCartCountdownNumber--;if(ajaxCartCountdownNumber<1){clearInterval(ajaxCartCounterInterval);closeAjaxCartDialog();window.location=www_root+'cart/view_cart/';}else{$('#ajaxcart_dialog_detail_countdown').html(ajaxCartCountdownNumber);}},1000);if(error==false){updateHeaderCartDetails(responseText.Cart_Price_Total,responseText.Cart_Total_Items_Count);}}
function callBackFailedAddToCart(){callBackAddToCart('<b><font color="red">Failed Adding To Cart, Please Try Again!</font></b>',true);}
function closeAjaxCartDialog(){$('#ajaxcart_dialog_progress_container').hide();$('#ajaxcart_dialog_detail_container').hide();$('#ajaxcart_dialog_detail_countdown').html('5');}
function continueShoppingAjaxCart(){clearInterval(ajaxCartCounterInterval);closeAjaxCartDialog();}
function updateHeaderCartDetails(cartTotalPrice,cartTotalItems){var cartTotalPrice=addCommasToNumbers(roundoff(cartTotalPrice,1));$('#header_cart_items_count_container').html(cartTotalItems);$('#header_cart_items_total_container').html(cartTotalPrice);var loadUrl=this_www_root+'ajax.php';$.get(loadUrl,{Cart_Total_Price:cartTotalPrice,Total_Items:cartTotalItems,cmd:'update_cart_session'},function(responseText){$("#result").html(responseText);},"html");}
function openPopupChatWindow(){var livePersonChatUrl='https://server.iad.liveperson.net/hc/51262989/?cmd=file&file=visitorWantsToChat&site=51262989';window.open(livePersonChatUrl+"&referrer="+escape(document.location),"Window1","menubar=no,width=430,height=360,toolbar=no");}
$(document).ready(function(){});$(document).ready(function(){switch(page)
{case"videos":case"enhanced_feature":case"contact_us":case"static":case"help":case"product_list":case"product":adjust_panel_height();break;case"return_policy":adjust_panel_height();$.meta.setType("attr","validate");$("#custInfo").validate();break;case"comparison":adjust_panel_height();$('.comparison').flexigrid({height:'auto',striped:false});break;case"index":$('.product_combo').change(function(){prod_id=$(this).val();url=this_www_root+'index/product/id/'+prod_id+'/#accessories'
document.location=url;});break;}});function adjust_panel_height(){new_height=$("#middle-right").height();prev_height=$("#panel-left").height();if(prev_height<new_height){$("#panel-left").css('height',new_height+'px');}}
