function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function setCookie(c_name,value,expiredays) {var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function checkCookie() { username=getCookie('username'); if (username!=null && username!="") { //alert('Welcome again '+username+'!'); } else { username=prompt('Please enter your email address:',""); if (username!=null && username!="") { setCookie('username',username,365); } } } function addDetail(theID){ //alert(theID); details = getCookie('enquiry'); if (details!=null && details!="") { if(!contains(details,theID)){ details += theID+';'; setCookie('enquiry',details,365); } } else { setCookie('enquiry',theID+';',365); } // alert('enquiry='+getCookie('enquiry')); showEnquiryText(); } function isCookieSet(theID){ value = false; //alert(theID); details = getCookie('enquiry'); if (details!=null && details!=""){ value = contains(details,theID); } return value; } function contains(theList,theID){ found = false; mylist = theList.split(';'); for( x in mylist){ if(mylist[x] == theID){ found = true; } } return found; } function removeDetail(theID){ details = getCookie('enquiry'); newlist = ''; if (details!=null && details!=""){ mylist = details.split(';'); for( x in mylist){ if((mylist[x] != theID) && (mylist[x] != '') ){ // alert('ml='+mylist[x]); newlist += mylist[x]+';'; } } // alert('new='+newlist); setCookie('enquiry',newlist,365); } //alert('enquiry='+getCookie('enquiry')); showEnquiryText(); } function enquiryCount(){ var count = 0; details = getCookie('enquiry'); if (details!=null && details!=""){ mylist = details.split(';'); for( x in mylist){ count += 1; } } //alert('count='+count); return count-1; } function mobile(){ //alert("mobile"); setCookie('resolution',800,365); } function nomobile(){ //alert("nomobile"); setCookie('resolution',1000,365); } function showEnquiryText() { var count = 0; var otxt; //alert(str); count = enquiryCount(); otxt = document.getElementById('enquirytext'); if((otxt != null) && (count > 0)){ otxt.innerHTML = 'You currently have '+count+' enquiry items in your enquiry list. To submit them click here'; }else{ otxt.innerHTML = ' '; } }