/* *************************************************
*
*  © 2001 Etensity, Inc.
*	Popup Window code (in JavaScript)
*		basic open/close version
*
*	Updated:	May 7, 2001
*	By:		Creative Development (Vienna)
*
*************************************************** */

function popupFAQ(filename) {
	faq_window = window.open( filename, "faq_window", "left=110,top=90,width=375,height=380,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	faq_window.focus();
}

function popupFAQ2(filename) {
	faq_window = window.open( filename, "faq_window", "left=110,top=90,width=500,height=400,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	faq_window.focus();
}

function popupWizard(filename) {
	wizard_window = window.open( filename, "wizard_window", "left=120,top=100,width=700,height=700,resizable=0,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	wizard_window.focus();
}

function popupSample(filename) {

	sample_window = window.open( filename, "sample_window", "left=120,top=100,width=800,height=560,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	sample_window.focus();
}

function popupSample2(filename) {
	sample_window = window.open( filename, "sample_window", "left=120,top=100,width=600,height=560,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	sample_window.focus();
}
function popupPayflow(filename) {
	payflow_window = window.open( filename, "payflow_window", "left=120,top=100,width=775,height=500,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	payflow_window.focus();
}

function popupHelp(filename) {
	var browser = navigator.appName.substring(0,8);
	if (browser == "Netscape")
		help_window = window.open( filename, "help_window", "left=120,top=50,width=615,height=530,resizable=1,scrollbars=1,toolbar=1,status=1,location=1,directories=1,menubar=1");
	else 
		help_window = window.open( filename, "help_window", "left=120,top=50,width=615,height=675,resizable=1,scrollbars=1,toolbar=1,status=1,location=1,directories=1,menubar=1");
	
	help_window.focus();
}


function ClosePopup(filename) {
	// Close window from itself or opener

	if (!filename) {
		self.close();
	} else if (filename == "opener") {
		if (self.opener.open && !self.opener.closed) self.opener.close();
	} else {
		if (filename.lastIndexOf('_window') > 0) win = filename
			else win = getNameRoot(filename) + '_window';
		if (eval('window.' + win + ' && ' + win + '.open && !' + win + '.closed'))
			eval(win + '.close()');
	}
}

function NewPage(newURL) {
	// Changes main window to a new page and closes the popup
	self.opener.location.href = newURL;
	ClosePopup();
}

function popupTour(filename) {
	// Show Tour pages in a popup
	tour_window = window.open( filename, "tour_window", "left=120,top=100,width=570,height=330,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	tour_window.focus();
}

function popupTry(filename) {
// Show Try It pages in a popup
	try_window = window.open( filename, "try_window", "left=120,top=100,width=745,height=500,resizable=1,scrollbars=1,toolbar=1,status=0,location=0,directories=0,menubar=0");
	try_window.focus();
}	

function popupNameIt(filename) {
// Show Name It pages in a popup
	nameit_window = window.open( filename, "nameit_window", "left=120,top=100,width=400,height=300,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	nameit_window.focus();
}

function popupNameIt2(filename) {
// Show Name It pages in a popup
	nameit_window = window.open( filename, "nameit_window", "left=120,top=100,width=800,height=600,resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	nameit_window.focus();
}

function popupShowSaving(filename) {
// Show Name It pages in a popup
	nameit_window = window.open( filename, "show_window", "left=120,top=100,width=430,height=395,resizable=0,scrollbars=0,toolbar=0,status=0,location=0,directories=0,menubar=0");
	nameit_window.focus();
}

function popupNewWSM(filename) {
// Show new WSM 4.0 pages in a popup              
	wsm_window = window.open( filename, "wsm_window", "left=120,top=100,width=459,height=411,resizable=0,scrollbars=0,toolbar=0,status=0,location=0,directories=0,menubar=0");
	wsm_window.focus();
}

function popupVbizSample(filename) {
// Show vBiz sample pages in a popup with no address bar
	nameit_window = window.open( filename, "vbizsample_window", "width=765,height=600,menubar=no,resizable=no,scrollbars=yes,titlebar=no,toolbar=no");
	nameit_window.focus();
}
function FAQwin(url) {
var dirnum = url.indexOf("manage\-it");
var pagenum = url.indexOf("\.jhtml");
var pagename= "\/en_US\/faq\/manage-it\/FAQ-"+url.substring(dirnum+10, pagenum+6);
     var browser = navigator.appName.substring(0,8);
     if (browser == "Netscape")
     help_window = window.open( pagename, "help_window", "left=120,top=50,width=415,height=440,resizable=1,scrollbars=1,toolbar=0,status=1,location=1,directories=0,menubar=0");
     else
     help_window = window.open( pagename, "help_window", "left=120,top=50,width=415,height=440,resizable=1,scrollbars=1,toolbar=0,status=1,location=1,directories=0,menubar=0");

     help_window.focus();

 
}
function popUp(URL, type) 
{
   if (arguments.length == 2)
   {
      switch(type)
      {
 	case "fullscreen":
    	width = screen.availWidth - 40;
    	height = screen.availHeight - 40;
    	break;
  case "delete":  
	    width = 400;
	    height = 230;
	    break;	    

	 case "save":
	    width = 450;
	    height = 300;
	    break;	    

	 case "item":
	    width = 640;
	    height = 555;
	    break;	    

	 case "learnmore":
	    width = 325;
	    height = 340;
	    break;	
	    
	 case "supportcenter":
	    width = 672;
	    height = 586;
	    break;		    
	    
	 case "moreinfo":
	    width = 650;
	    height = 600;
	    break;	

	 case "block":
	    width = 640;
	    height = 600;
	    break;	    

	 case "template":
	    width = 750;
	    height = 575;
	    break;	
	 
	 case "banner":
	    width = 780;
	    height = 320;
	    break;	    

	 case "headline":
	    width = 720;
	    height = 370;
	    break;	    

	 case "intuithome":
	    width = 780;
	    height = 580;
	    break;	    

	 case "preview":
	    width = 780;
	    height = 580;
	    break;	    

            }
   }
   else
   {
      width = 550;
      height = 560;
      type = "generic";
   }


   var token = URL.indexOf('?') > -1 ? '&amp;' : '?';
   uniqueId = genUniqueId();
   URL=URL+genUniqueParam(token);

   var leftPosition  = (screen.width - width - 20) / 2;
   var topPosition = (screen.height - height) / 4;

if ((type == "supportcenter") || (type == "intuithome") || (type == "learnmore")) {
   eval("win = window.open(URL, '"+type+"', 'toolbar=0,scrollbars=1,location=0,status=0,resizable=1,menubar=0,width="+width+",height="+height+"');");
} else {
   eval("win = window.open(URL, '"+type+"', 'toolbar=0,scrollbars=1,location=0,status=0,resizable=1,menubar=0,width="+width+",height="+height+",left="+leftPosition+",top="+topPosition+"');");
}

   if (parseInt(navigator.appVersion) >= 4) 
   { 
      win.window.focus(); 
   }
}

// ----------------------
// Generate Unique Id
// ----------------------
function genUniqueId()
{
   day = new Date();
   return day.getTime();
}

// -------------------------------------------------
// Generate Unique parameter to be appended to the URL
// This will allow us to realod the HTML from the server
// -------------------------------------------------
function genUniqueParam(parameter)
{
   return parameter+'unique_id='+genUniqueId();
}

function connectToSF(nextURL)
{
    var sf_window = window.opener.top.top.opener;
    if (sf_window == null || sf_window == '' ||
        typeof sf_window == 'undefined' || sf_window.closed) 
    {
       sf_window = window.open(nextURL, "SF_WINDOW", 'toolbar=1,scrollbars=1,location=1,status=1,menubar=1');
    }
    else 
    {
       sf_window.location.href=nextURL;
    }
    sf_window.focus();
    self.close();
}

