﻿<!-- 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()} }
}

//Progress bar displayed while uploading a file
function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.UploadForm.fileAttach.value != "")
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
      window.showModelessDialog('<% =barref%>&b=IE',null,winstyle);
    }
    else
    {
      window.open('<% =barref%>&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}

//Keeps count of how many characters are in a text area field, and prevents user from typing more than the maximum allowed.
//We use this to display an ongoing counter, so the user knows when they have reached the limit.
//From http://www.rosshawkins.net/archive/2006/12/04/asp.net-text-counter.html.aspx
function textCounter(field, countfield, maxlimit) 
{
if (field.value.length > maxlimit)
   field.value = field.value.substring(0, maxlimit);
else
   countfield.value = maxlimit - field.value.length;
}

//Functions for adding bookmarks to Social Networks
function AddToFacebook() {
	var window_handle = window.open('http://www.facebook.com/share.php?u='+encodeURIComponent(location.href)+'&amp;t='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToYahoo() {
	var window_handle = window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(document.title)+'&amp;d=&amp;tag=&amp;u='+encodeURIComponent(location.href),"AddTo",'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()} }
}
function AddToSpurl() {
	var window_handle = window.open('http://www.spurl.net/spurl.php?v=3&amp;tags=&amp;title='+encodeURIComponent(document.title)+'&amp;url='+encodeURIComponent(document.location.href),"AddTo",'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()} }
}
function AddToGoogle() {
	var window_handle = window.open('http://www.google.com/bookmarks/mark?op=add&amp;hl=en&amp;bkmk='+encodeURIComponent(location.href)+'&amp;annotation=&amp;labels=&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToBlinklist() {
	var window_handle = window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Tag=&amp;Url='+encodeURIComponent(location.href)+'&amp;Title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToBlogmarks() {
	var window_handle = window.open('http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url='+encodeURIComponent(location.href)+'&amp;content=&amp;public-tags=&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToTechnorati() {
	var window_handle = window.open('http://technorati.com/faves?add='+encodeURIComponent(location.href)+'&amp;tag=',"AddTo",'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()} }
}
function AddToBlinkbits() {
	var window_handle = window.open('http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;title='+encodeURIComponent(document.title)+'&amp;source_url='+encodeURIComponent(location.href)+'&amp;source_image_url=&amp;rss_feed_url=&amp;rss_feed_url=&amp;rss2member=&amp;body=',"AddTo",'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()} }
}
function AddToMagnolia() {
	var window_handle = window.open('http://ma.gnolia.com/bookmarklet/add?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)+'&amp;description=&amp;tags=',"AddTo",'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()} }
}
function AddToMisterWong() {
	var window_handle = window.open('http://www.mister-wong.com/index.php?action=addurl&amp;bm_url='+encodeURIComponent(location.href)+'&amp;bm_notice=&amp;bm_description='+encodeURIComponent(document.title)+'&amp;bm_tags=',"AddTo",'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()} }
}
function AddToDigg() {
	var window_handle = window.open('http://digg.com/submit?phase=2&amp;url='+encodeURIComponent(location.href)+'&amp;bodytext=&amp;tags=&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToDelicious() {
	var window_handle = window.open('http://del.icio.us/post?v=2&amp;url='+encodeURIComponent(location.href)+'&amp;notes=&amp;tags=&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToReddit() {
	var window_handle = window.open('http://reddit.com/submit?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToSimpy() {
	var window_handle = window.open('http://www.simpy.com/simpy/LinkAdd.do?title='+encodeURIComponent(document.title)+'&amp;tags=&amp;note=&amp;href='+encodeURIComponent(location.href),"AddTo",'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()} }
}
function AddToStumbleUpon() {
	var window_handle = window.open('http://www.stumbleupon.com/submit?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToSlashdot() {
	var window_handle = window.open('http://slashdot.org/bookmark.pl?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToNetscape() {
	var window_handle = window.open('http://www.netscape.com/submit/?U='+encodeURIComponent(location.href)+'&amp;T='+encodeURIComponent(document.title),"AddTo",'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()} }
}
function AddToFurl() {
	var window_handle = window.open('http://www.furl.net/storeIt.jsp?u='+encodeURIComponent(location.href)+'&amp;keywords=&amp;t='+encodeURIComponent(document.title),"AddTo",'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()} }
}

//Used by EO.Web AJAXUploader control to display an error if 
function AJAXUploadError(uploader, error, message)
{
    if (error == "max_size_exceeded")
       {
        //Size of the file trying to be uploaded exceeded MaxDataSize (cMaxUploadSize)
	    window.alert("The file you are trying to upload is larger than 10MB, which is too big. Please upload a smaller file.");
       }
    else if (error == "time_out")
       {
        //AJAXUploader failed to get a response from the server after the time out period.
	    window.alert("Timed out trying to upload your file. Please try again.");
       }
    else if (error == "aborted")
       {
        //Upload aborted by ASP.NET because it took longer than the web.config executionTimeout value
	    window.alert("Timed out trying to upload your file. Please make sure your file is not too large (less than 1MB) and try again.");
       }
    else
       {
        //Unknown error
	    window.alert("An error occurred while uploading your file: '" + error + "' [" + message + "]. Please try again. If the problem continues, please contact us at the email address listed on our Contact Us page.");
       }
}

// stop hiding -->
