var IE=(navigator.appName.indexOf("Internet Explorer")!=-1);var pageText;var xhr;function getXmlHttp(){var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
return xmlhttp;}
function addToCart(asin){try{var qtyObj=document.getElementById(asin+"_qty");var qty=qtyObj.options[qtyObj.selectedIndex].value;}catch(e){var qty=document.getElementById(asin+"_qty").value;}
var title=document.getElementById(asin+"_title").value;var list_price=document.getElementById(asin+"_list_price").value;var new_price=document.getElementById(asin+"_new_price").value;var img=document.getElementById(asin+"_image").value;var uri=document.getElementById("uri").value;var offerid=document.getElementById(asin+"_offerid").value;var url="/php/cart.php?action=add";url+="&asin="+asin;url+="&qty="+qty;url+="&title="+title;url+="&lp="+list_price;url+="&np="+new_price;url+="&img="+img;url+="&uri="+uri;url+="&oid="+offerid;xhr=getXmlHttp();xhr.onreadystatechange=cartCheck;xhr.open('GET',url,true);xhr.send(null);}
function cartCheck(){if(xhr.readyState==4){if(xhr.status==200){document.getElementById('page_pop').innerHTML=xhr.responseText;if(IE){try{document.getElementById("qty_div").innerHTML="<img src='/images/dummy_select.gif'>";}catch(e){null;}
try{document.getElementById("mode").style.display="none";document.getElementById("sort1").style.display="none";document.getElementById("sort2").style.display="none";}catch(e){null;}}
showCart();}}}
function showCart(){document.getElementById("page_pop").style.display="block";document.getElementById("page_mask").style.display="block";}
function hideCart(){document.getElementById("page_pop").style.display="none";document.getElementById("page_mask").style.display="none";}
function updateQty(asin){var qtyObj=document.getElementById(asin+"_qty");var qty=qtyObj.options[qtyObj.selectedIndex].value;window.location="/item/"+asin+"/qty/"+qty+"/cart/update.html";}
var current_thumb=1;function thumb(num,path){current_thumb=num;document.getElementById('main_img').src=path;}
function showCurrent(asin){showLarge(asin,current_thumb);}
function showImg(num,path){current_thumb=num;document.getElementById("main_img").src=path;}
function showLarge(asin,num){var win=window.open("/php/popup.php?asin="+asin+"&n="+num,"ImagePreview","scrollbars=yes,width=550,height=540,top=0,left=210,resizable=yes");win.focus();}
function showLarge2(num){document.getElementById("page_pop2").style.display="block";document.getElementById("page_mask").style.display="block";}
function hideLarge(){document.getElementById("page_pop2").style.display="none";document.getElementById("page_mask").style.display="none";}
function showImg2(id){var index=1;var again=true;while(again){try{var obj=document.getElementById("main_img_"+index);if(obj){if(index==id){obj.style.visibility="visibile";}else{obj.style.visibility="hidden";}}else{again=false;}}catch(e){again=false;}}}
var currentMenu=null;var tMenu,tMDelay;function toggleBy(obj){if(obj.selectedIndex==0){document.getElementById("t_lbl").style.display="block";document.getElementById("t_input").style.display="block";}else{document.getElementById("t_lbl").style.display="none";document.getElementById("t_input").style.display="none";}}
function goAmazon(){window.location="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2F&tag=goodchapter-20&linkCode=ur2&camp=1789&creative=9325";}
function goOffer(amAsin){window.location="http://www.amazon.com/exec/obidos/redirect?tag=goodmoviedeals-20&path=tg/stores/offering/list/-/"+amAsin+"/all/ref=dp_pb_a/103-0209001-0340630";}
function sort(obj,search_index){var s=obj.options[obj.selectedIndex].value;xhr=getXmlHttp();xhr.onreadystatechange=sortCheck;xhr.open('GET',"/php/setsort.php?s="+s+"&si="+search_index,true);xhr.send(null);}
function sortCheck(){if(xhr.readyState==4){if(xhr.status==200){window.location=window.location;}}}
function hideMenus(){for(var j=0;j<3;j++){if(j!=currentMenu){document.getElementById("dropLinks"+j).style.display="none";document.getElementById("dHLeft"+j).className="ddHLeft";document.getElementById("dHTitle"+j).className="ddHTitle";document.getElementById("dHRight"+j).className="ddHRight";}}}
function checkMenuOut(){if(currentMenu!=null){var dropHeader=document.getElementById("dropHeader"+currentMenu);var dropLinks=document.getElementById("dropLinks"+currentMenu);if(dropHeader.over||dropLinks.over){tMenu=setTimeout("checkMenuOut()",34);}else{document.getElementById("dHLeft"+currentMenu).className="ddHLeft";document.getElementById("dHTitle"+currentMenu).className="ddHTitle";document.getElementById("dHRight"+currentMenu).className="ddHRight";clearTimeout(tMenu);currentMenu=null;dropLinks.style.display="none";}}else{clearTimeout(tMenu);}}
function menuDisplayDelay(num){var dropHeader=document.getElementById("dropHeader"+num);overDelay=function(){if(dropHeader.over){currentMenu=num;hideMenus();document.getElementById("dropLinks"+num).style.display="block";document.getElementById("dHLeft"+num).className="ddHLeft_o";document.getElementById("dHTitle"+num).className="ddHTitle_o";document.getElementById("dHRight"+num).className="ddHRight_o";checkMenuOut();}}
clearTimeout(tMDelay);tMDelay=setTimeout("overDelay()",60);}
function load_images(){var imgs=document.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){var this_img=imgs[i];if(this_img.className=="indexThumb"){var this_src=document.getElementById(this_img.id+"_src").value;this_img.src="http://ecx.images-amazon.com"+this_src;}}}
function init(){var obj=document.getElementById("leftMenuUL");if(obj){var lis=obj.getElementsByTagName("li");for(var i=0;i<lis.length;i++){var li=lis[i];li.onmouseover=function(){this.style.backgroundColor="#EEEEEE";}
li.onmouseout=function(){this.style.backgroundColor="#ffffff";}
li.onclick=function(){var a_tag=this.childNodes[0];window.location=a_tag.href;}}}
for(var i=0;i<3;i++){var dropHeader=document.getElementById("dropHeader"+i);var dropLinks=document.getElementById("dropLinks"+i);dropHeader.num=i;dropHeader.over=false;dropLinks.over=false;dropHeader.onmouseover=function(){this.over=true;if(currentMenu!=this.num)menuDisplayDelay(this.num);}
dropHeader.onmouseout=function(){this.over=false;}
dropLinks.onmouseover=function(){this.over=true;}
dropLinks.onmouseout=function(){this.over=false;}
var lis=dropLinks.getElementsByTagName("li");for(var j=0;j<lis.length;j++){var this_li=lis[j];this_li.onmouseover=function(){this.style.backgroundColor="#eeeeee";}
this_li.onmouseout=function(){this.style.backgroundColor="#ffffff";}
this_li.onclick=function(){var this_a=this.getElementsByTagName("a");window.location=this_a[0];}}}
load_images();}
function validate(){var name=document.getElementById("name").value;var email=document.getElementById("email").value;var size=document.getElementById("size").selectedIndex;var zip=document.getElementById("zip").value;var valid=true;var err="";if(name==""){valid=false;err="Please enter your full name";}else if(email==""){valid=false;err="Please enter your e-mail";}else if(size==0){valid=false;err="Please select your size";}else if(zip==""){valid=false;err="Please enter your zip code";}
if(!valid)alert(err);return valid;}