$(document).ready(function(){var margin="775";var tracker=1;var target;var move;var selected_qty=0;$(".fullcol").click(function(){var type=document.getElementById('type').value;if(type=="woven"){var test=confirm("Full colour is not availiable for Woven Lanyards.\r\n\r\nPress OK to select a different type or Cancel for single sided.\r\n\r\n");if(test==true){document.getElementById('twosides').style.display='';document.getElementById('twosides2').style.display='';$(".slider").animate({marginLeft:"+=1550px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_2.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_1.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_1.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_1.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_1.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");}else{document.lanyards.fullcol.checked=false;document.lanyards.onecol.checked=true;}}});$(".twoside").click(function(){var type=document.getElementById('type').value;if(type=="woven"){var test=confirm("Double sided is not availiable for Woven Lanyards.\r\n\r\nPress OK to select a different type or Cancel for single sided.\r\n\r\n");if(test==true){document.getElementById('twosides').style.display='';document.getElementById('twosides2').style.display='';$(".slider").animate({marginLeft:"+=1550px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_2.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_1.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_1.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_1.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_1.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");}else{document.lanyards.twoside.checked=false;document.lanyards.oneside.checked=true;}}});$(".page_2").click(function(){if(tracker==1){$(".slider").animate({marginLeft:"-="+margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_2.gif");tracker=2;}else{alert("You must select your lanyard type");tracker=1;}});$(".page_3").click(function(){selected_qty=document.getElementById('quantity').value;var numericExpression=/^[0-9]+$/;if(document.getElementById('quantity').value.match(numericExpression)){if(selected_qty<100){alert('Minimum Order Of 100 Is Required To Proceed!');}else{$(".slider").animate({marginLeft:"-="+margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_2.gif");tracker=3;}}else{alert("Please enter whole numbers only");}});$(".page_4").click(function(){$(".slider").animate({marginLeft:"-="+margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_3.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_2.gif");tracker=4;});$(".page_5").click(function(){var selected_clip=document.forms["lanyards"].elements["clip_holder"].value;if(selected_clip=="PLASTIC J CLIP"&&document.forms["lanyards"].elements["type_holder"].value=="ht poly"){alert("Plastic J Clips are not availiable with HT Transfer Lanyards. Please select a different clip type.");}else{$(".slider").animate({marginLeft:"-="+margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_3.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_3.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_2.gif");tracker=5;}});$(".page_6").click(function(){$(".slider").animate({marginLeft:"-="+margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_3.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_3.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_3.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_2.gif");tracker=6;});$("#submit").click(function(){if($("#customeremail").val()==""||$("#customername").val()==""){alert("Please fill in your details");}else{var emailExp=/^.+@[a-zA-Z0-9.-]+\.[A-Za-z]+$/;if(document.getElementById('customeremail').value.match(emailExp)){tracker=7;ajaxFunction();$(".slider").animate({marginLeft:"-="+margin+"px"},1000);}else{alert("Your email is not valid");}}});$(".page_1_back").click(function(){target="1";move=tracker-target;$(".slider").animate({marginLeft:"+="+move*margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_2.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_1.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_1.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_1.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_1.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");tracker=1;});$(".page_2_back").click(function(){if(tracker>2){target="2";move=tracker-target;$(".slider").animate({marginLeft:"+="+move*margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_2.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_1.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_1.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_1.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");tracker=2;}else{alert('Please select a lanyard type');}});$(".page_3_back").click(function(){if(tracker>3){target="3";move=tracker-target;$(".slider").animate({marginLeft:"+="+move*margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_2.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_1.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_1.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");tracker=3;}else{alert('Please Complete the steps in order');}});$(".page_4_back").click(function(){if(tracker>4){target="4";move=tracker-target;$(".slider").animate({marginLeft:"+="+move*margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_3.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_2.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_1.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");tracker=4;}else{alert('Please Complete the steps in order');}});$(".page_5_back").click(function(){if(tracker>5){target="5";move=tracker-target;$(".slider").animate({marginLeft:"+="+move*margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_3.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_3.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_2.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_1.gif");tracker=5;}else{alert('Please Complete the steps in order');}});$(".page_6_back").click(function(){if(tracker>5){target="6";move=tracker-target;$(".slider").animate({marginLeft:"+="+move*margin+"px"},1000);$('img.page_1_back').attr("src","/lanyards/resources/type_3.gif");$('img.page_2_back').attr("src","/lanyards/resources/qty_3.gif");$('img.page_3_back').attr("src","/lanyards/resources/spec_3.gif");$('img.page_4_back').attr("src","/lanyards/resources/clip_3.gif");$('img.page_5_back').attr("src","/lanyards/resources/options_3.gif");$('img.page_6_back').attr("src","/lanyards/resources/quote_2.gif");tracker=6;}else{alert('Please Complete the steps in order');}});});function getColours(){colours="none";if(document.forms["lanyards"].elements["onecol"].checked==true)colours="one";else if(document.forms["lanyards"].elements["twocol"].checked==true)colours="two";else if(document.forms["lanyards"].elements["threecol"].checked==true)colours="three";else if(document.forms["lanyards"].elements["fullcol"].checked==true)colours="full";return colours;}function getSides(){sides="none";if(document.forms["lanyards"].elements["oneside"].checked==true)sides="one";else if(document.forms["lanyards"].elements["twoside"].checked==true)sides="two";return sides;}function getWidth(){width="none";if(document.forms["lanyards"].elements["ten"].checked==true)width="10mm";else if(document.forms["lanyards"].elements["fifteen"].checked==true)width="15mm";else if(document.forms["lanyards"].elements["twenty"].checked==true)width="20mm";else if(document.forms["lanyards"].elements["twentyfive"].checked==true)width="25mm";return width;}function clip(selected_clip){if(selected_clip=="MOBILE PHONE"){document.forms["lanyards"].elements["mobile"].checked=true;document.forms["lanyards"].elements["clip_holder"].value="MOBILE PHONE";}else{document.forms["lanyards"].elements["clip_holder"].value=selected_clip;}}function ajaxMe(destObj,theURL){var httpRequest;var theDest=document.getElementById(destObj);theURL+='&ajDt='+new Date().valueOf().toString();if(window.XMLHttpRequest){httpRequest=new XMLHttpRequest();if(httpRequest.overrideMimeType){httpRequest.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{httpRequest=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}if(!httpRequest){return true;}httpRequest.onreadystatechange=function(){ajaxContents(httpRequest,theDest);};httpRequest.open('GET',theURL,true);httpRequest.send('');return false;}function ajaxContents(httpRequest,theDest){if(httpRequest.readyState==4){if(httpRequest.status==200){theDest.innerHTML=httpRequest.responseText;}else{theDest.innerHTML="Whoops, something didn't quite work there";}}}function ajaxFunction(){theURL="/lanyards/cust_quote.php?type="+encodeURIComponent(document.getElementById('type').value)+"&cTel="+encodeURIComponent(document.getElementById('customertel').value)+"&cName="+encodeURIComponent(document.getElementById('customername').value)+"&cEmail="+encodeURIComponent(document.getElementById('customeremail').value)+"&qty="+encodeURIComponent(document.getElementById('quantity').value)+"&qty2="+encodeURIComponent(document.getElementById('quantity_two').value)+"&qty3="+encodeURIComponent(document.getElementById('quantity_three').value)+"&colours="+encodeURIComponent(getColours())+"&sides="+encodeURIComponent(getSides())+"&width="+encodeURIComponent(getWidth())+"&safety="+encodeURIComponent(document.forms["lanyards"].elements["safety"].checked)+"&buckle="+encodeURIComponent(document.forms["lanyards"].elements["buckle"].checked)+"&mobile="+encodeURIComponent(document.forms["lanyards"].elements["mobile"].checked)+"&open="+encodeURIComponent(document.forms["lanyards"].elements["open"].checked)+"&clip="+encodeURIComponent(document.getElementById('clip_holder').value)+"&voucher="+encodeURIComponent(document.getElementById('voucher').value);ajaxMe('ajaxDiv',theURL);}function ajaxfor_clip(clipType){theURL="/lanyards/price_guide.php?type="+encodeURIComponent(document.getElementById('type').value);alert(theURL);ajaxMe(clipType,theURL);}function setType(clicked_type){document.forms["lanyards"].elements["type_holder"].value=clicked_type;document.lanyards.ten.disabled=false;if(clicked_type=="woven"){document.lanyards.ten.disabled=true;document.lanyards.fullcol.checked=false;document.lanyards.onecol.checked=true;document.lanyards.twoside.checked=false;document.lanyards.oneside.checked=true;}if(clicked_type=="ht poly"){document.lanyards.fullcol.checked=true;document.lanyards.onecol.checked=false;document.lanyards.twocol.disabled=true;document.lanyards.onecol.disabled=true;document.lanyards.threecol.disabled=true;}else{document.lanyards.twocol.disabled=false;document.lanyards.onecol.disabled=false;document.lanyards.threecol.disabled=false;}theURL="/lanyards/price_guide.php?type="+encodeURIComponent(document.getElementById('type').value);ajaxMe('ajax_qty',theURL);}function inputCounter(valObj,outObj){outObj.innerHTML=String(Number(valObj.getAttribute('MAXLENGTH'))-valObj.value.length);}function wPop(obj){window.open(obj.href,"RefreshWindow");return false;}function clock(){var today=new Date();var y=today.getFullYear();var j=today.getMonth();var d=today.getDate();var h=today.getHours();var m=today.getMinutes();var s=today.getSeconds();h=padTens(h);m=padTens(m);s=padTens(s);document.getElementById('clock').innerHTML=d+"<sup>"+numberLetters(d)+"</sup>"+theMonths(j)+y+" "+h+":"+m+":"+s;t=setTimeout('clock();',1000);}function padTens(i){if(i<10)i="0"+i;return i;}function numberLetters(i){var string='';switch(i){case 1:case 21:case 31:string='st ';break;case 2:case 22:string='nd ';break;case 3:case 23:string='rd ';break;default:string='th ';break;}return string;}function theMonths(i){var string='';switch(i){case(0):string='January ';break;case(1):string='February ';break;case(2):string='March ';break;case(3):string='April ';break;case(4):string='May ';break;case(5):string='June ';break;case(6):string='July ';break;case(7):string='August ';break;case(8):string='September ';break;case(9):string='October ';break;case(10):string='November ';break;case(11):string='December ';break;}return string;}
