/* author: cliveb@senet.com.au */
/* Generated by AceHTML Freeware http://freeware.acehtml.com */
/* Creation date: 11/04/05 */
// Public domain cookie code written by:
// Bill Dortch, hIdaho Design
// (bdortch@netw.com)
function getCookieVal (offset) {  
         var endstr = document.cookie.indexOf (";", offset);  
         if (endstr == -1)    
            endstr = document.cookie.length;  
            return unescape(document.cookie.substring(offset, endstr));
      }
      function GetCookie (name) {  
         var arg = name + "=";  
         var alen = arg.length;  
         var clen = document.cookie.length;  
         var i = 0;  
         while (i < clen) {    
            var j = i + alen;    
            if (document.cookie.substring(i,j) == arg)      
               return getCookieVal (j);    
            i = document.cookie.indexOf(" ", i) + 1;    
            if (i == 0) break;   
         }  
         return null;
      }
      function SetCookie (name, value) {  
         var argv = SetCookie.arguments;  
         var argc = SetCookie.arguments.length;  
         var expires = (argc > 2) ? argv[2] : null;  
         var path = (argc > 3) ? argv[3] : null;  
         var domain = (argc > 4) ? argv[4] : null;  
         var secure = (argc > 5) ? argv[5] : false;  
         document.cookie = name + "=" + escape (value) + 
         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
         ((path == null) ? "" : ("; path=" + path)) +  
         ((domain == null) ? "" : ("; domain=" + domain)) +    
         ((secure == true) ? "; secure" : "");
      }
      function DeleteCookie (name) {  
         var exp = new Date();  
         exp.setTime (exp.getTime() - 1);  
         var cval = GetCookie (name);  
         document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
      }

   
 // end public cookie functions

function showpopup(popup) {
popup=popup+".htm";
var popwin = window.open(popup, "popupwindow", "resizable, width=400, height=300, scrollbars");
popwin.focus()
}

function instructions(popup) {
popup=popup+".htm"
var popwin = window.open(popup, "popupwindow", "resizable, toolbar, width=640, height=480, scrollbars");
popwin.focus()
}
              
function expireDate(months) {
var expireDate;
expireDate = new Date;
month = expireDate.getMonth();
month = month + eval(months);
expireDate.setMonth(month);
return expireDate;
}

function addbookmark(shorturl,bookmarktitle){
if (document.all)
bookmarkurl="http://www.coolmax.com.au/";
bookmarkurl=bookmarkurl+shorturl+".htm"
window.external.AddFavorite(bookmarkurl,bookmarktitle);
}

		
		function cookieVal(cookieName) {
			thisCookie = document.cookie.split("; ")
	  	    for (i=0; i<thisCookie.length; i++) {
	  	        if (cookieName == thisCookie[i].split("=")[0]) {
	  	        	return thisCookie[i].split("=")[1]
	  	        }
	   	    }
			return 0
		}
		
function csplit(cookie) {
var csplit;
var cookieval;
cookieval = GetCookie (cookie);
if (cookieval != null) {
re = /[,]/
csplit = cookieval.split(re)
//alert("csplit " + csplit)
}
return csplit;
}
		

var oflg=1;//reset this to 0 in the calling program if you need to prevent calling the survey under certain circumstances.

	 function leave(survey) {
//if (expdate==null) {	 
var expdate = expireDate(6);
//}
		hitCt = parseInt(cookieVal("pageHit"));
		hitCt++;
SetCookie ("pageHit",hitCt,expdate);
//		document.cookie = "pageHit="+hitCt+";expires=" + expireDate.toGMTString();
		if (hitCt==1) {
		if (oflg==1){
		survey = survey + ".htm";
window.open(survey,'','toolbar=no,menubar=no,scrollbars,location=no,height=500,width=600');
}
}
}

function datestamp() {
Stamp = new Date();
document.write(Stamp.getDate() +"/"+(Stamp.getMonth() + 1)+ "/"+Stamp.getYear() + '<BR>');
var Hours;
var Mins;
var Time;
Hours = Stamp.getHours();
if (Hours >= 12) {
Time = " p.m.";
}
else {
Time = " a.m.";
}
if (Hours > 12) {
Hours -= 12;
}
if (Hours == 0) {
Hours = 12;
}
Mins = Stamp.getMinutes();
if (Mins < 10) {
Mins = "0" + Mins;
}	
document.write(Hours + ":" + Mins + Time);
}

function test() {
alert('test');
}

function copyright(firstyear) {
var currentyear;
year = new Date;
currentyear = year.getYear();
document.write("<p>Copyright © ");
if (currentyear!=firstyear) document.write(firstyear + "-");
document.write(currentyear + " COOLMAX</p>");
//return currentyear;
}

function checkwin(survey) {
//needs two files winsurvey.htm and sorrysurvey.htm
Stamp = new Date(); var Secs; Secs = Stamp.getSeconds(); 
survey = survey + ".htm";
if (Secs>54) {
survey = "win" + survey;
calculator(prospects);
}
else {
survey = "sorry" + survey;
}
window.open(survey,'','toolbar=no,menubar=no,scrollbars,location=no,height=500,width=600');
}

function calculator(form) {
version=form.version.value
if (version=="room") address="k43txu";
if (version=="ducted") address="k44txu";
if (version=="office") address="k45txu";
if (version=="ducted office") address="k46txu";
window.open("../calculators/" + address + ".htm");
}

/*
For full source code, installation instructions,
Use, visit dynamicdrive.com
*/

function printit(){
if (NS) {
    window.print() ;
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";
}
}
