// JavaScript Document

// author: 16th-FLOOR 2009
// for: IBHuman

// parameters (for basic ajax section)
var hb_domain = 'http://ibhuman.16th-floor.nl/';	//set domain
var hb_loading_img = hb_domain + 'images/loading.gif';		//set image path
var hb_loading_msg = ' <strong>Loading Data...</strong>';//set loading message

// email asembly function. hides email from email harvesters.
// by: 16th-FLOOR
function hbMail(landdeel, domeindeel, naamdeel){
	if (landdeel != "" && domeindeel != "" && naamdeel != ""){
		document.write(naamdeel + String.fromCharCode(64) + domeindeel + '.' + landdeel);
	}
	else document.write("");
}

// son of suckerfish code needed for menu to work in IExplorer browsers. 
// original: http://htmldog.com/articles/suckerfish/dropdowns/
sfHover = function() {
	var sfEls = document.getElementById("hb_menu_nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


// very basic ajax
// based or original from;
// http://www.eire-webdesign.ie/blog/2007/10/15/ajax-load-content-from-another-file-without-browser-refresh-using-ajax/
var xmlhttp_obj = false;
function hb_xmlhttp(){
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
		xmlhttp_obj = new XMLHttpRequest();
	}else if (window.ActiveXObject){ // if IE
		try{
			xmlhttp_obj = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try{
				xmlhttp_obj = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){			
			}
		}
	}else{	
		xmlhttp_obj = false;
	}
	return xmlhttp_obj;
}
function hb_getcontent(url, containerid){
	var xmlhttp_obj = hb_xmlhttp();	
	document.getElementById(containerid).innerHTML = '<img src="' + hb_loading_img + '" />' + hb_loading_msg;
	xmlhttp_obj.onreadystatechange=function(){
		hb_loadpage(xmlhttp_obj, containerid);
	}
	xmlhttp_obj.open('GET', url, true);
	xmlhttp_obj.send(null);
}
function hb_loadpage(xmlhttp_obj, containerid){
	if ( xmlhttp_obj.readyState == 4 && xmlhttp_obj.status == 200 ){
		document.getElementById(containerid).innerHTML = xmlhttp_obj.responseText;
	}
}


// Unobtrusive JavaScript: Remove Unwanted Link Border Outlines
// original: http://www.mikesmullin.com/2006/06/16/removing-the-dotted-outline-from-focused-links
var runOnLoad = new Array();
window.onload = function() {
	for(var i = 0; i < runOnLoad.length; i++) runOnLoad[i]() 
}
if(document.getElementsByTagName)
for(var i in a = document.getElementsByTagName('a')) {
	a[i].onmousedown = function() { 
		this.blur();                 // most browsers 
		this.hideFocus = true;       // internet explorer
		this.style.outline = 'none'; // mozilla
	}   
	a[i].onmouseout = a[i].onmouseup = function() { 
		this.blur();                 // most browsers 
		this.hideFocus = false;      // internet explorer    
		this.style.outline = null;   // mozilla 
	}
}
