﻿<!-- hide this script from non-javascript-enabled browsers
//*****************************************************************//
// Javascript window-opening routines, which use focus() to ensure //
// that the window comes back to the front if it is already open.  //
//*****************************************************************//

//Open all external links in a new window
//1. using the href value of the anchors, it finds the "external" links inside a given element ("mainbody" in this case). 
//2. it applies a style to the links (applies a class or appends a class name to an existing class attribute's value) 
//3. it attaches a title attribute to the links (or appends a string to the existing title attribute's value) 
//4. it applies the behavior to each one of these links (through the onclick event handler) 
//From http://www.tjkdesign.com/articles/popup_window_with_no_extra_markup.asp
function ExternalPop(){ 
  var e = document.getElementById('mainbody');
  if (e){
    var a=e.getElementsByTagName('a');
    for (var i=0;i<a.length;i++){
    if (a[i].getAttribute('href') != null && a[i].getAttribute('href').indexOf("://") >= 0 && a[i].getAttribute('href').toUpperCase().indexOf(document.domain.toUpperCase()) == -1){
        a[i].className+=a[i].className?' outlink':'outlink';
        a[i].title+=' (opens in new window)';
        a[i].onclick=function(){
            newWin=window.open(this.href,'ExtWin');
	        if (newWin != null) { if (window.focus) {newWin.focus()} }
            return false;
        }
//      a[i].onkeypress=function(){newWin=window.open(this.href,'ExtWin');if(window.focus){newWin.focus()} return false;}
      }
    }
  }
}

// Functions to handle lack of support for CSS "min-width" property by IE6
function RemoveUnits( txt )
{
    var temp = txt.replace(/px|cm|pt|em|en|auto/,'');

    return isNaN(temp) ? 0 : parseInt( temp );
}
function IE6MinWidth( el, size )
{
    var max = (this.IE6MaxWidth ? this.IE6MaxWidth : this.IE6MaxWidth = RemoveUnits(el.currentStyle.paddingLeft) + RemoveUnits(el.currentStyle.marginLeft) + RemoveUnits(el.currentStyle.borderLeftWidth) + size + 1);

    if (document.documentElement.clientWidth > max) 
    {
        return "auto";
    } 
    else 
    { 
        return size+"px";
    }
}

//Open the given web page in a (small) new window with limited controls
function OpenHelpWindow(urlPath) {
	var window_handle = window.open(urlPath,"Help",'top=0,left=0,height=200,width=500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (small) new window with limited controls, with contents dependent on given jurisdiction
function OpenCustomHelpWindow(urlPathname,urlExtension,MemberCountry,MemberStateProvince) {
	var strCountrySuffix = ""
	var urlPath = ""
	
	//Figure out proper country suffix
	switch (MemberCountry){
		case "Canada":			
		    if (MemberStateProvince == "Quebec")
                strCountrySuffix = ""
		    else
		        strCountrySuffix = "_can";
		    break;
		case "United Kingdom - England":    
		    strCountrySuffix = "_uk";
		    break;
		case "United Kingdom - Wales":      
		    strCountrySuffix = "_uk";
		    break;
		case "United States":	
		    if (MemberStateProvince == "Louisiana")
		        if (urlPathname.substr(0,6) == "mylivi")
		            strCountrySuffix = "_us"
		        else
		            strCountrySuffix = "";
		        else
		            strCountrySuffix = "_us";
		    break;
		default:				
		    strCountrySuffix = ""
	}
	
	//Construct a path that looks something like "mywill_partner_help_can.htm"
	urlPath = urlPathname + "_help" + strCountrySuffix + urlExtension

	var window_handle = window.open(urlPath,"Help",'top=0,left=0,height=200,width=500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (medium-sized) new window with limited controls
function OpenInfoWindow(urlPath) {
	var window_handle = window.open(urlPath,"Info",'top=0,left=0,height=440,width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (big) new window with limited controls
function OpenBigWindow(urlPath) {
	var window_handle = window.open(urlPath,"Pay",'top=0,left=0,height=400,width=640,status=no,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (bigger) new window with limited controls
function OpenBiggerWindow(urlPath) {
	var window_handle = window.open(urlPath,"Pay",'top=0,left=0,height=480,width=640,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a big) new window with full controls
function OpenPrintWindow(urlPath) {
	var window_handle = window.open(urlPath,"Printable",'top=0,left=0,height=440,width=640,status=no,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Close current window and open the given web page in a (big) new window with full controls
function ReopenPrintWindow(urlPath) {
	window.close();
	var window_handle = window.open(urlPath,"Printable",'top=0,left=0,height=440,width=640,status=no,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (big) new window with full controls
function OpenSubWindow(urlPath) {
	var window_handle = window.open(urlPath,"Sub",'top=0,left=0,height=400,width=640,status=no,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Close current window and open the given web page in a (big) new window with full controls
function ReopenBigSubWindow(urlPath) {
	window.close();
	var window_handle = window.open(urlPath,"BigSub",'top=0,left=0,height=480,width=640,status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (huge) new window with full controls
function OpenHugeWindow(urlPath) {
	var window_handle = window.open(urlPath,"Huge",'top=0,left=0,height=600,width=800,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (huge) new window with limited controls
function OpenPreviewWindow(urlPath) {
	var window_handle = window.open(urlPath,"Preview",'top=0,left=0,height=500,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (big) new window with full controls
function OpenNewWindow(urlPath) {
	var window_handle = window.open(urlPath,"Sub",'top=0,left=0,height=400,width=640,status=no,toolbar=no,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (huge) new window with no controls
function OpenSampleWindow(urlPath) {
	var window_handle = window.open(urlPath,"Sample",'top=0,left=0,height=600,width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (small) new pop-up window with limited controls
function OpenPopWindow(urlPath) {
	var window_handle = window.open(urlPath,"Pop",'top=80,left=40,height=400,width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

//Open the given web page in a (big) new window with limited controls
function OpenDemoWindow(urlPath) {
	var window_handle = window.open(urlPath,"Demo",'top=0,left=0,height=440,width=630,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes');
	if (window_handle != null) { if (window.focus) {window_handle.focus()} }
}

// stop hiding -->
