
//ADDED FOR BAMPI//
//Added
function getHostName(strPath) { 
	var strLocation = "";

  	strLocation = "http://" + document.location.hostname.toLowerCase() + strPath;
	document.location = strLocation;
	return strLocation;
}

function getSecureHostName(strPath) { 
	var strLocation = "";

  	strLocation = "https://" + document.location.hostname.toLowerCase() + strPath;
	document.location = strLocation;
	return strLocation;
}

function enterSubmit(form, e) {
	var keycode;
	var returnCode = true;
	
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	if (form) {
		if(keycode==13) {
			if(loginValidateForm()) {
				form.submit();
			}
			returnCode = false;
		}
	}
	return returnCode;
}

function printPage() {
  if (window.print) {
	  setTimeout('window.print();',100);
	}
}
function form_submit(formName){
	var form = getObj(formName);
	if(form)form.submit();
}

function tabInit(mainCont, navCont, content, panelToShow)
{
    var c = document.getElementById(mainCont);
    var nav = document.getElementById(navCont);
    var content = document.getElementById(content);
    var panel = document.getElementById(panelToShow);
    
    for(i=0; i < content.childNodes.length; i++)
    {
        if(content.childNodes[i] == panel)
        {
            panel.style.display = '';
        }
        else
        {
            content.childNodes[i].style.display = 'none';
        }
    }   
}

function tabShow(element)
{  
	return;
    
    for(i = 0; i < navCont.childNodes.length; i++)
    {  
        if(navCont.childNodes[i].childNodes[0] == activeTab)
        {
            navCont.childNodes[i].childNodes[0].className = 'active';
        }
        else
        {
            navCont.childNodes[i].childNodes[0].className = null;
        }
    }
    
    for(i=0; i < content.childNodes.length; i++)
    {
        if(content.childNodes[i] == panel)
        {
            content.childNodes[i].style.display = '';
        }
        else
        {
            content.childNodes[i].style.display = 'none';
        }
    }
}
//END ADDED FOR BAMPI//




//ADDED BY JUSTIN SUMMERLIN FOR WEBTRENDS  ---- Function adds other functions to the body.onload event of every page that calls this function
function addLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') 
	{
		window.onload = func;
	} 
	else 
	{
		window.onload = function() 
		{
			oldonload();
			func();
		}
	}
}


//added by Justin S....
//Code to get the Tealeaf Session ID cookie
var z_tl_sessionid = get_cookie ( "TLTSID" );
//alert(readCookie("TLTSID"))

function get_cookie ( cookie_name )
{
	var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

	if ( results )
	{
		return ( unescape ( results[2] ) );
	}
	else
	{
		return "no_cookie";
	}
}

function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return c;
}

function trim(strText) 
{ 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}

