// break out of frames

if (top.location != location)
    top.location.href = document.location.href 

var disappeardelay = 250;

var enableanchorlink = 1;

var hidemenu_onclick = 1;

var ie5 = document.all;
var ns6 = document.getElementById && !document.all;

function getposOffset(what, offsettype)
{
	var totaloffset = ( offsettype=="left" ) ? what.offsetLeft : what.offsetTop;

	var parentEl=what.offsetParent;

	while ( parentEl != null )
	{
		totaloffset = ( offsettype=="left" ) ? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}

	return totaloffset;
}

function showhide(obj, e, visible, hidden)
{
	if (ie5||ns6)
		dropmenuobj.style.left=dropmenuobj.style.top=-500

	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
		obj.visibility=visible
	else if (e.type=="click")
		obj.visibility=hidden
}

function iecompattest()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge)
{
	var edgeoffset=0;

	if (whichedge=="rightedge")
	{
		var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;

		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth

		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
	}
	else
	{
		var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset

		var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;

		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;

		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
		{ 
			//move up?
			edgeoffset = dropmenuobj.contentmeasure+obj.offsetHeight

			if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
				edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
		}
	
		edgeoffset = 0;
	}

	return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID)
{
	if ( typeof _textOnly != 'undefined' ) return false;

	if (window.event) 
		event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()

	if (typeof dropmenuobj!="undefined") //hide previous menu
		dropmenuobj.style.visibility="hidden"

	clearhidemenu()

	if (ie5||ns6)
	{
		obj.onmouseout=delayhidemenu
		dropmenuobj=document.getElementById(dropmenuID)
		if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
		dropmenuobj.onmouseover=clearhidemenu
		dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
		showhide(dropmenuobj.style, e, "visible", "hidden")
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px";
	}

	return clickreturnvalue()
}

function clickreturnvalue()
{
	if ((ie5||ns6) && !enableanchorlink) 
		return false
	else 
		return true
}

function contains_ns6(a, b) 
{
	while (b.parentNode)
	{
		if ((b = b.parentNode) == a)
			return true;
	}
	
	return false;
}

function dynamichide(e)
{
	if ( ie5&&!dropmenuobj.contains(e.toElement) )
		delayhidemenu();
	else if (ns6&&e.currentTarget!= e.relatedTarget && ! contains_ns6(e.currentTarget, e.relatedTarget))
		delayhidemenu();
}

function delayhidemenu()
{
	delayhide = setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay);
}

function clearhidemenu()
{
	if ( typeof delayhide != "undefined" )
	{
		clearTimeout(delayhide);
	}
}

function bosinverFlashEmbed( _playList, _shuffle )
{
	var shuffleEmbed = '';

		document.write('<object width="548" height="271" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="movie" value="assets/flash/imagerotator.swf" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><param name="flashvars" value="file='+_playList+'&amp;shownavigation=false&amp;linkfromdisplay=false&amp;transition=fade&amp;rotatetime=5&amp;shuffle='+_shuffle+'" /><embed src="assets/flash/imagerotator.swf" width="548" height="271" menu="false" quality="high" bgcolor="#FFFFFF" flashvars="file='+_playList+'&amp;shownavigation=false&amp;linkfromdisplay=false&amp;transition=fade&amp;rotatetime=7&amp;shuffle='+_shuffle+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}



function cornwallFlashEmbed( _playList, _shuffle )
{
        var shuffleEmbed = '';

                document.write('<object width="200" height="130" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="movie" value="assets/flash/imagerotator.swf" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><param name="flashvars" value="file='+_playList+'&amp;shownavigation=false&amp;linkfromdisplay=false&amp;transition=fade&amp;rotatetime=5&amp;shuffle='+_shuffle+'" /><embed src="assets/flash/imagerotator.swf" width="200" height="130" menu="false" quality="high" bgcolor="#FFFFFF" flashvars="file='+_playList+'&amp;shownavigation=false&amp;linkfromdisplay=false&amp;transition=fade&amp;rotatetime=7&amp;shuffle='+_shuffle+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

function launchTariff()
{
	window.open('booking/pricing-table.php','PricingTable','width=700,height=700,scrollbars=yes');
}

function launchAvailability()
{
	window.open('booking/availability-matrix.php','AVmatrix','width=700,height=500,scrollbars=yes');
}

function launchTerms()
{
		window.open('terms-and-conditions.php','Terms','width=500,height=500,scrollbars=yes');
}

function launchBookingCalendar( _unitId )
{
	window.open('booking/unit-calendar.php?unitId='+_unitId,'AvailabilityCalendar','width=380,height=520,scrollbars=no');	
}

function launchCancellationList()
{
	 window.open("/booking/cancellationList.php","CancellationList","width=380,height=520,scrollbars=no");
}

function launchBreakCalculator()
{
        window.open('/booking/shortBreakPriceCalculator.php','SBCalc','height=400,width=500,resizable=yes');
}

function createEditControls()
{
	/*
	if ( document.getElementById('contentRight') )
	document.getElementById('contentRight').innerHTML = '<small>Change text size</small> <p id="textSize" align="center"> <a href="setTextSize.php?size=14" id="sizeS" title="Small Text Size">A</a> <a href="setTextSize.php?size=18" id="sizeM" title="Medium Text Size">A</a> <a href="setTextSize.php?size=22" id="sizeL" title="Large Text Size">A</a> </p>' + document.getElementById('contentRight').innerHTML;
	*/
}




function hotkey(eventname)
{
	var isAltKeyPressed = false;

        if(eventname.keyCode == 18)
                isAltKeyPressed = true;

        if(eventname.keyCode == 81 && isAltKeyPressed)
        {
		window.location = 'about-bosinver.php';
        }
}



