/*****************************************************************************
 * XPFunctions.js
 * A set of scripts that can be used to handle the new functionality 
 * that is bundled with XP (Especially SP2).
 * XP SP2 now has stricter rules on allowing popup windows, and also 
 * on the sizing of new windows.
 *
 * Part of DM035 change request
 ****************************************************************************/
 
var g_bIsXPSP2 = null;		//Flag used to show that IE is from XP SP2. WIll be null
							//until isXPSP2 is called. Should notbe used directly, 
							//XP SP2 checks should use the isXPSP2() function call.

/**
 * Function used to determine if the IE broswer is operating from XP SP2.
 * Returns true if XP SP2
 */
function isXPSP2()
{
	if( g_bIsXPSP2 == null){
	   g_bIsXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
	}
	return g_bIsXPSP2;
}

/**
 * Function to apply XP SP2 height adjustments.
 * Id the OS is not XP, then this will simply return 
 * the original value
 */
function applyXPPopupHeight(origHeight)
{
	var val = origHeight;
	if( isXPSP2() )
	{
		val += 30; //For the status bar
		val += 10;  //For the thickness of the borders
	}
	return val;
}

function applyXPIndicativePopupHeight(origHeight, xpVal)
{
	var val = origHeight;
	if( isXPSP2() )
	{
		val += xpVal; //For the status bar
		val += 10;  //For the thickness of the borders
	}
	return val;
}


/**
 * Function to apply XP SP2 Width adjustments.
 * Id the OS is not XP, then this will simply return 
 * the original value
 */
function applyXPPopupWidth(origWidth)
{
	var val = origWidth;
	if( isXPSP2() )
	{
		val += 4;  //For the thickness of the borders
	}
	return val;
}
 
function getCommandsWindowOpenAttributes(){
	var iHeight = 180;
	var iWidth = 400;
	iHeight = applyXPPopupHeight(iHeight);
	iWidth = applyXPPopupWidth(iWidth);
	var val = "dialogWidth:"+ iWidth +"px;dialogHeight:"+iHeight+"px;center:yes;scroll:no;help:no;status:no";
	return val;
}
