// The 2 lines below were removed to avoid JS errors as we have temporarily removed the concierge menu from the PageBuilder.php page.
//window.onload = fSetConciergeMenuPosition;
//window.onresize = fSetConciergeMenuPosition;

function fSetConciergeMenuPosition()
{
	var vOffsetX = 221;
	var vOffsetY = 210;
	var vContentWidth = 824;
	var vContentHeight = 436;
	var vWinX;
	var vWinY;
	var vMenuX;
	
	if( navigator.appName.indexOf( 'Microsoft' ) == -1 )
	{
		vWinX = document.body.parentNode.clientWidth;
	}
	else
	{
		vWinX = fGetWindowWidth();
	}
	
	vWinY = fGetWindowHeight();
	//vWinY = document.body.parentNode.clientHeight;
	
	if( vWinX > vContentWidth )
	{
		vMenuX = vOffsetX + Math.floor( ( vWinX - vContentWidth ) / 2 );
		if( navigator.appName.indexOf( 'Microsoft' ) == -1 )
		{
			document.getElementById('menu').style.position = 'fixed';
		}
	}
	else
	{
		vMenuX = vOffsetX;
		document.getElementById('menu').style.position = 'absolute';
	}
	
	if( vWinY > ( vContentHeight + vOffsetY ) )
	{
		vMenuY = vContentHeight;
	}
	else
	{
		vMenuY = vWinY - vOffsetY;
	}
	
	document.getElementById('menu').style.left = vMenuX + 'px';
	document.getElementById('menu').style.top = vMenuY + 'px';
}

function fGetWindowWidth()
{
	var myWidth = 0;
	
	if( typeof( window.innerWidth ) == 'number' )
	{	//Non-IE
		myWidth = window.innerWidth;
	}
	else if( document.documentElement && document.documentElement.clientWidth )
	{	//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	}
	else if( document.body && document.body.clientWidth )
	{	//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	
	return myWidth;
}

function fGetWindowHeight()
{
	var myHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' )
	{	//Non-IE
		myHeight = window.innerHeight;
	}
	else 	if( document.documentElement && document.documentElement.clientHeight )
	{	//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && document.body.clientHeight )
	{	//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	
	return myHeight;
}

function fFixFlashBugInIE()
{
	objects = document.getElementsByTagName( 'object' );
	for ( var i = 0; i < objects.length; i++ )
	{
		objects[i].outerHTML = objects[i].outerHTML;
	}
}

function fWriteEmailLink( vName, vDomain, vExtension, vText )
{
	if( vText == '' )
	{
		vText = vName + '@' + vDomain + '.' + vExtension;
	}
	
	document.write( '<a href="mailto:' + vName + '@' + vDomain + '.' + vExtension + '">' + vText + '<\/a>' );
}

// Macromedia Functions
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
