<!--

var overImg = null;
var normImg = null;

var loadDone = false;


////////////////////////////////////////////////////////////////////////
/* bookmark function for numeruos browsers  */

function bookmarkinit() {
var IE = navigator.appName.match(/(Microsoft Internet Explorer)/gi), 
    NS = navigator.appName.match(/(Netscape)/gi), 
    OP = navigator.appName.match(/(Opera)/gi), 
    BK = document.getElementById("bookmark");



    BK.onmouseout = function(){ 
       window.status = ''; 
       return true; 
    } 

    if(IE && document.uniqueID){ 
       BK.onclick = function(){ 
          window.external.AddFavorite(location.href,document.title); 
       } 
       BK.onmouseover = function(){ 
          window.status='Click to add this page to your '+RegExp.$1+' favorites'; 
          return true; 
       } 
    } 

    else if(OP || IE && !document.uniqueID){ 
       BK.onclick = function(){ 
          alert('Your '+RegExp.$1+' browser requires that you\nPress Ctrl & T to Bookmark this page.'); 
       } 
       BK.onmouseover = function(){ 
          window.status='Your '+RegExp.$1+' browser requires that you Press Ctrl & T to Bookmark this page.'; 
          return true; 
       } 
    } 

    else if(NS){ 
       BK.onclick = function(){ 
          alert('Your '+RegExp.$1+' browser requires that you\nPress Ctrl & D to Bookmark this page.'); 
       } 
       BK.onmouseover = function(){ 
          window.status='Your '+RegExp.$1+' browser requires that you press Ctrl & D to Bookmark this page.'; 
          return true; 
       } 
    } 

    else{ BK.innerHTML = '' }

}

///////////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////

/* function for body.onLoad */

function initPage() {
	preloadMenu(8);
	loadDone = true;
}

////////////////////////////////////////////////////////////////////////

/* functions for menu and other images */
function preloadMenu(count) {
	overImg = new preloadImages(count, "/data/images/design/menu/menu-", "-on.gif");
	normImg = new preloadImages(count, "/data/images/design/menu/menu-", "-off.gif");
}

function preloadImages(length, path, type) {
    for(var i = 2; i <= length; i++) {
	this[i]= new Image();
	this[i].src= path + i + type;
    }
    return this;
}

function rollOn(num) {
    if(loadDone && document.images) { 
	document.images["m-" + num].src = overImg[num].src;
    }
}

function rollOff(num) {
    if(loadDone && document.images){
	document.images["m-" + num].src = normImg[num].src;
    }
}

function sizeImg(obj, _width) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
    if (tmpImg.width > _width) { obj.width = _width; }
}

function SIP(obj, _w, _h) {
var tmpImg = new Image();
tmpImg.src = obj.src;
if (_w/tmpImg.width > _h/tmpImg.height) {
if (tmpImg.width > _w) {
obj.height = tmpImg.height*(_w/tmpImg.width);
obj.width = _w;
}
if (tmpImg.height > _h) {
obj.width = tmpImg.width*(_h/tmpImg.height);
obj.height = _h;
}
} else {
if (tmpImg.height > _h) {
obj.width = tmpImg.width*(_h/tmpImg.height);
obj.height = _h;
}
if (tmpImg.width > _w) {
obj.height = tmpImg.height*(_w/tmpImg.width);
obj.width = _w;
}
}
}

////////////////////////////////////////////////////////////////////////

/* function to open print\email window */

function PrinterFriendly(url) {
    var width = 700,
        height = 550;

    remote = window.open("http://" + getDomainName() + url, "opener", "scrollbars=1,resizable=1,toolbar=1,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height);

    if (remote.opener == null) remote.opener = window;
}

function getDomainName() {
	/*var url = window.location.href;
	var end = url.indexOf("/", 7);
	if (end == -1) { end = url.length; }
	return url.substring(7, end);*/
	return "www.firerehab.com";
}

/* function that show tip on your status bar when you take mouse over print\email link */

function showText(obj) {
    obj.onmouseout = function() { window.status = ""; }
    window.status = obj.innerText;
}

////////////////////////////////////////////////////////////////////////

/* functions that check different forms for correct information */


function checkEmail(email) {
    var myRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return myRegExp.test(email);
}

function getCookie(name) {

	var regExp 	= new RegExp(name + "=([^;]*)","gi");
	var ck 		= regExp.exec(String(document.cookie));	
	ck 			= RegExp.$1;

	return ck;
}



function httpRequestCreate() {
	
	// ==================================
	// Check browser capability.
	// ==================================
	var httpRequest = false;

	if ( window.XMLHttpRequest ) 
	{ // Mozilla, Safari
		httpRequest = new XMLHttpRequest();
	
		if ( httpRequest.overrideMimeType ) {
			// ==================================
			// For FF (generats an error in javascript console)
			// ==================================
	
			httpRequest.overrideMimeType('text/xml');
		}
	} else if ( window.ActiveXObject ) 
	{ // IE
		try {
			httpRequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		} catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) { document.write(e); }
		}
	}

	return httpRequest;
	
}


function httpRequest(url, encoding, toReceive) {
	
	return httpRequestPost(url, encoding, toReceive,"");
	
	
	/*var toResolve		= 10000;
	var toConnect		= 10000;
	var toSend			= 40000;

	var request;
	var WinHttpReq;

	var request = "";
	try {
		var xmlHttpReq = httpRequestCreate(); //new ActiveXObject("MSXML2.XMLHTTP.3.0");
		xmlHttpReq.open("GET", url, false);
		xmlHttpReq.send();
		return xmlHttpReq.responseText;
		
		if(WinHttpReq.StatusText == "OK") {
			request = BinaryToString1(WinHttpReq.ResponseBody, encoding);
		} else { request = "1- " + WinHttpReq.StatusText; }
	} catch(e) { request = "2- " + "WinHttpRequest has caused an error"; }
	return request;*/
}

function httpRequestPost(url, encoding, toReceive, params) {
	var toResolve		= 10000;
	var toConnect		= 10000;
	var toSend			= 40000;

	var request;
	var WinHttpReq;
	
	var request = "";
	try {
		var xmlHttpReq = httpRequestCreate(); //new ActiveXObject("MSXML2.XMLHTTP.3.0");
		xmlHttpReq.open("POST", url, false);
		xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttpReq.setRequestHeader('HTTP_COOKIE', document.cookie);
		xmlHttpReq.send(params);
		return xmlHttpReq.responseText;

		
		if(WinHttpReq.StatusText == "OK") {
			request = BinaryToString1(WinHttpReq.ResponseBody, encoding);
		} else { request = "2-1 " + WinHttpReq.StatusText; }
	} catch(e) { request = "2-2 " + "WinHttpRequest has caused an error"; }
	return request;
}




//-->