
function nospam(user,domain) {
	if (document.getElementById('mail')) {
		var link = document.getElementById('mail').firstChild;
		link.innerHTML = 'email@intraspin.com';
		link.href='mailto:email@intraspin.com';
	}
}
function validate() {
	var element = document.getElementById("question");
	if (element.value.indexOf("@") == -1) {
		alert("You do not appear to have provided an email address with your question - we will need this to reach you with an answer.");
		return false;
	}
	validate_human(element.parentNode.parentNode);
}

function validate_human(form) {
	var input = document.createElement('input');
		input.setAttribute('name', 'nospam');
		input.setAttribute('type', 'hidden');
		input.setAttribute('value', 'nospam');
	form.appendChild(input);
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}
function collectionToArray(col) {
	a = new Array();
	for (i = 0; i < col.length; i++)
		a[a.length] = col[i];
	return a;
}
	
prep = function() {
	// preload images
	nospam();
	var image = new Image();
	// set image url
	image_url = new Array();
	image_url[0] = "../images/n1hover.gif";
	image_url[1] = "../images/n2hover.gif";
	image_url[2] = "../images/tipbg.gif";
	for (var i=0; i<=3; i++) {
		image.src = image_url[i];
	}

	// make input / textarea effects
	var items = document.getElementsByTagName("INPUT");
	var	textareas = (document.getElementsByTagName("TEXTAREA"));
		items = collectionToArray(items).concat(collectionToArray(textareas));
	for (var i=0; i<items.length; i++) {
		items[i].onfocus = function() {
			this.style.borderColor = "#999999";
		}
		items[i].onblur = function() {
			this.style.borderColor = "#cccccc";
		}
	}
	// make web solutions effects
	var items = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<items.length; i++) {
		items[i].onmouseover = function() {
			this.firstChild.nextSibling.style.display = "block";
//			if (document.getElementsByTagName("BODY")[0].id != "home") {
//				setOpacity(document.getElementById("content"), 20);
//				var img = trdiv=document.createElement('img');
//					img.id = "cover";
//					img.src = "images/cover.png";
//					img.style.position = "absolute";
//					img.style.left = "260px";
//					img.style.top = "90px";
//					img.style.zIndex = "5";
//					var body = document.getElementsByTagName("BODY")[0];
//						body.appendChild(img);
//			}
		}
		items[i].onmouseout = function() {
			this.firstChild.nextSibling.style.display = "none";
//			setOpacity(document.getElementById("content"), 100);
//			var body = document.getElementsByTagName("BODY")[0];
//				body.removeChild(document.getElementById("cover"));
		}
	}

}
window.onload = prep;
//if (window.attachEvent) window.attachEvent("onload", prep);