// Madgex Limited
// Copyright (c) 2004-2005 Madgex Limited. All Rights Reserved.
// Site Wide Functions
//-----------------------------------------------


// Illegal Character Strip Function
function _hbxStrip(a){
a = a.split("|").join("");a = a.split("&").join("");a = a.split("'").join("");a = a.split("#").join("");
a = a.split("$").join("");a = a.split("%").join("");a = a.split("^").join("");a = a.split("*").join("");
a = a.split(":").join("");a = a.split("!").join("");a = a.split("<").join("");a = a.split(">").join("");
a = a.split("~").join("");a = a.split(";").join("");a = a.split(",").join("");return a;}


// this "CSSClassRef" function has been copied in from menu.js (which is now no longer included). This function is needed
// however and so thats why i have pasted it in here.

function CSSClassRef(){
	if (is.gecko) sRef =  "class" ;
	if (is.ie5up) sRef = "className";
	return sRef;
}

function UserNameFocus(obj){
	if(obj.value == 'Username')
		obj.value = '';
	obj.style.color='#000';
}
function UserNameBlur(obj){
	if(obj.value == '')
		obj.value = 'Username';
	obj.style.color='#94988E';
}

function PasswordFocus(obj)
{
	HidePasswordLabel();
}
function PasswordBlur(obj)
{
	if( obj.value == '')
	{
		ShowPasswordLabel();
	}
}

function ShowPasswordLabel()
{
	if(document.getElementById)
	{
		var lb = document.getElementById( 'QuickPasswordLabel' );
		var p = document.getElementById( 'QuickPassword' );
		p.style.display = 'none';
		lb.style.display = 'block';
	}
}

function HidePasswordLabel()
{
	if(document.getElementById)
	{
		var lb = document.getElementById( 'QuickPasswordLabel' );
		var p = document.getElementById( 'QuickPassword' );
		lb.style.display = 'none';
		p.style.display = 'block';
		p.focus();
	}
}


//-----------------------------------------------

function JobOver(obj) {
    if (document.getElementById) {
        oTr = obj.parentNode;
        for (i = 0; i < oTr.childNodes.length; i++) {
            oNode = oTr.childNodes[i];
            if ( oNode.nodeType == 1 )
                oNode.setAttribute(CSSClassRef(), "JobTDOver");
        }
    }
}
 
function JobOut(obj) {
    if (document.getElementById) {
        oTr = obj.parentNode;
        for (i = 0; i < oTr.childNodes.length; i++) {
            oNode = oTr.childNodes[i];
            if ( oNode.nodeType == 1 )
              oNode.setAttribute(CSSClassRef(), "JobTDOut");
        }
    }
}

function JobDown(obj){
	if(document.getElementById){
		oTr = obj.parentNode
		oTd = oTr.childNodes[0];
		oA = oTd.childNodes[0];
		document.location.href = oA.getAttribute('href');
	}
}

//-----------------------------------------------

var is = new Is();

function Is () {
	var agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	this.nav2 = (this.nav && (this.major == 2));
	this.nav3 = (this.nav && (this.major == 3));
	this.nav4 = (this.nav && (this.major == 4));
	this.nav4up = (this.nav && (this.major >= 4));
	this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) ||(agt.indexOf("; nav") != -1)) );
	this.nav6 = (this.nav && (this.major == 5));
	this.nav6up = (this.nav && (this.major >= 5));
	this.gecko = (agt.indexOf('gecko') != -1);
	this.safari = (agt.indexOf('safari') != -1);
	this.camino = (agt.indexOf('camino') != -1);
    this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
    this.ie4up  = (this.ie  && (this.major >= 4));
    this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    this.ie5_5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
    this.ie5up  = (this.ie  && !this.ie3 && !this.ie4);
    this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
    this.ie6    = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
    this.ie6up  = (this.ie  && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
   	this.win = ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1));
    this.mac = (agt.indexOf("mac")!=-1);
}


// This may not work because of JS errors from advert code
//if((is.mac && is.ie)||(is.ie4) ||(is.nav4))
//{
//	document.location.href = "../staticpages/NonCSS2Browser.html";
//}

