function printerfriendly()
{
	document.write ("<img src=\"http://welcome.hp-ww.com/img/hpweb_1-2_prnt_icn.gif\" width=\"19\" height=\"13\" alt=\"\" border=\"0\"><a href=\"http://www.hp.com/cgi-bin/pf-new.cgi?IN=" + location.href + "\" class=\"udrlinebold\">Printable version</a>");
}

function popup(url,wh,ht) {
	win = open (url, 'popup', 'height='+ht+',width='+wh+',scrollbars=yes,toolbars=no,left=0,top=0');
	win.focus();
}

// ROTATING HOME PROMOTION GRAPHICS

var totalpics = 1; // ALWAYS total number of pics - 1
var ct1 = 0;  // column 1 counter to start at 0

var ad1 = new Array(); // array of images for column 1
ad1[0]="/images/chiclet_australia.jpg";
ad1[1]="/images/chiclet_promo.jpg";

var ad1url = new Array(); // array of urls for column1, the url order follows ada order
ad1url[0]="/bigbang/luckydraw.shtml"
ad1url[1]="/promotions.shtml"

var url1 = ad1url[0];

// Start Rotating Images in each column

// Rotating Column 1 graphics
function cyclec1() {
/*
	if (document.images) {
		if (document.promo1.complete) {
			
			document.promo1.src=ad1[ct1];
			url1 = ad1url[ct1];
			if (ct1==totalpics) {
				ct1=0;
			}
			else {
				ct1++;
			}
		}
		setTimeout("cyclec1()", 5000);
	}
*/
}

// Putting Column 1 graphics url
function geturl1() {
	if (!url1.indexOf("http://")) {
		if(url1==ad1url[1])
		window.open(url1);
		else
		{
		parent.location.href=url1;
		}
	}
	else {
		parent.location.href = url1;
	}
}
// Start added by alan for ap survey 20 aug 2003
var expDays = 365; // number of days the cookie should last
/*var surveyURL = "http://h50031.www5.hp.com/survey/index.html";

function openSurvey()
{//v2.0
	var count = GetCookie('count');
	if (count == null)
	{
		// creates new cookie for counter
		SetCookie('count', 1, exp);
		// creates new cookie for last visit
		SetCookie('lastvisit', new Date(), exp);
	}
	else if (count < 2) // have yet taken the survey
	{
		var lastvisit = new Date(GetCookie('lastvisit'));
		var now = new Date();
		var diff = now.getTime() - lastvisit.getTime();
		var mindiff = Math.floor(diff / (1000 * 60));
		if (mindiff >= 30) // last visit was more than 30mins ago
		{
			window.open(surveyURL,"survey","scrollbars=yes,width=600,height=700");
			count++;
			SetCookie('count', count, exp);
		}
		else
			SetCookie('lastvisit', new Date(), exp);
		
	}
}**/

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 When(info)
{
	var rightNow = new Date()
	var WWHTime = 0;
	WWHTime = GetCookie('lastvisit')
	WWHTime = WWHTime * 1
	var lastHereFormatting = new Date(WWHTime);
	var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
	var lastHereInDateFormat = "" + lastHereFormatting;
	var dayOfWeek = lastHereInDateFormat.substring(0,3)
	var dateMonth = lastHereInDateFormat.substring(4,11)
	var timeOfDay = lastHereInDateFormat.substring(11,16)
	var year = lastHereInDateFormat.substring(23,25)
	var WWHText = dayOfWeek + ", " + dateMonth + " at " + timeOfDay
	SetCookie ("lastvisit", rightNow.getTime(), exp)
	return WWHText
}

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();
}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
	var count = GetCookie('count')
	if(count == null) {
		SetCookie('count','1')
		return 1
	}
	else {
		var newcount = parseInt(count) + 1;
		DeleteCookie('count')
		SetCookie('count',newcount,exp)
		return count
	}
}

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
	var count = GetCookie('count');
	if (count == null) {
		count=1;
		SetCookie('count', count, exp);
		
		window.open(page, "", windowprops);
	}
	else {
		count++;
		SetCookie('count', count, exp);
	}
}

//openSurvey();
// End added by alan for ap survey 20 aug 2003

// Function to jump to a URL in a <select> menu. In this case, the name of the array containing the URLs is determined based on the name of the pulldown menu.
function jumpToURL(formName,menuName) {
 var obj = eval("document." + formName + "." + menuName);
 var index = obj.selectedIndex;
 var url = eval(menuName + "_URLs[" + index + "]");
 if (url != "") {
   location.href=url;
 }
}

function outofsite(url,cty)
{
		window.location.href="outofsite.asp?url=" + url + "&cty=" + cty;
}