/* * * * * * * * * * * * * * * * * * * * * * * 
 *	File: NewWindow.js
 *	Functions: NewWindow(); IEopenWin();
 *	Instructions: Call NewWindow with address of document as a string,  
 *	height and width of window as numeric values
 *
 * * * * * * * * * * * * * * * * * * * * * * */

// declare popup variable
var popup;

// function for dealing with IE4 on the Mac
function IEopenWin(address,height,width) {
	if (height != null) {
	popup = window.open(address, 'sized_popup_window','statusbar,resizable,scrollbars,HEIGHT=' + height + ',WIDTH=' + width);
	} else {
	popup = window.open(address,scrollbars,'popup_window');
	}
}

// function for opening the pop-up window
// pass the address of the document, height of the window, and width of the window 
function NewWindow(address,height,width) {
	// workaround for ie4 on PC´s!
	if (navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Macintosh") == -1 ) {
		if (popup != null) {
			popup.close();
			}
			if (height != null) {
				setTimeout("IEopenWin(\'" + address + "\'," + height + "," + width + ")", 100);
			} else {
				setTimeout("IEopenWin(\'" + address + "\')", 100);
			}
	} else {
	if (height != null) {
		popup = window.open(address, 'sized_popup_window','statusbar,resizable,scrollbars,HEIGHT=' + height + ',WIDTH=' + width);
	} else {
		popup = window.open(address,scrollbars, 'popup_window');
	}
	popup.focus();
	}
}

var gURL ;
function __EmbedHelpTag(xPic1,xPic2,xWidth,xHeight,xBorder,xParam, xsURL, xAltString, xfeature)
{
	var sWidth = ' ';
	var sHeight = ' ';
	var sBorder = ' ';
	gURL = xsURL+ "?" + xParam+"&WI_StartUrl="+escape(self.location.href);
	if(top.name==null || top.name=="")top.name="WIBrowserShare";
	gURL = gURL+"&WI_BrowserShareWindowName="+top.name;
	if(xWidth != 0 ) sWidth = ' WIDTH='+xWidth;
	if(xHeight != 0 ) sHeight = ' HEIGHT='+xHeight;
	if(xBorder != null ) sBorder = ' BORDER='+xBorder;
	self.document.write('<form onsubmit="displayHelpWindow(\'' + xfeature + '\');window.resizeTo ((screen.width * .60), (screen.height * .90));window.moveTo(0,0); return false;">');

	self.document.write('<input type="image" src="' + xPic1+'"'+sWidth+sHeight+sBorder+' alt="'+xAltString+'">');
	self.document.write('</form>'); 
}

	
function displayHelpWindow(xfeature)
{
    var win = window.open("","WebInteractionHelp",xfeature);
	if(win != null && win.bHelpInProgress != null ) return;
	win = window.open(gURL,"WebInteractionHelp",xfeature);
} 


function handleChatError() 
{
	return true;
}

	
function resizeWindow()
{
	window.resizeTo ((screen.width * .6), (screen.height * .90));
}

var gURL;
function displayHelpWindow1(servletURL)
{
		var dt = new Date();
		gURL= servletURL + "WI_DeviceType=Desktop&WI_TemplateName=/NEXTEL&WI_StartUrl="+escape(self.location.href)+"&WI_BrowserShareWindowName="+top.name

		if(self.WITranslatePort != null)gURL = gURL+"&WI_NewPortNumber="+self.WITranslatePort;
		if(self.WITranslateHostname != null)gURL = gURL+"&WI_NewHostname="+self.WITranslateHostname;
		if(self.WITranslateUrl != null)gURL = gURL+"&WI_TranslateUrl="+self.WITranslateUrl;
		gURL = gURL+"&WI_OriginalHost="+self.location.host;

		var Width = (screen.width * .4);
        var Height = (screen.height * .86);
        var winLeft = (screen.width  - Width)  / 1;
        var winTop  = 0;
        var feature = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + Width +",height=" + Height + ",top=" + winTop +',left='+ winLeft;  
	    var win = window.open("","WebInteractionHelp",feature);
		//below line of code used to handle error where you cannot access 

		//scripts across different domains
	    window.onerror = handleChatError;

	    //if(top.name==null || top.name=="")top.name="WIBrowserShare"+(new Date()).getTime();
	    if(win != null && win.bHelpInProgress != null ) return;
		win = window.open(gURL + "&t=" + dt.getTime(),"WebInteractionHelp",feature);
		win.focus();
} 
