function navHover(divid) {
	var left = divid+"left"; 
	var right = divid+"right";
	document.getElementById(left).style.background = "url(/pix/layout/background-navmainlink-divider-left-down.gif)";	
	document.getElementById(right).style.background = "url(/pix/layout/background-navmainlink-divider-right-down.gif)";	
}

function navOut(divid) {
	var left = divid+"left"; 
	var right = divid+"right";
	document.getElementById(left).style.background = "url(/pix/layout/background-navmainlink-divider-left.gif)";	
	document.getElementById(right).style.background = "url(/pix/layout/background-navmainlink-divider-right.gif)";	
}

function homeRoll(item) {
	clearHomeRolls();
	var id = "homerollbox"+item;
	document.getElementById(id).style.display = "block";
}

function homeRollOut() {
	clearHomeRolls();
}

function clearHomeRolls() {
	for (n=1; n <= 3; n++) {
		var id = "homerollbox"+n;
		document.getElementById(id).style.display = "none";
	}	
}

function ucfirst(str) {
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}

function filenameToTitle(str) {
	var title = "";
	var string = str.split("-");
	for (var i in string) {
		title = title + ucfirst(string[i]) + " ";
	}
	return title;
}

function sdmSetColor (td, colour) {
        if (document.getElementById) {
                cell = document.getElementById(td);
                link = cell.getElementsByTagName('a')[0];
                link.style.color = colour;
        }
}

function geoSwap(location,regions) {
	var content;
	document.getElementById('geomap').src = "/pix/geographic-reach/"+location+".gif";
	content	= "<h2>"+filenameToTitle(location)+"</h2><p>";
	content += regions[location];
	if (in_array(location, ['north-america', 'south-america'])) {
		document.getElementById('geomap2').style.left = "390px";
	} else {
		document.getElementById('geomap2').style.left = "15px";	
	}
	document.getElementById('geomap2').style.visibility = "visible";
	document.getElementById('geomap2').innerHTML = content;
}

function hideGeo() {
	document.getElementById('geomap2').style.visibility = "hidden";
	document.getElementById('geomap').src = "/pix/spacer.gif";
}

function in_array(needle, haystack, argStrict) {
    var found = false, key, strict = !!argStrict;
 
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }
 
    return found;
}


















function getHTTPObject() { 
	var xmlhttp; 
	/*@cc_on 
	@if (@_jscript_version >= 5) 
		try { 
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) { 
			try { 
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (E) { 
				xmlhttp = false; } 
		} @else xmlhttp = false; 
	@end @*/ 
	
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 
		try { 
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) { 
			xmlhttp = false; 
		} 
	} 
	return xmlhttp;
}

function preloadImages() {
	var pic = new Image(146,107);
	var images = new Array (
		"a-about-01.jpg",
		"a-about-02.jpg",
		"a-about-03.jpg",
		"a-advisoryservices-01.jpg",
		"a-advisoryservices-02.jpg",
		"a-advisoryservices-03.jpg",
		"a-corporateeducation-01.jpg",
		"a-corporateeducation-02.jpg",
		"a-corporateeducation-03.jpg",
		"a-home-01.jpg",
		"a-home-02.jpg",
		"a-home-03.jpg",
		"a-home-04.jpg",
		"a-workshops-01.jpg",
		"a-workshops-02.jpg",
		"a-workshops-03.jpg",
		"a-workshops-04.jpg"
	);
	var i = 0;
	var max = images.length - 1;
	for (i=0; i <= max; i++) {
		image = images[i];
		pic.src = "/pix/headerimages/" + image;	
	}
	return images;
}

function swapFeature1(x,imagearray) {
	var i = x;
	var images = imagearray;
	var max = images.length - 1;
	if (i >= max ) { i = 0 }
	var image1 = images[i];
	i++;

	document.getElementById('image1').src = '/pix/headerimages/' + image1;
	setTimeout('swapFeature1('+i+',images)',4000);
}

function swapFeature3(x,imagearray) {
	var i = x;
	var images = imagearray;
	var max = images.length - 1;
	if (i >= max ) { i = 0 }
	var image3 = images[i];
	i++;

	document.getElementById('image3').src = '/pix/headerimages/' + image3;
	setTimeout('swapFeature3('+i+',images)',4000);
}

function removeIEBorder() {
	var flashContainer = document.getElementById("FlashMovie");
	var flashMovie = document.createElement("div");
	flashMovie.innerHTML = decode(flashContainer.innerHTML);
	flashContainer.parentNode.insertBefore(flashMovie, flashContainer);
	function decode(input)
	{
	  var output = input;
	  output = output.replace(/</g, '<');   output = output.replace(/>/g, '>');
	  return output;
	}
}

function showFlash(movie,x,y) {
	if (navigator.appName == "Microsoft Internet Explorer") {
		document.write('<object id="flashdetect" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+x+'" height="'+y+'" align="">')
		document.write('<param name="movie" value="/inc/html/default/flash/'+movie+'" />')
		document.write('<param name="quality" value="high" />')
		document.write('<param name="bgcolor" value="#EBE9DC" />')
		document.write('<param name="wmode" value="transparent" />')
		document.write('</object>')
		if (null == document.flashdetect) {
			document.write('<img src="/inc/html/default/pix/back-index.jpg" alt="" border="0">')
		}
	}
	
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]){
		document.write('<embed src="/inc/html/default/flash/'+movie+'" wmode="transparent" quality="high" bgcolor="#FFFFFF" width="'+x+'" height="'+y+'" align="" swliveconnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>')
	} else {
		if (navigator.appName != "Microsoft Internet Explorer") {
			document.write('<img src="/inc/html/default/pix/back-index.jpg" alt="" border="0">')
		}
	}
}