// JavaScript Document
// only apply the hack to files ending in ".png"
//IE7_PNG_SUFFIX = ".png";

function ppre_setup()
{
	attachRollover('book', 'templates/PPRE/layout_images/booknow_over.jpg');
	attachRollover('logo_image', 'templates/PPRE/layout_images/logo_over.jpg');
	if(document.getElementById('download'))
	{
		attachRollover('download', 'imglib/brochure_download_over.gif');
	}
	if(typeof sIFR == "function")
	{
		sIFR.bHideBrowserText = false;
		sIFR.bFixFragIdBug = false; // not recommended!
		sIFR.setup();
		sIFR.replaceElement("h1", named({sFlashSrc: "templates/PPRE/sIFR/gunny.swf", sWmode: "transparent", sColor: "#00645a"}));
	}
	//, sBgColor: "#ffeeee"
	setupMenu();
	
	// var frame = $$('.bookingFrame');
	
	// if( frame.length > 0 )
	// {
		// frame[0].observe( 'load', function( event ){
		
			// frame = event.currentTarget;
			// frame.height = frame.contentWindow.document.height;
		
		// });
	// }
}

addLoadEvent( ppre_setup );

function setupMenu()
{
	if($('menu'))
	{
		var menu		= $('menu').immediateDescendants();
		menu 			= menu[0];
		var menuitems 	= menu.immediateDescendants();

		for(i=0;i<menuitems.length;i++)
		{
			menuitems[i].onmouseover = function()
			{
				hideAll();
				var item = this.getElementsByTagName('ul');
				if(item.length > 0)
				{
					item = item[0];
					show(item);
					if(window[i+'interval'])
					{
						clearInterval(window[i+'interval']);
					}
				}
			}
			menuitems[i].onmouseout = function()
			{
				if(window[i+'interval'])
				{
					clearInterval(window[i+'interval']);
				}
				var item = this.getElementsByTagName('ul');
				if(item.length > 0)
				{
					item = item[0];
					window['item'+i] = item;
					window[i+'interval'] = setInterval('hide(window[\'item\'+i])', 500);
				}
			}
		}
	}
}
function show(b)
{
	b.style.display = 'block';
}
function hide(b)
{
	b.style.display = 'none';
}
function hideAll()
{
	if($('menu'))
	{
		var menu 	= $('menu').immediateDescendants();
		menu 		= menu[0];
		menuitems 	= menu.immediateDescendants();
		for(j=0;j<menuitems.length;j++)
		{
			r  = menuitems[j].getElementsByTagName('ul');
			if(r.length > 0)
			{
				r  = r[0];
				hide(r);
			}
		}
	}
}


