﻿/**
 * NAME: spawn<qualifier>Window
 * INPUT: (_)url	- The url to include in the new window. Ex. 'helloworld.html'
 * PURPOSE:	Allow standard pop up windows
 * EXAMPLE: This anchor is an example of how to integrate this function.
 *   <a href="<href>" onclick="return spawn<qualifier>Window('helloworld.html')">Greeting</a>
 */
 
// 1/21/2005 - bahnck
function spawnDisclaimerWindow(destPage) {
  if (!(destPage)) { return false; }
  var newWin = window.open("/htdocs/legal/external_link_disclaimer.html" + "?dest=" + destPage, "discWindow");
}

function disclaimerProceed() {
  if (location.search != "?" && location.search != "") {
    location.href = location.search.substring(6);  
  }
  return false;
}

// 1/28/2005 - bahnck - modified 10/24/07 - jac
function spawnWindow(keyword, loc, destWin, loginBox) {
	var winName = (destWin) ? destWin : "BigWindow";
	var extWin;
	var winAttStr;
	var temp = keyword;
    if(loc == null) keyword="external";
	loc = loc ? loc : temp;
  switch (keyword) {
  		case "php":
  		case "full":
  		case "pdf":
  		case "external":
  		case "enrollform":
 		case "standard":
  		winAttStr = "width=800,height=600,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes";
  		break;
  		case "hf":
  		case "demo":
  		case "mediaBig":
  		winAttStr = "width=400,height=240,location=no,menubar=no";
  		break;
  		case "aol":
  		case "video":
  		case "definition":
  		case "mediaSmall":
  		winAttStr = "width=300,height=300,location=no,menubar=no";
  		break;
  		case "ebilling":
  		case "form":
		winAttStr = "width=530,height=400,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes";
		break;
		case "disclaimer":
	    return spawnDisclaimerWindow(loc);
		break;
		case "login":
		return spawnLoginWindow(loginBox);
		break;
		case "secure":
		case "flex":
		return	spawnSecureWindow(loc);
		break;
		case "secureBig":
		return	spawnSecureBigWindow(loc);
		break;
		default:
		  winAttStr = keyword;
	} // end switch
	
	extWin = window.open(loc, winName, winAttStr);
	return false;
	
} // end spawnWindow
/**
 * Added 10/15/2004 - bahnck
 * Rewrites ibxpress login page hostname based on current hostname. If on live
 * or unrecognized server, this opens the url passed unmodified.  
 */
function spawnLoginWindow(loginBox) {
  if (!loginBox) { return false; }
  
  // DEBUG: override hostname detection
  // loginServerCurr = "";
  
  if (typeof loginServerCurr != "undefined") {
    loginBox.action = loginServerCurr;
  }
  // loginBox.target = "_blank";

  return true;
} // end spawnLoginWindow 
 
/**
 * Added 10/01/2004 - bahnck
 * Rewrites form page hostname based on current hostname. If on live
 * or unrecognized server, this opens the url passed unmodified.  
 */

function spawnSecureWindow(url) {
  if (!url) { return false; }
  var modUrl = url;
  
  // DEBUG: override hostname detection
  // secureServerCurr = "";
  
  if (typeof secureServerCurr != "undefined") {
    modUrl = url.substr(0, url.indexOf(secureServerLive));
    modUrl += secureServerCurr;
    modUrl += url.substr(url.indexOf(secureServerLive) + secureServerLive.length);
  }
  
  var ExternalWindow = window.open(modUrl, "BigWindow", "width=600,height=400,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
  return false;
} // end spawnSecureWindow

function spawnSecureBigWindow(url) {
  if (!url) { return false; }
  var modUrl = url;
  
  // DEBUG: override hostname detection
  // secureServerCurr = "";
  
  if (typeof secureServerCurr != "undefined") {
    modUrl = url.substr(0, url.indexOf(secureServerLive));
    modUrl += secureServerCurr;
    modUrl += url.substr(url.indexOf(secureServerLive) + secureServerLive.length);
  }
  
  var ExternalWindow = window.open(modUrl, "BigWindow", "width=800,height=600,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
  return false;
} // end spawnSecureWindow


function spawnFlexPlanWindow(url) {
  if (!url) { return false; }
  var modUrl = url;
  
  // DEBUG: override hostname detection
  // secureServerCurr = "";
  
  if (typeof secureServerCurr != "undefined") {
    modUrl = url.substr(0, url.indexOf(secureServerLive));
    modUrl += secureServerCurr;
    modUrl += url.substr(url.indexOf(secureServerLive) + secureServerLive.length);
  }
  
  var ExternalWindow = window.open(modUrl, "FlexPlanWindow", "width=750,height=525,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
  return false;
} // end spawnFlexPlanWindow


function spawnPDFWindow(_url) {
	var ExternalWindow = window.open(_url, "BigWindow","width=500,height=450,location=no,scrollbars=yes,menubar=no");
	return false;
}

function spawnHelpWindow(_url) {
	_url = "../help/" + _url;
	var ExternalWindow = window.open(_url, "BigWindow","width=400,height=300,location=no,menubar=no");
}

function spawnExtWindow(url) {
	var ExternalWindow = window.open(url, "BigWindow","width=820,height=400,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
	return false;
}

function spawnFormAppWindow(url) {
	var ExternalWindow = window.open(url, "BigWindow","width=900,height=400,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
	return false;
}

function spawnDefinitionWindow(url) {
	var ExternalWindow = window.open(url, "BigWindow","width=350,height=300,location=yes,menubar=no,scrollbars=yes,toolbar=no,resizable=yes");
}

function spawnHFWindow(url) {
	var ExternalWindow = window.open(url, "BigWindow","width=394,height=350,menubar=no,scrollbars=yes,toolbar=no,resizable=yes");
}

function spawnAOLWindow(_url) {
	var ExternalWindow = window.open(_url, "BigWindow","width=255,height=155,location=no,menubar=no");
}

function spawnVideoWindow(_url) {
	var ExternalWindow = window.open(_url, "BigWindow","width=300,height=300,location=no,menubar=no");
	return false;
}

function spawnEBillingWindow(_url) {
	var ExternalWindow = window.open(_url, "EBilling","width=650,height=490,location=no,menubar=no,resizable=yes");
}

function spawnDemoWindow(_url) {
	var ExternalWindow = window.open(_url, "Demo","width=525,height=400,location=no,menubar=no,resizable=yes");
  return false;
}

function spawnPHPWindow(_url) {
	var ExternalWindow = window.open(_url, "BigWindow","width=675,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes, resizable=no");
}

function spawnFormWindow(url, windowName) {
	var ExternalWindow = window.open(url, windowName, "width=530,height=400,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
	return false;	
}

function spawn750_400Window(url, windowName) {
var ExternalWindow = window.open(url, windowName, "width=780,height=400,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
}

function spawnQuizResults() {
var ExternalWindow = window.open("", "QuizResults", "width=600,height=400,location=yes,menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes"); 
}

function closeWindow() {
self.close();
}

function newWindow(url,w,h)
	{
	var winProps = 'width=' + w + ',' + 'height=' + h + ',' + 'resizable=yes,scrollbars=yes';
	window.open(url, 'new', winProps);
	}

 function openInParent(sURL) {
 	window.opener.location.href = sURL;
 	self.close();
}

