// © Distinctive Web Services


// Get the browser Type
var IE = document.all?true:false;
var browsertype = new String( navigator.appName );
var IE6 = false;

// Detect Netscape
if ( browsertype == "netscape" || browsertype == "Netscape" ) {
	var ns = true; var IE = false;
// IE and compatable browsers
} else {
	var ns = false; var IE = true;
}

// What version of IE?
if ( IE ) {
	if ( 
		navigator.appVersion.indexOf( "MSIE 1" ) > -1
		||
		navigator.appVersion.indexOf( "MSIE 2" ) > -1
		||
		navigator.appVersion.indexOf( "MSIE 3" ) > -1
		||
		navigator.appVersion.indexOf( "MSIE 4" ) > -1
		||
		navigator.appVersion.indexOf( "MSIE 5" ) > -1
	) {
		var IE6 = false;
	} else {
		var IE6 = true;
	}
}


// Make Netscape / Mozilla monitor the mouse events
if ( !IE ) { document.captureEvents( Event.MOUSEMOVE ); document.captureEvents( Event.RESIZE ); }


// RETURNS THE HEIGHT OF THE DOCUMENT
function docHeight () {
	if ( IE ) {
		if ( IE6 ) {
			return document.documentElement.clientHeight;
		} else {
			return document.body.clientHeight;
		}
	} else {
		return window.innerHeight;
	}
}


// RETURNS THE POSITION OF THE BOTTOM OF THE CONTENT
function contentHeight () {
	if ( IE ) {
		if ( IE6 ) {
			return document.documentElement.clientHeight;
		} else {
			return document.body.clientHeight;
		}
	} else {
		return window.innerHeight;
	}
}


// RETURNS THE HEIGHT OF A SPECIFIED DIV ELEMENT
function divHeight ( id ) {
	if ( IE ) 
		return parseInt( document.getElementById( id ).clientHeight );
	else 
		return parseInt( document.getElementById( id ).offsetHeight );
} 


// ON LOAD AND ON RESIZE THE SIZE OF THE CONTENT ELEMENT SHOULD BE CHECKED
window.onload = function () {
	resizeContainer(); 
} 
window.onresize = function () {
	resizeContainer(); 
} 


// RESIZE THE CONTAINER 
function resizeContainer () { 

	// Work out the min height of the content area
	var minHeight = divHeight( "content" ) + 160 + 3 + 3 + 3 + 50; 
	if ( minHeight < 500 ) minHeight = 575; 

	// If the Y viewable space of the window is greater then the height of the content then place the footer at window bottom
	// Otherwise place the footer at the bottom of the content
	if ( docHeight() > minHeight ) { 
		document.getElementById( "layout-footer" ).style.top = ( docHeight() - 85 ) + "px"; 
		document.getElementById( "container" ).style.height = ( docHeight() ) + "px"; 
	} else { 
		document.getElementById( "layout-footer" ).style.top = minHeight + "px"; 
		document.getElementById( "container" ).style.height = ( minHeight + 85 ) + "px"; 
	}

} 


// Open a new window and display the page in it.
function openWindow ( url, title, w, h, fullscreen ) {
	if ( fullscreen == "fullscreen" ) {
		// Get the browser type from the ASP variable
		// IE only supports "fullscreen" mode, if the browser is IE then execute this
		if ( !IE ) {
			var w = screen.availWidth - 10
			var h = screen.availHeight - 30
		}
		window.open( url, title, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + w + ",height=" + h + ",fullscreen=yes,left=0,top=0" )
	} else {
		window.open( url, title, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + w + ",height=" + h )
	}
}


// Swap images
function headerImageMouseOver(objId)
{
	// Reset images
	if (document.getElementById("hdr-img-training") != null) document.getElementById("hdr-img-training").src = "images/layout/header-b-train.jpg"; 
	if (document.getElementById("hdr-img-consulting") != null) document.getElementById("hdr-img-consulting").src = "images/layout/header-b-cons.jpg"; 
	if (document.getElementById("hdr-img-recruiting") != null) document.getElementById("hdr-img-recruiting").src = "images/layout/header-b-rec.jpg"; 
	if (document.getElementById("hdr-img-technical") != null) document.getElementById("hdr-img-technical").src = "images/layout/header-b-tech.jpg"; 
	if (document.getElementById("hdr-img-contact") != null) document.getElementById("hdr-img-contact").src = "images/layout/header-b-contact.jpg"; 
	if (document.getElementById("hdr-img-safe1") != null) document.getElementById("hdr-img-safe1").src = "images/layout/header-b-safe1.jpg"; 
	
	// Set image
	if (objId != null)
	{
		if (document.getElementById("hdr-img-training") != null && objId == "hdr-img-training") document.getElementById("hdr-img-training").src = "images/layout/header-b-train-o.jpg"; 
		if (document.getElementById("hdr-img-consulting") != null && objId == "hdr-img-consulting") document.getElementById("hdr-img-consulting").src = "images/layout/header-b-cons-o.jpg"; 
		if (document.getElementById("hdr-img-recruiting") != null && objId == "hdr-img-recruiting") document.getElementById("hdr-img-recruiting").src = "images/layout/header-b-rec-o.jpg"; 
		if (document.getElementById("hdr-img-technical") != null && objId == "hdr-img-technical") document.getElementById("hdr-img-technical").src = "images/layout/header-b-tech-o.jpg"; 
		if (document.getElementById("hdr-img-contact") != null && objId == "hdr-img-contact") document.getElementById("hdr-img-contact").src = "images/layout/header-b-contact-o.jpg"; 
		if (document.getElementById("hdr-img-safe1") != null && objId == "hdr-img-safe1") document.getElementById("hdr-img-safe1").src = "images/layout/header-b-safe1-o.jpg"; 
	}
}