var jsReady = false;
var docHeight;
var browser;
var trace = 0;

function detectBrowser()
{
	/*
	navigator.appCodeName;
	navigator.appName;
	navigator.appVersion;
	navigator.cookieEnabled;
	navigator.platform;
	navigator.userAgent;
	*/
}
function getScrollTop(){
    if(typeof pageYOffset!= 'undefined'){
        //most browsers
        return pageYOffset;
    }
    else{
        var B=document.body; //IE 'quirks'
        var D=document.documentElement; //IE with doctype
        D = (D.clientHeight) ? D: B;
        return D.scrollTop;
    }
}
function getViewPort(){
    if(typeof window.innerHeight!= 'undefined'){
        //most browsers
        return window.innerHeight;
    }
    else {
        return document.documentElement.clientHeight;
    }
}
function setDocHeight()
{
	//if (navigator.userAgent.indexOf("IE") > -1) {
		docHeight = (document.getElementById('bodybg').scrollHeight - 190) + 'px';
	//} else {
	//	docHeight = (window.innerHeight - 190) + 'px';
	//}
	//window.status = "docHeight = " + docHeight;
}
function setBodyHeight()
{
	setDocHeight();
	document.getElementById('content').style.height = docHeight;
	aTxt = 'body height: ' + document.body.clientHeight + '\n';
	aTxt += 'docHeight height: ' + docHeight + '\n';
	aTxt += 'header height: ' + document.getElementById('header').clientHeight + '\n';
	aTxt += 'ddMenu height: ' + document.getElementById('ddMenu').clientHeight + '\n';
	aTxt += 'content height: ' + document.getElementById('content').clientHeight + '\n';
	aTxt += 'footer height: ' + document.getElementById('footer').clientHeight + '\n';
	//alert(aTxt);
}
function isReady()
{
    //jsAlert("isReady Called by AS");
    return jsReady;
}
function pageInit()
{
    jsReady = true;
    //jsAlert("pageInit Called by JS");
}

function jsAlert (str) {
	alert("" + str);
}
function jsSetBottomHeight(h) {
	document.getElementById('bottomContent').style.height = h+"px";
}

function jsOpenLink(lnk) {
	//alert(lnk);
	window.open(lnk,"_new");
}

function goHome(sid) {
	var dt = new Date();
	var yr = dt.getFullYear()+1;
	var mo = dt.getMonth();
	var dy = dt.getDate();
	set_cookie("MyNursingKit",sid,yr,mo,dy);
	window.location.href = "home.html";
}

function fixColumns() {
	if (navigator.userAgent.indexOf('Apple')!=-1) {
		document.getElementById('col1').style.width = 319;
		document.getElementById('col2').style.width = 319;
	}
}

function set_cookie( name, value, exp_y, exp_m, exp_d, path, domain, secure ) {
	var cookie_string = name + "=" + escape ( value );
	if ( exp_y ) {
		var expires = new Date ( exp_y, exp_m, exp_d );
		cookie_string += "; expires=" + expires.toGMTString();
	}

	if ( path )
		cookie_string += "; path=" + escape ( path );

	if ( domain )
		cookie_string += "; domain=" + escape ( domain );

	if ( secure )
		cookie_string += "; secure";

	document.cookie = cookie_string;
}
function get_cookie(cookie_name) {
	var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

	if ( results )
		return ( unescape ( results[2] ) );
	else
		return null;
}


