function navChange(e)
{
	if (!e) var e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	if (e.target) var obj = e.target;
	else if (e.srcElement) var obj = e.srcElement;
	if (obj.nodeType == 3) obj = obj.parentNode;
	if (obj.filters && obj.filters.length > 0) {
		var baseSrc = obj.filters(0).src;
	} else {
		var baseSrc = obj.src;
	}
	if (e.type == 'mouseover') {
		var newSrc = baseSrc.replace(/_off\.png/, '_over.png');
	} else {
		var newSrc = baseSrc.replace(/_over\.png/, '_off.png');
	}
	if (obj.filters && obj.filters.length > 0) {
		obj.filters(0).src = newSrc;
	} else {
		obj.src = newSrc;
	}
}

function navPop(obj, type)
{
	var features = 'resizable=1,scrollbars=1,dependent=1,location=0,menubar=0,status=0,titlebar=1,toolbar=0';
	
	switch (type) {
		case ('site_info'):
			features += ',width=350,height=480';
			break;
		
		case ('download_media_kit'):
			features += ',width=350,height=480';
			break;
		
		case ('contact_us'):
			features += ',width=540,height=560';
			break;
		
		default:
			features += ',width=420,height=560';
			break;
	}
	
	window.open(obj.href, type + 'win', features);
	
	return false;
}

function showImage (img, width, height, captionText, link)
{
	var theImage = new Image();
	
	theImage.onload = function () {
		dimmer = document.getElementById('omDimmer');
		dimmer.style.display = 'block';
		
		popup = document.getElementById('omPopup');
		popup.style.display = 'block';
		
		image = document.getElementById('omPopupImage');
		image.style.width = width + 'px';
		image.style.height = height + 'px';
		image.src = img;
		
		text = document.getElementById('omPopupText');
		text.style.width = width + 'px';
		
		caption = document.getElementById('omPopupTextCaption');
		
		if (caption.hasChildNodes()) {
			caption.removeChild(caption.childNodes[0]);
		}
		
		if (captionText) {
			captionText = unescape(captionText);
		}
		
		if (link) {
			captionText += ' - <a href="' + unescape(link) + '">' + unescape(link) + '</a>';
		}
		
		caption.innerHTML = unescape(captionText);
		
		var h3 = caption.getElementsByTagName('h3');
		for (var i = 0; i < h3.length; i++) {
			h3[i].style.marginTop = '0px';
			h3[i].style.marginBottom = '2px';
			h3[i].style.fontSize = 'inherit';
		}
		
		var p = caption.getElementsByTagName('p');
		for (var i = 0; i < p.length; i++) {
			p[i].style.marginTop = '0px';
			if (i == (p.length - 1)) {
				p[i].style.marginBottom = '0px';
			} else {
				p[i].style.marginBottom = '8px';
			}
			p[i].style.fontSize = 'inherit';
		}
		
		theImage.onload = function () {}
		
		return false;
	}
	
	theImage.src = img;
	
	return true;
}

function removeImage ()
{
	dimmer = document.getElementById('omDimmer');
	dimmer.style.display = 'none';
	
	popup = document.getElementById('omPopup');
	popup.style.display = 'none';
	
	image = document.getElementById('omPopupImage');
	image.src = '';
	
	caption = document.getElementById('omPopupTextCaption');
	
	if (caption.hasChildNodes()) {
		caption.removeChild(caption.childNodes[0]);
	}
	
	return true;
}

function validateApplication()
{
	nTest = document.application.fullname.value;
	if (nTest) {
		eValue = document.application.email.value;
		eRegExp = /^[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+)*@(([a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*\.)*([a-zA-Z0-9](([a-zA-Z0-9\-]{1,62})?[a-zA-Z0-9])?\.){1}([a-zA-Z]{2,6})|\[(([01]?[0-9]{0,2}|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]{0,2}|2([0-4][0-9]|5[0-5]))\]|(([01]?[0-9]{0,2}|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]{0,2}|2([0-4][0-9]|5[0-5])))$/
		eTest = eRegExp.test(eValue);
		
		if (eTest) {
			return true;
		} else {
			alert('The email address "' + eValue + '" is invalid.\n\nPlease enter a complete and valid email address.');
			return false;
		}
	} else {
		alert('Please enter your full name.');
		return false;
	}
}
