//*********************************************************************
// Breake out of Frames - get out of other sites frame based hijacking
//*********************************************************************
function frame_breaker()
{
  if (top.location != self.location) 
	{
    top.location.replace(self.location);
  }
}
//*********************************************************************
// Change CSS Display type to 'block'
// Used to unhide disply:none
//*********************************************************************
function displayIt(id)
{
	document.getElementById(id).style.display ='block';
}
// *******************************************************************
// Cookie Routines written by John Gardner - 2003 - 2005
// See www.braemoor.co.uk/software for information about more freeware
// available.
// *******************************************************************
// Routine to get the current value of a cookie
function getCookieValue (cookieName) {
  var exp = new RegExp (escape(cookieName) + "=([^;]+)");
  if (exp.test (document.cookie + ";")) {
    exp.exec (document.cookie + ";");
    return unescape(RegExp.$1);
  }
  else return false;
}
// Routine to see if session cookies are enabled
function testSessionCookie() {
	document.cookie ="testSessionCookie=Enabled";
	if (getCookieValue("testSessionCookie")=="Enabled") {
		return true 
	}
	else {
		return false;
	}
}
// Test to see if Session Cookies are Enabled
function sessionCookieTest() {
  if (testSessionCookie()) {
    //alert ("Session coookies are enabled");
	 location.replace("/");
    return true;
  }
  else {
    //alert ("Session coookies are not enabled");
    return false;
  }
}  
// Redirect to page if no Session Cookie
function noSessionCookieRedirect(redirectPath) {
	if (testSessionCookie()){
		//alert ("Session coookies are enabled");
		//window.status="Session coookies are enabled";
	}
	else {
		//alert ("Session coookies are not enabled");
		//window.status="Session coookies are enabled";
		location.replace(redirectPath);
		
	}
}
// *******************************************************************
// Check or uncheck checkboxes
// Usage: onclick="SetAllCheckBoxes('checkForm', 'organizationType', true);
// *******************************************************************
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}