function swapImage(name, ext) {
	document.images[name].src = 'images/menu_' + name + ext + '.gif';	
}


function IE6fix() {
	document.getElementById('backgroundShadow').style.height = document.documentElement.clientHeight + 'px';
	document.getElementById('pagePhotoArea').style.height = document.documentElement.clientHeight + 'px';	
	document.getElementById('pagePhotoArea').innerHTML = document.getElementById('pagePhotoArea').innerHTML;
	document.getElementById('main').style.height = document.documentElement.clientHeight + 'px';
	if (document.getElementById('contentArea')) {
		document.getElementById('contentArea').style.marginBottom = '150px';
	} else if (document.getElementById('photoArea')) {
		document.getElementById('photoArea').style.marginBottom = '300px';
	}
}

function SafariMacFix() {
	document.getElementById('pagePhotoArea').style.height = document.body.scrollHeight + 'px';
	document.getElementById('pagePhotoArea').innerHTML = document.getElementById('pagePhotoArea').innerHTML;
	if (document.getElementById('contentArea')) {
		document.getElementById('contentArea').style.marginBottom = '150px';
	} else if (document.getElementById('photoArea')) {
		document.getElementById('photoArea').style.marginBottom = '300px';
	}
}

function init() {
	var isGecko = (navigator.userAgent.indexOf('Gecko') != -1);
	var isSafari = (navigator.userAgent.indexOf('Safari') != -1);
	var isMac = (navigator.userAgent.indexOf('Mac') != -1);
	var isIE6 = (navigator.userAgent.indexOf('MSIE 6') != -1) ? true : false;
	
	if (isIE6) {
		IE6fix();
		if (document.getElementById('popup')) {
			document.getElementById('right').style.backgroundImage = 'url(images/popup_right.gif)';
			document.getElementById('left').style.backgroundImage = 'url(images/popup_left.gif)';
		}
		window.onresize = IE6fix;
	}

	var safariMac = (isSafari && isMac) ? true : false;
	if (safariMac) {
		SafariMacFix();
		window.onresize = SafariMacFix;
	}

}

function contactMe(a, b, c) {
	document.location.href = 'mailto:' + c + '@' + b + '.' + a;
}



/* basic email validation script. Courtesy of http://www.smartwebby.com/DHTML/email_validation.asp */
function emailCheck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }

	 return true					
}


