$(function(){var e=false;$(".selectSearchList").hover(function(){e=true},function(){e=false});$("body").mouseup(function(){if(!e){$("#selectSearchList").slideUp(200)}});$("#selectSearchDisplay").click(function(){$("#selectSearchList").slideDown(200)});$("#selectSearchList .item").click(function(){$("#selectSearchList .item.selected").removeClass("selected");el=$(this);el.addClass("selected");$("#selectSearch").val(el.data("site"));$("#selectSearchDisplay").html(el.html());$("#selectSearchList").slideUp(200)});$("li.has_subs").each(function(){el=$(this);el_sub=$("#"+el.data("dropmenu"));el_sub_top_pos=el.position().top-6;el_space_width=el_sub.width()-$(".right_space",el_sub).position().left-5;if(el.position().left>550&&(el.position().left+el_sub.width())>825){el_space=$(".left_space",el_sub);el_sub_left_pos=el.position().left-el_sub.width()+$(".right_space",el_sub).position().left-3}else{if((el.position().left+el_sub.width())>825){el_space=$(".space",el_sub);el_space_width=el_space_width/2;el_sub_left_pos=el.position().left+($(".right_space",el_sub).position().left/2)-(el_sub.width()/2)}else{el_space=$(".right_space",el_sub);el_sub_left_pos=el.position().left-3}}el_space.width(el_space_width);el_sub.css("top",el_sub_top_pos).css("left",el_sub_left_pos);el.bind("mouseover",function(){$("#"+$(this).data("dropmenu")).show()});el_sub.bind("mouseleave",function(){$(this).hide()});$(".space",el_sub).bind("mouseover",function(){$(this).parents(".drop_menu").hide()});el_sub.hide().css("visibility","visible")});if($(".history_timeline").size()>0){var g=$(".history_timeline").children(".left");var d=$(".history_timeline").children(".right");var i=$(".history_timeline").children(".middle").children(".timeline");var a=i.children(".slide");var f=a.children(".date");var c=$(".history_timeline").children(".middle").children(".text");var h=-a.width()+i.width();var b;g.click(function(){if(parseInt(a.css("left"))<0&&!b){b=true;a.animate({left:(parseInt(a.css("left"))+233)+"px"},function(){b=false})}});d.click(function(){if(parseInt(a.css("left"))>h&&!b){b=true;a.animate({left:(parseInt(a.css("left"))-233)+"px"},function(){b=false})}});f.click(function(){a.children(".date.on").removeClass("on");c.children().hide();$(this).addClass("on");$("#text_"+$(this).data("text")).show()})}$(".basket_remove img").click(function(){if(confirm("Are you sure that you wish to remove this product from your basket?")){switch($(this).data("basket-type")){case"product":window.location="/includes/kc/actions/remove_from_basket.php?basket_id="+$(this).data("basket-id");break;case"quote":window.location="/includes/kc/actions/remove_from_quote.php?basket_id="+$(this).data("basket-id");break}}});$(".basket_qty input").focus(function(){$(this).data("value",$(this).val())});$(".basket_qty input").blur(function(){el=$(this);el.val(parseInt(el.val()));if(el.val()==0){if(confirm("Are you sure that you wish to remove this product from your basket?")){switch($(this).data("basket-type")){case"product":window.location="/includes/kc/actions/remove_from_basket.php?basket_id="+$(this).data("basket-id");break;case"quote":window.location="/includes/kc/actions/remove_from_quote.php?basket_id="+$(this).data("basket-id");break}}else{el.val(el.data("value"));el.data("value",false)}}else{if(isNaN(el.val())||el.val()==""){el.val(el.data("value"));el.data("value",false)}else{if(el.val()!=el.data("value")){el.hide();el.siblings("img").show();switch(el.data("basket-type")){case"product":window.location="/includes/kc/actions/update_basket.php?basket_id="+el.data("basket-id")+"&qty="+el.val();break;case"quote":window.location="/includes/kc/actions/update_quote.php?basket_id="+el.data("basket-id")+"&qty="+el.val();break}}}}})});
