//Progressive Disclosure Javascript

function ToggleCatDivs(div) {
	if (document.getElementById("content" + div) != null) {
	
		if (document.getElementById("content" + div).style.display != "block") {
			document.getElementById("plus" + div).src = "http://welcome.hp-ww.com/img/hpweb_1-2_minus.gif";
			document.getElementById("content" + div).style.display = "block";
			document.getElementById("phoneNumber").style.display = "block";
			if (div == "HHO6") {
				window.scrollBy(0,500);
			}
		} else if  (document.getElementById("content" + div).style.display == "block"){
			document.getElementById("plus" + div).src = "http://welcome.hp-ww.com/img/hpweb_1-2_plus.gif";
			document.getElementById("content" + div).style.display = "none";	
			document.getElementById("phoneNumber").style.display = "none";
			document.getElementById('opaqueLayer').style.height = document.getElementById("copyright").offsetTop+20+'px';		
		}
	}
}

function CatDivsOnLoad() {
	var i;
	for (i=1;i<=10;i++) {
		if (document.getElementById("plusSMB" + i) == null) {
			break;
		} else {
			document.getElementById("plusSMB" + i).src = "http://welcome.hp-ww.com/img/hpweb_1-2_plus.gif";
		}	
	}
	
	var j;
	for (j=1;j<=6;j++) {
		if (document.getElementById("plusHHO" + j) == null) {
			break;
		} else {
			document.getElementById("plusHHO" + j).src = "http://welcome.hp-ww.com/img/hpweb_1-2_plus.gif";
		}			
	}	
}


function ShowAllCatDivs(segment) {
	if (segment == "SMB") {
		var i;
		for (i=1;i<=10;i++) {		
			if (document.getElementById("plus" + segment + i) == null) {
				break;				
			} else {
				document.getElementById("plus" + segment + i).src = "http://welcome.hp-ww.com/img/hpweb_1-2_minus.gif";
				document.getElementById("content" + segment + i).style.display = "block";
			}			
		}
	} else if (segment == "HHO") {
		var i;
		for (i=1;i<=6;i++) {		
			if (document.getElementById("plus" + segment + i) == null) {
				break;
			} else {
				document.getElementById("plus" + segment + i).src = "http://welcome.hp-ww.com/img/hpweb_1-2_minus.gif";
				document.getElementById("content" + segment + i).style.display = "block";
			}
		}	
	}
	document.getElementById("phoneNumber").style.display = "block";
}

function HideAllCatDivs(segment) {
	if (segment == "SMB") {
		var i;
		for (i=1;i<=10;i++) {		
			if (document.getElementById("plus" + segment + i) == null) {
				break;
			} else {
				document.getElementById("plus" + segment + i).src = "http://welcome.hp-ww.com/img/hpweb_1-2_plus.gif";
				document.getElementById("content" + segment + i).style.display = "none";
				document.getElementById('opaqueLayer').style.height = document.getElementById("copyright").offsetTop+20+'px';
			}
		}
	} else if (segment == "HHO") {
		var i;
		for (i=1;i<=6;i++) {		
			if (document.getElementById("plus" + segment + i) == null) {
				break;
			} else {		
				document.getElementById("plus" + segment + i).src = "http://welcome.hp-ww.com/img/hpweb_1-2_plus.gif";
				document.getElementById("content" + segment + i).style.display = "none";
				document.getElementById('opaqueLayer').style.height = document.getElementById("copyright").offsetTop+20+'px';
			}
		}	
	}
	document.getElementById("phoneNumber").style.display = "none";
}

// Creating the initial CSS state for the Progressive disclosure divs.

document.write('<style type="text/css">');
document.write('#contentSMB1, #contentSMB2, #contentSMB3, #contentSMB4, #contentSMB5, #contentSMB6, #contentSMB7, #contentSMB8, #contentSMB9, #contentSMB10, ');
document.write('#contentHHO1, #contentHHO2, #contentHHO3, #contentHHO4, #contentHHO5, #contentHHO6, #phoneNumber {');
document.write('	display: none;');
document.write('}');
document.write('</style>');


// Function that pulls the anchor value out to target a specific PD and open it
function createArray() {
	anchorTag = '' + this.location;
	if (anchorTag.indexOf('#') != -1) {
		anchorTag = anchorTag.slice((anchorTag.indexOf('#')) + 1);
		if (anchorTag.indexOf('?') != -1) {
			anchorTag = anchorTag.split('?');
			anchorTag = anchorTag[0];
		}
		return anchorTag;		
	}
}

// Calling the Function which parses the querystring
pddiv = createArray();





