	var sval = "Search:";
	var searchTxt = 'Search:';
	function clearSearch(el){
		if(el.value==sval) {
			el.value='';
		}
	}
	function restoreSearch(el){
		if(el.value==='') {
			el.value=sval;
		}
	}

// COOKIE CONFIGURATION VALUES

var hp_cookie_path = '/';
var hp_cookie_expiration = 90; // in days
var _Ck_ = new _CK_(hp_cookie_expiration, hp_cookie_path, hp_cookie_domain );
var product_cookie = 'hp_product';


// COOKIE FUNCTIONS
function setCk(_name, _value, _duration, _path, _domain){ _Ck_.set(_name, _value, _duration, hp_cookie_path, hp_cookie_domain); }
function getCk(_name){ _Ck_.get(_name); }
function _CK_(_duration, _path, _domain){
	this.domain = _domain;
	this.duration = _duration;
	this.path = _path;
	this.exist = function(_n){ var sM = document.cookie.match(new RegExp("(" + _n + "=[^;]*)(;|$)")); return sM ? unescape(sM[1]) : null; }
	this.get = function (_n) { var sR = document.cookie.match ( _n + '=(.*?)(;|$)' ); return sR ? unescape(sR[1]) : null; }
	this.set = function( _name, _value, _duration, _path, _domain, _secure ){ 
		var duration = (_duration) ? _duration : this.duration;
		var path = (_path) ? _path : this.path;
		var domain = (_domain) ? _domain : this.domain;
		if( duration ){ var date = new Date ( ); date.setTime(date.getTime()+(duration*24*60*60*1000));	var dExpires = date.toGMTString(); }	
		document.cookie = _name +"="+ escape(_value) +";expires="+dExpires + ((domain) ? "; domain=" + domain : "") + ((path) ? "; path=" + path : "")};	
	this.del = function(_name, _domain) { 
		var domain = (_domain) ? _domain : this.domain; var date = new Date(); date.setFullYear(date.getYear() - 1); 
		document.cookie=_name + "=; expires=" + date.toGMTString() + ((domain) ? "; domain=" + domain : "") + ((this.path) ? "; path=" + this.path : "/"); }
}


	//--------------------------------------------------------------------------------
	//SBW - Needed because H3 in the products_menu files will not function
	function navTo(sURL, sSect) {
		//alert(sSect);
		if (sSect == "!sg unused - sections.introduction")
			createCookie("tourState", "open", 1);
		else
			eraseCookie("tourState");
		document.location = sURL;
	}
	
	// function to set/clear cookie in order to preload to a particular tab
	// sSect is of form: [primary#][secondary#]
	function gotoTab(sURL, sSect) {
	  if (sSect)
		createCookie("tabState", sSect, 1);
	  else
		eraseCookie("tabState");
	  document.location = sURL;
	}

	// function to open product gallery, num indicates which tab
	// AC: currently just jumps to envsustainability/casestudies.html
	// GB: superseded by function below
	/*
	function launchGallery(num) {
		var section = "none";
		if (num == 1) { section = "carbon"; }
		if (num == 2) { section = "ultraslim"; }
		if (num == 3) { section = "datacenter"; }
		if (num == 4) { section = "deskjet"; }
		if (num == 5) { section = "greenit"; }
		if (num == 6) { section = "halo"; }
		if (num == 7) { section = "handheld"; }
		if (num == 8) { section = "inkjet"; }
		if (num == 9) { section = "instanton"; }
		if (num == 10) { section = "pavilion"; }
		if (num == 11) { section = "photosmart"; }
		if (num == 12) { section = "printondemand"; }
		if (num == 13) { section = "proliant"; }
		if (num == 14) { section = "touchsmart"; }
		
		var jump_url = "/hpinfo/globalcitizenship/gcreport/envsustainability/casestudies.html";
		if (section != "none") { jump_url = jump_url + "#" + section; }
		document.location = jump_url;
	}
	*/

// Display Product Gallery
// supersedes launchGallery() above
function launchGallery(num) {

	// append css to head
	// safari needs it here; IE6&7 need it in the body (casestudies_popup.html); firefox doesn't care either way
	// solution is to put it both places
	// js can remain in body
	var link = document.createElement('link');
	link.rel = 'stylesheet';
	link.type = 'text/css';
	link.href = '/hpinfo/globalcitizenship/gcreport/_css/gallery.css';
	$('head').append(link);

	// IE6 width needs to be 5px smaller than everyone else (of course)
    //var getWidth=function(){return (isLtIe7())?345:350;};
	jQuery.floatbox({
		ajax: {
			url: "/hpinfo/globalcitizenship/gcreport/envsustainability/casestudies_popup.html",
			params: "",
			evalAfter: "showGallery();"
		},
		fade: true,
		boxConfig: {position: ($.browser.msie)?"absolute":"fixed", zIndex: 9, width: "824px", marginLeft: "-"+(824/2)+"px", height: "auto", top: "10%", left: "50%" ,backgroundColor: "#fff", display: "none"}
		// boxConfig: {position: "absolute", marginLeft: "0px", marginRight: "0px", left: "100px", top: "10%"}
	}); //floatbox

	if (typeof num == "undefined" || num < 1) { num = "1"; } // set default
	createCookie("galleryTab", "tab"+num, 1);
	setFocusToCloseGallery();
}

function setFocusToCloseGallery() {
	setTimeout("jQuery('#_popupGalleryCloseBox').focus();", 1000);
}
