function viewportDimensions() {
	var viewportwidth;
	var viewportheight;
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth,
		viewportheight = window.innerHeight
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight;
	// older versions of IE
	} else {
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	return {width:parseInt(viewportWidth),height:parseInt(viewportHeight)};
}
function listPropertiesForm() {
	var errors = 0;
	var form = listPropForm[0].serialize(true);
	if (form.name == '' || form.email == '') {
		alert('Name and e-mail are required.');
		errors++;
	}
	if (errors == 0) {
		//alert('submitted');
		
		var position = $('signupform').cumulativeOffset();
		var height = parseInt($('signupform').getStyle('height'));
		var width = parseInt($('signupform').getStyle('width'));
		loading2({display:'',position:'absolute',top:(position.top+Math.floor(height/2))+'px',left:(position.left+Math.floor(width/2))+'px'});
		var params = listPropForm[0].serialize();
		$('signupform').innerHTML = '';
		new Ajax.Request('/wwwroot/m/michiganwaterfront/ajax/form_listproperties.cfm',{
			postBody:params,
			onSuccess:function() {
				setTimeout("loader2.setStyle({display:'none'});$('signupform').innerHTML='<div style=\"color:#4e6973;font-size:14px;font-weight:bold;text-align:center;margin-top:120px;line-height:145%;\">Thank you for<br>your submission.<br><br>A representative will be in contact with you soon.</div>';",1500);
			}
		});
	}
	//Thank you for your submission. A MichiganWaterfront.com representative will be in contact with you soon."
}
function myCustomEvent() {
	//alert('this is a custom function');
	var _splash = $('splash');
	var _page = $('page');
	_splash.setStyle({display:'none'});
	_page.setStyle({display:''});
	positionSearchWin();
}
function loading() {
	if (!$('loading')) {
		loader = $(document.createElement('div'));
		loader.setAttribute('id','loading');
		loader.setStyle({width:'153px',height:'53px',backgroundImage:'url(/wwwroot/m/michiganwaterfront/images/loading.png)',backgroundRepeat:'no-repeat',position:'relative'});
		document.body.appendChild(loader);
		loader.innerHTML = '<img src="/wwwroot/m/michiganwaterfront/images/loading.gif" style="position:absolute;left:10px;top:10px;">';
	}
	loader.setStyle({display:'',position:'absolute',top:'300px',left:'550px'}); 
}
function loading2(style) {
	if (!$('loading')) {
		loader2 = $(document.createElement('div'));
		loader2.setAttribute('id','loading2');
		loader2.setStyle({width:'170px',height:'53px',backgroundImage:'url(/wwwroot/m/michiganwaterfront/images/sending.png)',backgroundRepeat:'no-repeat',position:'relative',overflow:'hidden'});
		style.left = (parseInt(style.left)-(170/2))+'px';
		style.top = (parseInt(style.top)-50)+'px';
		document.body.appendChild(loader2);
		loader2.innerHTML = '<img src="/wwwroot/m/michiganwaterfront/images/loading.gif" style="position:absolute;left:10px;top:10px;">';
	}
	loader2.setStyle(style); 
}
function positionSearchWin() {
	// Variables
	var _splash = $('splash');
	var _page = $('page');
	var _searchwin = $('searchWin');
	var _searchwin_dimensions = {width:parseInt(_searchwin.getStyle('width')),height:parseInt(_searchwin.getStyle('height'))};
	//
	if (_splash.getStyle('display') == 'none') {
		var header = _page.select('.header')[0];
		var position = header.cumulativeOffset();
		var width = parseInt(header.getStyle('width'));
		var height = parseInt(header.getStyle('height'));
		$('pageinfo').setStyle({display:'none'});
		_searchwin.setStyle({left:(position.left+25)+'px',top:'100px',width:'800px',height:'1100px'});
	} else {
		var position = _splash.cumulativeOffset();
		var width = parseInt(_splash.getStyle('width'));
		var height = parseInt(_splash.getStyle('height'));

		_searchwin.setStyle({left:(position.left+width-_searchwin_dimensions.width-60)+'px',top:(height-position.top-10)+'px'});
	}
}