var txtRHR = "<span class=\"title\">Reactive Head Restraint (RHR)<\/span>: "
		+ "A head restraint that automatically moves up and forward during the crash,"
		+ " actuated by the weight of the occupant in the seat. (Example: Saab)";
var txtPAHR = "<span class=\"title\">Pro-Active Head Restraint (PAHR)<\/span>: "
		+ "A head restraint that automatically moves up and forward at the start of "
		+ "the crash, actuated by crash sensors on the bumper or within the car. "
		+ "(Example: Mercedes-Benz C & E Class)";
var txtRAS = "<span class=\"title\">Reactive Seat (RAS)<\/span>: "
		+ "An entire seat and head restraint that absorbs the energy of a rear end crash. "
		+ "(Example: Volvo WHIPS) ";
var txtPAS = "<span class=\"title\">Passive Seat (PAS)<\/span>: "
		+ "A seat that uses passive foam technology to absorb the energy of the crash and  "
		+ "allow the occupant to engage the head restraint without neck distortion. ";
var txtGood = "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>"
		+ "<img alt=\"Good\" class=\"l\" src=\"images/ratings/good.gif\"/><\/td>"
		+ "<td><span class=\"title\">Good<\/span>: A seat that offers good "
		+ "protection for most sizes of occupant - may be	fitted with specific "
		+ "anti-whiplash protection.<\/td><\/tr><\/table>";
var txtAcceptable = "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>"
		+ "<img alt=\"Acceptable\" class=\"l\" src=\"images/ratings/acceptable.gif\"/><\/td>"
		+ "<td><span class=\"title\">Acceptable<\/span>: A seat that offers reasonable "
		+ "protection for small to average size drivers.<\/td><\/tr><\/table>";
var txtMarginal = "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>"
		+ "<img alt=\"Marginal\" class=\"l\" src=\"images/ratings/marginal.gif\"/><\/td>"
		+ "<td><span class=\"title\">Marginal<\/span>: A seat that offers some protection "
		+ "for small to	average occupants.<\/td><\/tr><\/table>";
var txtPoor = "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>"
		+ "<img alt=\"Poor\" class=\"l\" src=\"images/ratings/poor.gif\"/><\/td>"
		+ "<td><span class=\"title\">Poor<\/span>: A seat that offers little protection "
		+ "from whiplash type injuries.<\/td><\/tr><\/table>";
var txtRefusedSupply = "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>"
		+ "<img alt=\"Refused Supply\" class=\"l\" src=\"images/ratings/refused_supply.gif\"/><\/td>"
		+ "<td><span class=\"title\">Refused Supply<\/span>: Manufacturer refused to "
		+ "supply seats or participate in	testing. It may be assumed that these "
		+ "seats would offer insufficient	protection.<\/td><\/tr><\/table>";
var txtNA = "Seats that have <b>MARGINAL</b> or <b>POOR</b> head restraint "
		+ "geometry are not dynamically tested since they do not have a head "
		+ "restraint capable of a minimum level of whiplash protection.";

document.write("<div id=\"hw\"><\/div>");

function getContent(value) {
	switch (value) {
	case "RHR":
		return txtRHR;
	case "PAHR":
		return txtPAHR;
	case "RAS":
		return txtRAS;
	case "PAS":
		return txtPAS;
	case "Good":
		return txtGood;
	case "Acceptable":
		return txtAcceptable;
	case "Marginal":
		return txtMarginal;
	case "Poor":
		return txtPoor;
	case "Refused Supply":
		return txtRefusedSupply;
	case "Awaiting Supply":
		return "<span class=\"title\">Awaiting Supply<\/span>: We are "
				+ "currently awaiting the supply of this seat."
	case "N/A":
		return txtNA;
	case "Geo":
		return "<span class=\"title\">Geometric Rating<\/span>: Fundamental to "
				+ "whiplash protection. Statically measures the size and shape of the "
				+ "head restraint. Remember to correctly adjust your head restraint!";
	case "SAC":
		return "<span class=\"title\">Seat Assessment Criteria<\/span>: Measures "
				+ "the ability of the seat to catch the head of the occupant and absorb "
				+ "the energy of the crash.";
	case "NF":
		return "<span class=\"title\">Neck Forces<\/span>: Measures the loads "
				+ "imparted onto the crash dummy during a crash. Classed as one of "
				+ "three zones: Low, Moderate, or High.";
	case "Dyn":
		return "<span class=\"title\">Dynamic Rating<\/span>: A combination of "
				+ "the seat assessment criteria and neck forces into an overall "
				+ "dynamic rating.";
	case "Ovrl":
		return "<span class=\"title\">Overall Rating<\/span>: Takes the dynamic "
				+ "rating and adjusts it for geometric deficiencies.";
	default:
		return "";
	}
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getPageDimensions() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } 
  return [myWidth, myHeight];
}

function showHelp(e, content) {
	if (!e)
		var e = window.event;
		var hw = document.getElementById("hw");
	if (hw.style.visibility != "visible") {
		hw.innerHTML = content;
		hw.style.visibility = "visible";
	}
		
	var scrollArray = getScrollXY();
	var pageDimensionArray = getPageDimensions();
	

	/*if (document.body.clientWidth - e.clientX > 1200){
  	  hw.style.left = (e.clientX + document.body.scrollLeft - 0) + "px";
	}
	else 
	if (document.body.clientWidth - e.clientX > 336){
	  hw.style.left = (e.clientX + document.body.scrollLeft - 336) + "px";
	}
	else{
	  hw.style.left = (boxLeft + scrollArray[0] - 0) + "px";
    }
	*/
	
	
	if (pageDimensionArray[1] - e.clientY < (hw.offsetHeight + 10)){
		//hw.style.top = (e.clientY + document.body.scrollTop - 176 - hw.offsetHeight) + "px";
		hw.style.top = (e.clientY + scrollArray[1] - 176 - hw.offsetHeight) + "px";
	}
	else{
		//hw.style.top = (e.clientY + document.body.scrollTop - 156) + "px";
		hw.style.top = (e.clientY + scrollArray[1] - 156) + "px";
	}
}

function hideHelp() {
	var hw = document.getElementById("hw");
	hw.style.visibility = "hidden";
}
