/****************************************************************************
 <project>
 SunGardHE.AWA
 </project>
 <file>
 iFrameSupport.js
 </file>
 <summary>
 iFrame Support Functions used throughout AWA and AWC
 </summary>
 <company>
 Advancement Solutions, SunGard Higher Education.
 http://www.sungardhe.com
 </company>
 <copyright>
  
 Copyright (c) 2003-2007 
 All Rights Reserved.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 DEALINGS IN THE SOFTWARE.
 </copyright>
****************************************************************************/

/* 5/26/2005 MGW(BSR) - This routine will find the iFrame requested and return
						and display it, or it will request the creation of the 
						iFrame and display it. */

// 9/22/2006 Hamel - add parameters that take size, default size for old calls
function iFrameDisplay(iFrameId, destination, width, height){
	var refIFrame	= document.getElementById(iFrameId);
	if(refIFrame == null)
		refIFrame = addIFrame(iFrameId);
		
	if (typeof width == "undefined") {
	    width = 565;
	}
	if (typeof height == "undefined") {
	    height = 250;
	}
	refIFrame.style.display		= '';
	refIFrame.style.width		= width + "px";
	refIFrame.style.height		= height + "px";
	refIFrame.src				= destination;
}//END iFrameDisplay

function iFrameClose(iFrameRef){
	// Pass in the iFrame reference if the iFrame is not closing itself. The example of
	// the iFrame closing itself would be by using the close menu on the iFrame header)
	if(iFrameRef != null){
		iFrameRef.style.display = 'none';
		iFrameRef.src			= 'blank.html';
	}else{
		window.frameElement.style.display	= 'none';
		window.frameElement.src				= 'blank.html';
	}
}//END iFrameClose

/* 5/26/2005 MGW(BSR) - This routine will create a new iFrame, set it's defaults,
						add it to the current document, and return a reference to it. */
function addIFrame(iFrameId){

	var newIFrame				= document.createElement("iFrame");
	newIFrame.id				= iFrameId;
	newIFrame.style.display		= "none";
	newIFrame.style.zIndex		= 1001;
	// 5/16/2006 Williams - Changed the filter style from dropshadow to shadow to alleviate the
	//						offset events issues associated with Test Track defect #5173.
	newIFrame.style.filter		= "progid:DXImageTransform.Microsoft.shadow(color='black',direction=135)";
	newIFrame.style.left		= "5px";
	newIFrame.style.top			= "100px";
	newIFrame.style.position	= "absolute";
	newIFrame.scrolling			= "no";
	newIFrame.src				= "blank.html";
	// 9/29/2006 Williams - Add custom popupIFrame attribute so that we may determine a popupIFrame from the
	//                      iFrames that host the NavTree and the AWA Applications.
	newIFrame.setAttribute("popupIFrame", "true");
	document.body.appendChild(newIFrame);

	return newIFrame;
}//END addIFrame

/* 9/12/2005 MGW(BSR) - This routine will find the iFrame requested and return
						it, or it will request the creation of the 
						iFrame, but will not immediately display it in either instance. */ 
function iFrameCreateWithoutDisplay(iFrameId, destination){
    
	var refIFrame			= document.getElementById(iFrameId);
		
	if(refIFrame == null) {
		refIFrame			= addIFrame(iFrameId);
    }
	
	refIFrame.style.width	= "560px";
	refIFrame.style.height	= "250px";
	refIFrame.style.scrolling	= "no";
	refIFrame.src			= destination;
	
		
	return refIFrame;
}//END iFrameCreateWithoutDisplay

/* 09/20/2006 JP(SOS) - This routine will find the iFrame requested and return
						it, or it will request the creation of the 
						iFrame with Scroll = auto, but will not immediately display it in either instance. */ 


function addIFrame_Scroll(iFrameId){
	var newIFrame_Scroll				= document.createElement("iFrame");
	newIFrame_Scroll.id				= iFrameId;
	newIFrame_Scroll.style.display		= "none";
	newIFrame_Scroll.style.zIndex		= 1001;
	// 5/16/2006 Williams - Changed the filter style from dropshadow to shadow to alleviate the
	//						offset events issues associated with Test Track defect #5173.
	newIFrame_Scroll.style.filter		= "progid:DXImageTransform.Microsoft.shadow(color='black',direction=135)";
	newIFrame_Scroll.style.left		= "5px";
	newIFrame_Scroll.style.top			= "100px";
	newIFrame_Scroll.style.position	= "absolute";
	newIFrame_Scroll.scrolling			= "auto";
	newIFrame_Scroll.src				= "blank.html";
	// 9/29/2006 Williams - Add custom popupIFrame attribute so that we may determine a popupIFrame from the
	//                      iFrames that host the NavTree and the AWA Applications.
	newIFrame_Scroll.setAttribute("popupIFrame", "true");
	document.body.appendChild(newIFrame_Scroll);

	return newIFrame_Scroll;
}//END addIFrame

function iFrameCreateWithoutDisplay_Scroll(iFrameId, destination){
	var refIFrame_Scroll			= document.getElementById(iFrameId);
	
	//if(refIFrame_Scroll == null)
		refIFrame_Scroll			= addIFrame_Scroll(iFrameId);
		refIFrame_Scroll.style.width	= "550";
	    refIFrame_Scroll.style.height	= "250px";
		refIFrame_Scroll.src			= destination;
		
		
	return refIFrame_Scroll;
}//END iFrameCreateWithoutDisplay



/* 09/20/2006 HP(SOS) - This routine will find the iFrame requested and return
						it, or it will request the creation of the 
						iFrame with specified Width & Height, but will not immediately display it in either instance. */ 
function iFrameCreateWithoutDisplayWH(iFrameId, destination,width,height){
 
	var refIFrame			= document.getElementById(iFrameId);
	
	if(refIFrame == null)
		refIFrame			= addIFrame(iFrameId);
		
	refIFrame.style.width	= width;
	refIFrame.style.height	= height
	refIFrame.src			= destination;
	
	
	return refIFrame;
}//END iFrameCreateWithoutDisplayWH


/* 9/12/2005 MGW(BSR) - This function will display the iFrame in the passed in argument. */
function iFrameShow(iFrameRef){
   
    iFrameRef.style.display = '';
    
 
}//END iFrameShow
