function silentErrorHandler(){return true;}window.onerror=silentErrorHandler;in_use=false;function slide(id){$("#"+id+"").slideToggle("slow")}function slideUp(id){$("#"+id+"").slideUp("slow")}function slideDown(id){$("#"+id+"").slideDown("slow")}function delaySlide(id,time){var t=500;t=setTimeout("slide('"+id+"')",time*1000)}function delaySlideUp(id,time){var t=500;t=setTimeout("slideUp('"+id+"')",time*1000)}function delaySlideDown(id,time){var t=500;t=setTimeout("slideDown('"+id+"')",time*1000)}function stopSlide(id){$(id).stop()}function fadeIn(id){$("#"+id+"").fadeIn("slow")}function fadeOut(id){$("#"+id+"").fadeOut("slow")}function delay(func,time){var t=500;t=setTimeout(func,time*1000)}function clearSlides(){t=clearTimeout(t)}function redir(url){window.location=url}String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")};function loadhelp(url){var SITE=window.open(url,"openmti","menubar=0,toolbar=0,location=0,directories=0,status=1,scrollbars=1,width=800,height=400,innerHeight=294,screenx=40,screeny=40,resizable=1")}function toggleDiv(id,flagit){if(flagit=="1"){if(document.layers){document.layers[""+id+""].visibility="show"}else{if(document.getElementById){document.getElementById(""+id+"").style.visibility="visible"}else{if(document.all){document.all[""+id+""].style.visibility="visible"}}}}else{if(flagit=="0"){if(document.layers){document.layers[""+id+""].visibility="hide"}else{if(document.getElementById){document.getElementById(""+id+"").style.visibility="hidden"}else{if(document.all){document.all[""+id+""].style.visibility="hidden"}}}}}}function toggle(id,flagit){if(flagit=="1"){if(document.layers){document.layers[""+id+""].display="block"}else{if(document.getElementById){document.getElementById(""+id+"").style.display="block"}else{if(document.all){document.all[""+id+""].style.display="block"}}}}else{if(flagit=="0"){if(document.layers){document.layers[""+id+""].display="none"}else{if(document.getElementById){document.getElementById(""+id+"").style.display="none"}else{if(document.all){document.all[""+id+""].style.display="none"}}}}}}function delayToggle(id,action,time){var t=500;t=setTimeout("toggle('"+id+"', "+action+")",time*1000)}function toggleVis(id,flagit){if(flagit=="1"){if(document.layers){document.layers[""+id+""].visibility="visible"}else{if(document.getElementById){document.getElementById(""+id+"").style.visibility="visible"}else{if(document.all){document.all[""+id+""].style.visibility="visible"}}}}else{if(flagit=="0"){if(document.layers){document.layers[""+id+""].visibility="hidden"}else{if(document.getElementById){document.getElementById(""+id+"").style.visibility="hidden"}else{if(document.all){document.all[""+id+""].style.visibility="hidden"}}}}}}function delayToggleVis(id,action,time){var t=500;t=setTimeout("toggleVis('"+id+"', "+action+")",time*1000)}function findValue(li){if(li==null){return alert("No match!")}if(!!li.extra){var sValue=li.extra[0]}else{var sValue=li.selectValue}}function selectItem(li){findValue(li);document.searchBox.submit()}function formatItem(row){return row[0]+" (id: "+row[1]+")"}function lookupAjax(){var oSuggest=$("#searchBox_ajax")[0].autocompleter;oSuggest.findValue();return false}function lookupLocal(){var oSuggest=$("#searchBox")[0].autocompleter;oSuggest.findValue();return false}function isNum(f){if(!/^\d*$/.test(f.value)){f.value=f.value.replace(/[^\d]/g,"");return true}else{return false}}function isNum2(num){if(!/^\d*$/.test(num)){return false}else{return true}}function isNumeric(num){if(!/^\d*$/.test(num)){return false}else{return true}}function alphaNumericCheck(str){var regex=/^[0-9A-Za-z#-&_-]+$/;if(regex.test(str.value)){return true}else{str.value=str.value.replace(/[^a-zA-Z 0-9#-&_-]+/g,"");return false}}function safeText(str){return str.replace(/[^a-zA-Z 0-9#-&_.?!:)(-]+/g,"")}function emailCheck(id){str=document.getElementById(id);var regex=/^[0-9A-Za-z@._-]+$/;if(regex.test(str.value)){return true}else{str.value=str.value.replace(/[^a-zA-Z 0-9@._-]+/g,"");return false}}function secCheck(id){str=document.getElementById(id);var regex=/^[0-9A-Za-z#-&_-]+$/;if(regex.test(str.value)){return true}else{str.value=str.value.replace(/[^a-zA-Z 0-9#-&_-]+/g,"");return false}}function safeURL(str){str=str.replace(/ /gi,"+");str=str.replace(/&/gi,"and");return(str)}$(document).ready(function(){$("#searchBox_ajax").autocomplete("/cigars/include/ajax_autocomplete.cfm",{delay:5,minChars:2,matchSubset:1,matchContains:1,cacheLength:1,onItemSelect:selectItem,onFindValue:findValue,maxItemsToShow:15,width:200,autoFill:false});updateCartTab()});var NUMBER_OF_STARS=11;function init_rating(){var ratings=document.getElementsByTagName("div");for(var i=0;i<ratings.length;i++){if(ratings[i].className!="rating"){continue}var rating=ratings[i].firstChild.nodeValue;ratings[i].removeChild(ratings[i].firstChild);if(rating>NUMBER_OF_STARS||rating<0){continue}for(var j=1;j<NUMBER_OF_STARS;j++){var star=document.createElement("img");star.setAttribute("title",j*10+" out of 100");star.setAttribute("onclick","$tooltip.hide();");if(rating>=1){star.setAttribute("src","/cigars/images/ratings/rating_on.gif");star.setAttribute("style","width:18px;height:20px;");star.className="on";rating--}else{if(rating==0.5){star.setAttribute("src","/cigars/images/ratings/rating_half.gif");star.setAttribute("style","width:18px;height:20px;");star.className="half";rating=0}else{star.setAttribute("src","/cigars/images/ratings/rating_off.gif");star.setAttribute("style","width:18px;height:20px;");star.className="off"}}var widgetId=ratings[i].getAttribute("id").substr(7);star.setAttribute("id","star_"+widgetId+"_"+j);star.onmouseover=new Function("evt","displayHover("+widgetId+", "+j+");");star.onmouseout=new Function("evt","displayNormal("+widgetId+", "+j+");");ratings[i].appendChild(star)}}}function update_rating(id){var ratings=document.getElementsByTagName("div");for(var i=0;i<ratings.length;i++){if(ratings[i].className!="rating"){continue}if(ratings[i].id!="rating_"+id){continue}var rating=ratings[i].firstChild.nodeValue;ratings[i].removeChild(ratings[i].firstChild);if(rating>NUMBER_OF_STARS||rating<0){continue}for(var j=1;j<NUMBER_OF_STARS;j++){var star=document.createElement("img");star.setAttribute("title",j*10+" out of 100");star.setAttribute("onclick","$tooltip.hide();");if(rating>=1){star.setAttribute("src","/cigars/images/ratings/rating_over.gif");star.setAttribute("style","width:18px;height:20px;");star.className="on";rating--}else{if(rating==0.5){star.setAttribute("src","/cigars/images/ratings/rating_half.gif");star.setAttribute("style","width:18px;height:20px;");star.className="half";rating=0}else{star.setAttribute("src","/cigars/images/ratings/rating_off.gif");star.setAttribute("style","width:18px;height:20px;");star.className="off"}}var widgetId=ratings[i].getAttribute("id").substr(7);star.setAttribute("id","star_"+widgetId+"_"+j);star.onmouseover=new Function("evt","displayHover("+widgetId+", "+j+");");star.onmouseout=new Function("evt","displayUpdated("+widgetId+", "+j+");");ratings[i].appendChild(star)}}}function displayHover(ratingId,star){for(var i=1;i<=star;i++){document.getElementById("star_"+ratingId+"_"+i).setAttribute("src","/cigars/images/ratings/rating_over.gif");document.getElementById("star_"+ratingId+"_"+i).setAttribute("title",i*10+" out of 100")}}function displayNormal(ratingId,star){for(var i=1;i<=star;i++){var status=document.getElementById("star_"+ratingId+"_"+i).className;document.getElementById("star_"+ratingId+"_"+i).setAttribute("src","/cigars/images/ratings/rating_"+status+".gif");document.getElementById("star_"+ratingId+"_"+i).setAttribute("title",i*10+" out of 100")}}function displayUpdated(ratingId,star){for(var i=1;i<=star;i++){var status=document.getElementById("star_"+ratingId+"_"+i).className;document.getElementById("star_"+ratingId+"_"+i).setAttribute("src","/cigars/images/ratings/updated/rating_"+status+".gif");document.getElementById("star_"+ratingId+"_"+i).setAttribute("title",i*10+" out of 100")}}function showPic(whichpic){if(document.getElementById){document.getElementById("prodImg").src=whichpic.rel;document.getElementById("prodImgLink").href=whichpic.rel;document.getElementById("prodImgLink").alt="Click to Enlarge";document.getElementById("prodImgLink").title="Click to Enlarge";if(whichpic.title){document.getElementById("desc").childNodes[0].nodeValue=whichpic.title}else{document.getElementById("desc").childNodes[0].nodeValue=whichpic.childNodes[0].nodeValue}return false}else{return true}}function swapPic(whichpic){if(document.getElementById){document.getElementById("prodImg").src=whichpic.rel;document.getElementById("prodImgLink").href=whichpic.lang;document.getElementById("prodImgLink").alt="Click to Enlarge";document.getElementById("prodImgLink").title="Click to Enlarge";if(whichpic.title){document.getElementById("desc").childNodes[0].nodeValue=whichpic.title}else{document.getElementById("desc").childNodes[0].nodeValue=whichpic.childNodes[0].nodeValue}return false}else{return true}}function checkForm(thisform){returnval=true;if(thisform.emailadr.value=="Enter email address here"){alert("Enter your email address");returnval=false}for(var j=0;j<(thisform.elements.length);j++){indx=thisform.elements[j].name.indexOf("_required");if(indx!=-1){fieldname=thisform.elements[j].name.substring(0,indx);if(thisform.elements[fieldname].value.length==0){alert(thisform.elements[j].value);j=(thisform.elements.length);returnval=false}}}return returnval}function validEmail(id){var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var address=document.getElementById(id).value;address=address.replace(/^\s*|\s*$/g,"");if(reg.test(address)==false){return false}else{return true}}function validEmailAdr(address){var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;address=address.replace(/^\s*|\s*$/g,"");if(reg.test(address)==false){return false}else{return true}}function ajaxLoader(id,img,height){if(img!=1&&img!=2&&img!=3){img=1}if(height==undefined){var loader='<img src="/cigars/images/ajax-loader'+img+'.gif" style="vertical-align:middle;" alt="" />'}else{var loader='<img src="/cigars/images/ajax-loader'+img+'.gif" style="height:'+height+'px;vertical-align:middle;" alt="" />'}document.getElementById(id).innerHTML=loader}function writeAjax(id,data){document.getElementById(id).innerHTML=data}function intellitime(items){if(items>2){return((items/4)*1000)}else{return(0.5*1000)}}function categories(){var cat=new Array();cat[0]="list";cat[1]="grid";cat[2]="feat";cat[3]="stats";cat[4]="fav";return cat}function addToCart(mode,ihdnum,goToCart,misc){if(!in_use){in_use=true;cat=categories();for(i=0;i<cat.length;i++){if(document.getElementById(cat[i]+"_addToCart_"+ihdnum)){toggleVis(cat[i]+"_addToCart_"+ihdnum,1)}}if(misc!=undefined&&misc=="inactive"){if(document.getElementById(mode+"_buttonActive_"+ihdnum)){toggle(mode+"_buttonActive_"+ihdnum,"0")}if(document.getElementById(mode+"_buttonInactive_"+ihdnum)){toggle(mode+"_buttonInactive_"+ihdnum,"1")}}if(document.getElementById(mode+"_addToCart_"+ihdnum)){document.getElementById(mode+"_addToCart_"+ihdnum).className="cartStatus_grid_empty";ajaxLoader(mode+"_addToCart_"+ihdnum)}var qty=0;if(document.getElementById(mode+"_qty_"+ihdnum)){qty=document.getElementById(mode+"_qty_"+ihdnum).value}else{qty=1}if(!isNum2(qty)){qty=1}$.ajax({type:"POST",url:"/cigars/include/ajax_addToCart.cfm",data:"ihdnums="+ihdnum+"&qtys="+qty+"&meth=automaticCart",success:function(msg){thisMsg=msg;if(misc==undefined||misc!="inactive"){if(document.getElementById(mode+"_buttonActive_"+ihdnum)){toggle(mode+"_buttonActive_"+ihdnum,"1")}if(document.getElementById(mode+"_buttonInactive_"+ihdnum)){toggle(mode+"_buttonInactive_"+ihdnum,"0")}}if(document.getElementById(mode+"_addToCart_"+ihdnum)){document.getElementById(mode+"_addToCart_"+ihdnum).className="cartStatus_grid";if(document.getElementById(mode+"_addToCart_"+ihdnum)&&document.getElementById(mode+"_addToCart_"+ihdnum).value!="n/a"){document.getElementById(mode+"_addToCart_"+ihdnum).value="qty"}document.getElementById(mode+"_addToCart_"+ihdnum).innerHTML=msg}for(i=0;i<cat.length;i++){if(document.getElementById(cat[i]+"_addToCart_"+ihdnum)){document.getElementById(cat[i]+"_addToCart_"+ihdnum).className="cartStatus_grid";if(document.getElementById(cat[i]+"_qty_"+ihdnum)&&document.getElementById(cat[i]+"_qty_"+ihdnum).value!="n/a"){document.getElementById(cat[i]+"_qty_"+ihdnum).value="qty"}document.getElementById(cat[i]+"_addToCart_"+ihdnum).innerHTML=msg}}in_use=false;setTimeout("updateSlide()",500);setTimeout("updateCartTab()",500);if(misc!=undefined&&misc=="slide"){setTimeout("slideDown('cart')",1000);if(document.getElementById("cart").style.display=="none"){delaySlideUp("cart",4)}}if(goToCart==true){redir("/cigars/cart/cart.cfm")}}})}}function addToCart_special(mode,ihdnum,goToCart){if(!in_use){in_use=true;cat=categories();if(document.getElementById(mode+"_buttonActive_"+ihdnum)){toggle(mode+"_buttonActive_"+ihdnum,"0")}if(document.getElementById(mode+"_buttonInactive_"+ihdnum)){toggle(mode+"_buttonInactive_"+ihdnum,"1")}for(i=0;i<cat.length;i++){if(document.getElementById(cat[i]+"_addToCart_"+ihdnum)){toggleVis(cat[i]+"_addToCart_"+ihdnum,1)}}if(document.getElementById(mode+"_addToCart_"+ihdnum)){document.getElementById(mode+"_addToCart_"+ihdnum).className="cartStatus_grid_empty";ajaxLoader(mode+"_addToCart_"+ihdnum)}if(document.getElementById(mode+"_qty_"+ihdnum)){var qty=document.getElementById(mode+"_qty_"+ihdnum).value}else{var qty=1}if(qty=="qty"||qty==""||!isNum2(qty)){qty=1}$.ajax({type:"POST",url:"/cigars/include/ajax_addToCart.cfm",data:"ihdnums="+ihdnum+"&qtys="+qty+"&is_bg=B",success:function(msg){setTimeout("modal_offer('offerDeal', 850, 600)",1000);if(document.getElementById(mode+"_buttonActive_"+ihdnum)){toggle(mode+"_buttonActive_"+ihdnum,"1")}if(document.getElementById(mode+"_buttonInactive_"+ihdnum)){toggle(mode+"_buttonInactive_"+ihdnum,"0")}if(document.getElementById(mode+"_addToCart_"+ihdnum)){document.getElementById(mode+"_addToCart_"+ihdnum).className="cartStatus_grid";if(document.getElementById(mode+"_addToCart_"+ihdnum)&&document.getElementById(mode+"_addToCart_"+ihdnum).value!="n/a"){document.getElementById(mode+"_addToCart_"+ihdnum).value="qty"}document.getElementById(mode+"_addToCart_"+ihdnum).innerHTML=msg}for(i=0;i<cat.length;i++){if(document.getElementById(cat[i]+"_addToCart_"+ihdnum)){document.getElementById(cat[i]+"_addToCart_"+ihdnum).className="cartStatus_grid";if(document.getElementById(cat[i]+"_qty_"+ihdnum)&&document.getElementById(cat[i]+"_qty_"+ihdnum).value!="n/a"){document.getElementById(cat[i]+"_qty_"+ihdnum).value="qty"}document.getElementById(cat[i]+"_addToCart_"+ihdnum).innerHTML=msg}}in_use=false}});setTimeout("updateSlide()",500);setTimeout("updateCartTab()",500)}else{}if(in_use){setTimeout("in_use = false",3000)}if(goToCart==true){setTimeout('redir("/cigars/cart/cart.cfm")',1000)}}function isLoading(id){var str=document.getElementById(id).innerHTML;if(str.search(/loader/i)>0){return true}else{return false}}function removeFromCart(ihdnum){$.ajax({type:"POST",url:"/cigars/include/ajax_removeFromCart.cfm",data:"ihdnum="+ihdnum,success:function(msg){}});clearDiv(ihdnum);setTimeout("updateCartTab()",500)}function clearDiv(ihdnum){cat=categories();for(k=0;k<cat.length;k++){if(document.getElementById(cat[k]+"_addToCart_"+ihdnum)){toggleVis(cat[k]+"_addToCart_"+ihdnum,0)}if(document.getElementById(cat[k]+"_notice")){toggleVis(cat[k]+"_notice",0)}}}function updateSlidingCart(ihdnum){$.ajax({type:"POST",url:"/cigars/include/ajax_updateSlidingCart.cfm",data:"ihdnum="+ihdnum,success:function(data){writeAjax("slidingCart_data",data)}});setTimeout("updateCartTab()",500)}function deleteFromSlide(obj,num){if(obj=="deleteFrenzy"){action="deleteFrenzy";num=0}else{if(obj=="deleteCAS"){action="deleteCAS";num=0}else{action="delete"}}$.ajax({type:"POST",url:"/cigars/include/ajax_updateSlidingCart.cfm?action="+action,data:"ihdnum="+obj+"&num="+num,success:function(data){writeAjax("slidingCart_data",data)}});clearDiv(obj);setTimeout("updateCartTab()",500)}function purgeFromSlide(ihdnums){var ihdnumsArray=ihdnums.split(",");for(i=0;i<ihdnumsArray.length;i++){clearDiv(ihdnumsArray[i])}$.ajax({type:"POST",url:"/cigars/include/ajax_updateSlidingCart.cfm?action=purge",data:"ihdnum=all",success:function(data){writeAjax("slidingCart_data",data);setTimeout("updateCartTab()",500);delaySlideUp("cart",1.5)}})}function updateSlide(){$.ajax({type:"POST",url:"/cigars/include/ajax_updateSlidingCart.cfm",data:"ihdnum=1",success:function(data){writeAjax("slidingCart_data",data)}});setTimeout("updateCartTab()",500)}function updateCart(ihdnums){toggle("cart_updateCart",0);toggle("cart_updateCart_disabled",1);var ihdnumsArray=ihdnums.split(",");var qtys="";for(i=0;i<ihdnumsArray.length;i++){if(qtys==""){qtys=document.getElementById("cart_qty_"+ihdnumsArray[i]).value}else{qtys=qtys+","+document.getElementById("cart_qty_"+ihdnumsArray[i]).value}}var qtysArray=qtys.split(",");for(j=0;j<ihdnumsArray.length;j++){if(qtysArray[j]==0){$.ajax({type:"POST",url:"/cigars/include/cart_actions.cfm?action=delete&ihdnum="+ihdnumsArray[j]+"&redir=false",data:"ihdnums="+ihdnums+"&qtys="+qtys,success:function(msg){}})}}$.ajax({type:"POST",url:"/cigars/include/ajax_addToCart.cfm?action=update",data:"ihdnums="+ihdnums+"&qtys="+qtys,success:function(msg){}});setTimeout('window.location="/cigars/cart/cart.cfm"',intellitime(ihdnumsArray.length))}function updateRecentlyViewed(){$.ajax({type:"POST",url:"/cigars/include/ajax_updateRecentlyViewed.cfm",data:"ihdnum=1",success:function(data){writeAjax("recentlyViewed_data",data)}})}function updateCartTab(){$.ajax({type:"POST",url:"/cigars/include/ajax_updateCartTab.cfm",data:"a=1",success:function(data){writeAjax("cartTab",data)}})}function account(action,url){toggleVis("acctMsg",1);ajaxLoader("acctMsg",3);var valid=true;if(document.getElementById("loginEmail")){if(document.getElementById("loginEmail").value=="email address"){var username=""}else{var username=document.getElementById("loginEmail").value}}else{var username=""}if(document.getElementById("loginPass")){var password=document.getElementById("loginPass").value}else{var password=""}if(!validEmail("loginEmail")){valid=false;writeAjax("acctMsg",'<div class="acctMsg_fail">The username or password you entered is incorrect.</div>')}else{if(password.trim()==""){valid=false;writeAjax("acctMsg",'<div class="acctMsg_fail">The username or password you entered is incorrect.</div>')}}if(valid){$.ajax({type:"POST",url:"/cigars/secur/login/login_test.cfm",data:"username="+username.toLowerCase()+"&password="+password.toLowerCase(),success:function(data){toggleVis("acctMsg",1);writeAjax("acctMsg",data);if(data.search(/success/i)>0){if(url==undefined){setTimeout('window.location="/"',250)}else{setTimeout('window.location="'+url+'"',250)}}else{if(data.search(/cookie/i)>0){redir("/cigars/include/nocookies.cfm")}else{document.getElementById("loginPass").value="";document.getElementById("loginPass").style.border="1px solid ##F00;"}}}})}}function modifyFav(mode,ihdnum,action){toggleVis(mode+"_addToCart_"+ihdnum,1);document.getElementById(mode+"_addToCart_"+ihdnum).className="cartStatus_grid_empty";ajaxLoader(mode+"_addToCart_"+ihdnum);$.ajax({type:"POST",url:"/cigars/include/ajax_modifyFav.cfm?action="+action,data:"ihdnum="+ihdnum,success:function(msg){document.getElementById(mode+"_addToCart_"+ihdnum).className="cartStatus_grid";writeAjax(mode+"_addToCart_"+ihdnum,msg)}})}function submitAllRatings(ihdnum){ajaxLoader("allRatings",3);$.ajax({type:"POST",url:"/cigars/include/ajax_submitRating.cfm",data:"ihdnum="+ihdnum,success:function(data){for(i=1;i<7;i++){if(document.getElementById("txtRating_"+i).innerHTML==""){writeAjax("txtRating_"+i,'<span style="color:#f00;">Please rate this attribute</span>')}}writeAjax("allRatings",data)}})}function getQty(mode,ihdnum){return(document.getElementById(mode+"_qty_"+ihdnum).value)}function popup(id){$("#"+id).dialog("open");$("#"+id).dialog({bgiframe:true,resizable:false,autoOpen:true,modal:true,width:400,height:275,overlay:{backgroundColor:"#000",opacity:0.6},buttons:{Close:function(){$(this).dialog("close")}}})}function modal_popup(id){$("#"+id).dialog("open");$("#"+id).dialog({bgiframe:true,resizable:false,autoOpen:true,modal:true,width:400,height:275,overlay:{backgroundColor:"#000",opacity:0.6},buttons:{Close:function(){$(this).dialog("close")}}})}function modal(id,width,height){$("#"+id).dialog("open");$("#"+id).dialog({bgiframe:true,resizable:false,autoOpen:true,modal:true,width:width,height:height,overlay:{backgroundColor:"#000",opacity:0.7},buttons:{"No Thanks":function(){$(this).dialog("close")}}})}function modal_offer(id,width,height){$("#"+id).dialog("open");$("#"+id).dialog({bgiframe:true,resizable:false,autoOpen:true,modal:true,width:width,height:height,overlay:{backgroundColor:"#000",opacity:0.7},buttons:{Close:function(){$(this).dialog("close")}}})}function modal_error(msg){$.modaldialog.error(msg)}function modal_warning(msg){$.modaldialog.warning(msg)}function modal_success(msg){$.modaldialog.success(msg)}function modal_prompt(msg){$.modaldialog.prompt(msg)}function modal_title(title,msg){$.modaldialog.success(msg,{title:title})}function divChanger(divID,fileToCall){xmlHttp=GetXmlHttpObject();var url=""+fileToCall;var containsQ=url.indexOf("?");if(containsQ==-1){url=url+"?divID="+divID}else{url=url+"&divID="+divID}xmlHttp.onreadystatechange=stateChanged;xmlHttp.open("GET",url,true);xmlHttp.send(null)}function stateChanged(){if(xmlHttp.readyState==4){var respALL=xmlHttp.responseText;var e=respALL.split("|_|");if(e.length>=1){var divID=e[0];var resp=e[1];document.getElementById(divID).innerHTML=resp}}}function GetXmlHttpObject(){var xmlHttp=null;try{xmlHttp=new XMLHttpRequest()}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return false}}}return xmlHttp}function poppy(popin){if(popin==undefined){popin=none}$.ajax({type:"POST",url:"/cigars/include/poppy.cfm?popin="+popin,data:"popin="+popin,success:function(data){}})}function transfer(id1,id2){var selectedEffect="transfer";var options={};options={to:"#"+id2,className:"ui-effects-transfer"};$("#"+id1).effect(selectedEffect,options,750,callback)}function callback(){setTimeout(function(){$("#"+id1+":hidden").removeAttr("style").hide().fadeIn()},1000)}function isNull(id){if(document.getElementById(id)){if(document.getElementById(id).value.trim()==""){return true}else{return false}}else{return false}}function redInput(id){if(document.getElementById(id)){document.getElementById(id).style.backgroundColor="#fde3e3"}}function clearInput(id){if(document.getElementById(id)){document.getElementById(id).style.backgroundColor="#fff"}}function lowerprice_submit(num){valid=true;if(document.getElementById("lowerprice_email_"+num)){document.getElementById("lowerprice_email_"+num).value=document.getElementById("lowerprice_email_"+num).value.trim();if(isNull("lowerprice_email_"+num)){valid=false;redInput("lowerprice_email_"+num);if(document.getElementById("lowerprice_email_"+num+"_error")){writeAjax("lowerprice_email_"+num+"_error","Please enter your email address.")}}else{if(!validEmail("lowerprice_email_"+num)){valid=false;redInput("lowerprice_email_"+num);if(document.getElementById("lowerprice_email_"+num+"_error")){writeAjax("lowerprice_email_"+num+"_error","Please enter a valid email address.")}}else{clearInput("lowerprice_email_"+num);if(document.getElementById("lowerprice_email_"+num+"_error")){writeAjax("lowerprice_email_"+num+"_error","")}}}}else{valid=false}if(document.getElementById("lowerprice_lowprice_"+num)){document.getElementById("lowerprice_lowprice_"+num).value=document.getElementById("lowerprice_lowprice_"+num).value.trim();lowprice=document.getElementById("lowerprice_lowprice_"+num).value.replace("$","");lowprice=lowprice.replace(",","");lowprice=new Number(lowprice);lowprice=lowprice.toFixed(2);if(isNull("lowerprice_lowprice_"+num)){valid=false;redInput("lowerprice_lowprice_"+num);if(document.getElementById("lowerprice_lowprice_"+num+"_error")){writeAjax("lowerprice_lowprice_"+num+"_error","Please enter the competitors price.")}}else{if(!isNum2(lowprice.replace(".",""))){valid=false;redInput("lowerprice_lowprice_"+num);if(document.getElementById("lowerprice_lowprice_"+num+"_error")){writeAjax("lowerprice_lowprice_"+num+"_error","Please enter a valid price.")}}else{clearInput("lowerprice_lowprice_"+num);if(document.getElementById("lowerprice_lowprice_"+num+"_error")){writeAjax("lowerprice_lowprice_"+num+"_error","")}document.getElementById("lowerprice_lowprice_"+num).value=lowprice}}}else{valid=false}if(document.getElementById("lowerprice_wheresaw_"+num)){document.getElementById("lowerprice_wheresaw_"+num).value=document.getElementById("lowerprice_wheresaw_"+num).value.trim();goodURL("lowerprice_wheresaw_"+num);if(isNull("lowerprice_wheresaw_"+num)){valid=false;redInput("lowerprice_wheresaw_"+num);if(document.getElementById("lowerprice_wheresaw_"+num+"_error")){writeAjax("lowerprice_wheresaw_"+num+"_error","Please enter the competitors url.")}}else{if(!goodURL("lowerprice_wheresaw_"+num)){valid=false;redInput("lowerprice_wheresaw_"+num);if(document.getElementById("lowerprice_wheresaw_"+num+"_error")){writeAjax("lowerprice_wheresaw_"+num+"_error","Please enter a valid URL.")}}else{clearInput("lowerprice_wheresaw_"+num);if(document.getElementById("lowerprice_wheresaw_"+num+"_error")){writeAjax("lowerprice_wheresaw_"+num+"_error","")}}}}else{valid=false}if(document.getElementById("lowerprice_comm_"+num)){document.getElementById("lowerprice_comm_"+num).value=document.getElementById("lowerprice_comm_"+num).value.trim();checkText("lowerprice_comm_"+num);if(isNull("lowerprice_comm_"+num)){valid=false;redInput("lowerprice_comm_"+num);if(document.getElementById("lowerprice_comm_"+num+"_error")){writeAjax("lowerprice_comm_"+num+"_error","Please enter a comment.")}}else{clearInput("lowerprice_comm_"+num);if(document.getElementById("lowerprice_comm_"+num+"_error")){writeAjax("lowerprice_comm_"+num+"_error","")}}}else{valid=false}if(valid){toggle("lowerprice_form_"+num,0);toggle("lowerprice_success_"+num,1);ajaxLoader("lowerprice_success_"+num,3);email=document.getElementById("lowerprice_email_"+num).value;fssprice=document.getElementById("lowerprice_fssprice_"+num).value;lowprice=document.getElementById("lowerprice_lowprice_"+num).value;wheresaw=document.getElementById("lowerprice_wheresaw_"+num).value;comments=document.getElementById("lowerprice_comm_"+num).value;whensaw=document.getElementById("lowerprice_whensaw_"+num).value;ihdnum=document.getElementById("lowerprice_ihdnum_"+num).value;$.ajax({type:"POST",url:"/cigars/include/ajax_lowerprice.cfm",data:"email="+email+"&fssprice="+fssprice+"&lowprice="+lowprice+"&wheresaw="+wheresaw+"&comments="+comments+"&whensaw="+whensaw+"&ihdnum="+ihdnum+"&count="+num,success:function(data){writeAjax("lowerprice_success_"+num,data);if(data.search(/thank/i)>0){setTimeout("tb_remove()",1500);setTimeout('toggle("lowerprice_form_'+num+'", 1)',2500);setTimeout('toggle("lowerprice_success_'+num+'", 0)',2500);setTimeout('resetForm("lowerprice_email_'+num+",lowerprice_lowprice_"+num+",lowerprice_wheresaw_"+num+",lowerprice_comm_"+num+'")',2500)}}})}}function resetForm(ids){var ids_array=ids.split(",");for(i=0;i<ids_array.length;i++){if(document.getElementById(ids_array[i])){clearInput(ids_array[i]);document.getElementById(ids_array[i]).value=""}if(document.getElementById(ids_array[i]+"_error")){writeAjax(ids_array[i]+"_error","")}}}function goodURL(id){str=document.getElementById(id);var regex=/^[0-9A-Za-z-&_:\/\?\;\=.-]+$/;if(regex.test(str.value)){return true}else{str.value=str.value.replace(/[^a-zA-Z 0-9-&_:\/\?\;\=.-]+/g,"");return false}}function checkText(id){str=document.getElementById(id);var regex=/^[0-9A-Za-z-_,.!?'-]+$/;if(regex.test(str.value)){return true}else{str.value=str.value.replace(/[^a-zA-Z 0-9-_,.!?'-]+/g,"");return false}}function ismaxlength(obj){var mlength=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):"";if(obj.getAttribute&&obj.value.length>mlength){obj.value=obj.value.substring(0,mlength)}}function checkNull(id,msg){if(document.getElementById(id)){document.getElementById(id).value=document.getElementById(id).value.trim();if(isNull(id)){valid=false;redInput(id);if(document.getElementById(id+"_error")){writeAjax(id+"_error",msg)}}else{clearInput(id);if(document.getElementById(id+"_error")){writeAjax(id+"_error","")}}}else{valid=false}}function validateEmail(id,msg){if(document.getElementById(id)){document.getElementById(id).value=document.getElementById(id).value.trim();if(!isNull(id)){if(!validEmail(id)){valid=false;redInput(id);if(document.getElementById(id+"_error")){writeAjax(id+"_error",msg)}}else{clearInput(id);if(document.getElementById(id+"_error")){writeAjax(id+"_error","")}}}}else{valid=false}};
