function setCountryText(country) { if(country == 'Australia') { var currency = 'AUD'; } else if(country == 'New Zealand') { var currency = 'NZD'; } else if(country == 'United Kingdom') { var currency = 'GBP'; } else if(country == 'Euro') { var currency = 'EUR'; } else if(country == 'Canada') { var currency = 'CAD'; } else { var currency = 'USD'; country = 'USA'; } var cookieCountry = getCookie('cookie-country'); if(cookieCountry != country) { setCookie('cookie-country', country, 365); setCookie('cookie-currency', currency, 365); window.location.reload(); } } function setCookie(c_name, value, expiredays) { var hostName = window.location.hostname; var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays); document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";path=/;expires=" + exdate.toGMTString() + ";domain=." + hostName + ";"); } 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 sendCookie(cName, cVal, cExp) { // send this cookie to .com // use a time stamp so the image isnt cached.. var timestamp = Number(new Date()); // generate random number so the image isnt cached... var randomNum = Math.round(Math.random()*1000000); // combine the two var randStr = ''+timestamp+''+randomNum+''; // we should hopefully have a random number each time now... var tmpImage = new Image; tmpImage.src = 'http://www.planetdomain.com/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr; } // go through each cookie and send the cookie data to the .com if (document.cookie.length > 0) { var cookies = document.cookie.split(';'); for(x=0;x