// JavaScript Document

function init()
{
	var btns = document.getElementsByTagName("P");
	for( i=0; i<btns.length; i++ )
	{
		var btn = btns[i];
		if( btn.id && btn.id.indexOf("_btn")>-1 )
		{
			btn.onclick = function()
			{
				var type = this.id.split("_")[0];
				var box = document.getElementById(type+"_box");
				box.style.display = (box.style.display=="none") ? "inline" : "none";
			}
		}
	}
	
	var roomlinks = document.getElementsByTagName("LI");
	for( i=0;i<roomlinks.length;i++ )
	{
		var roomlink = roomlinks[i];
		if( roomlink.id && roomlink.id.indexOf("roomlink_")>-1 && roomlink.className != 'active' )
		{
			roomlink.onmouseover = function()
			{
				this.className = 'active';
				//this.style.border = '#F00 1px solid';
			}
			
			roomlink.onmouseout = function()
			{
				this.className = '';
			}
		}
	}
	
	/*var menubtns = document.getElementsByTagName("H3");
	for( i=0; i<menubtns.length; i++ )
	{
		var btn = menubtns[i];
		if( btn.id && btn.id.indexOf("submenu_")>-1 )
		{
			<!--btn.onmouseover = function()
			{	
				this.menuint = setTimeout(moveMenus,100000,this);
			}
			
			btn.onmouseout = function()
			{
				clearTimeout(this.menuint);
			}-->
		}
	}*/
	
	function moveMenus(btn)
	{
		if( btn.parentNode.className == 'inactive' )
		{
			for( j in menubtns )
			{
				if(menubtns[j].parentNode && menubtns[j].id)
				{
					if( btn == menubtns[j] )
					{
						btn.parentNode.className = 'active';
						var id = "menubtns_"+btn.id.split("_")[1];
						Effect.BlindDown(id,{ duration: .2 });
					}
					else
					{
						menubtns[j].parentNode.className = 'inactive';
						var id = "menubtns_"+menubtns[j].id.split("_")[1];
						Effect.BlindUp(id,{ duration: .2 });
					}
				}
			}
		}
	}
}

function css_validation()
{
	form = document.forms[0];
	var submit_it = true;
	for( i=0;i<form.length;i++ )
	{
		if( form[i].className && form[i].className.indexOf('REQUIRED') > -1 )
		{
			form[i].oldclass = form[i].parentNode.parentNode.className;
			if( form[i].value == '' )
			{
				form[i].parentNode.parentNode.className = form[i].oldclass+" formerror";
				submit_it = false;
			}
			else
			{
				form[i].parentNode.parentNode.className = form[i].oldclass;
			}
		}
	}
	if( !submit_it ) document.getElementById('errormsg').innerHTML = '<strong>Please review the highlighted fields and resubmit.</strong>';
	return submit_it;
}

window.onload = init;