// JavaScript Document

IE = navigator.appName=="Microsoft Internet Explorer"; 
NS = navigator.appName=="Netscape"; 
bVer = parseInt(navigator.appVersion); 

var newWin=null; 
//------------------------------------------------------------------------------------------------------------->>
// BEGIN popup DEFINITION ------------------------------------------------------------------------------------->>
function popup(loc, name, width, height) {

       var _params = "width="+width+",height="+height+",resizable=no,status=no"; 

       // CENTER ON BROWSERS WHICH SUPPORT JSCRIPT 1.2 
       if (bVer >= 4) { 
                _left = ( (screen.width-width) >>1 ); 
                _top = ( (screen.height-height) >>1 ); 
       } else { 
                _left = ( (2-width) >>1 ); 
                _top = ( (2-height) >>1 ); 
       } 

       if (IE) _params += ",top=" + _top + ",left=" + _left; 
       else if (NS) _params += ",screenX=" + _left + ",screenY=" + _top; 

       newWin = window.open(loc, name, _params); 
       if ( newWin!=null && !(IE && bVer<5) ) 
               newWin.focus(); // MSIE4 DOESN'T FOCUS WINDOWS 
}

// END popup DEFINITION --------------------------------------------------------------------------------------->>
//------------------------------------------------------------------------------------------------------------->>
// BEGIN adpopup DEFINITION ------------------------------------------------------------------------------------->>
function adpopup(loc, name, width, height) {

       var _params = "width="+width+",height="+height+",resizable=no,status=no"; 

       // CENTER ON BROWSERS WHICH SUPPORT JSCRIPT 1.2 
       if (bVer >= 4) { 
                _left = ( (screen.width-width) >>1 ); 
                _top = ( (screen.height-height) >>1 ); 
       } else { 
                _left = ( (2-width) >>1 ); 
                _top = ( (2-height) >>1 ); 
       } 

       if (IE) _params += ",top=" + _top + ",left=" + _left; 
       else if (NS) _params += ",screenX=" + _left + ",screenY=" + _top; 

       newWin = window.open(loc, name, _params); 
       if ( newWin!=null && !(IE && bVer<5) ) 
               newWin.focus(); // MSIE4 DOESN'T FOCUS WINDOWS 
}
// END adpopup DEFINITION --------------------------------------------------------------------------------------->>
//------------------------------------------------------------------------------------------------------------->>
// BEGIN openOutsideURL DEFINITION ---------------------------------------------------------------------------->>

function openOutsideURL(openThisURL,openThisType) {
   // see if the URL is a nintendo family
   // obtain just the first part of the url

   var urlRoot = "";  // a variable to hold just the www.wherever.com section of the URL

   if (openThisURL.indexOf("http://") == 0) {

      urlRoot = openThisURL.substr(7); // no second parameter means include the rest of the string

      // now trim off excess code

      if (urlRoot.indexOf("/") != -1) {

         urlRoot = urlRoot.substring(0,urlRoot.indexOf("/")); //

      }

   } else if (openThisURL.indexOf("/") != -1) {

      urlRoot = openThisURL.substring(0,openThisURL.indexOf("/"));

   }

//   if (nintendoFamilyURLs.indexOf(urlRoot) != -1) {

      // if it is, then just open up a new window

//       openFullChromeWindow(openThisURL, 'othersite');

//   } else {

     // if it is not, then popup the warning

      popup('/leaving.asp?link=' + openThisURL + '&type=' + openThisType,'small',400,320);

//   }

   return;

}


// END openOutsideURL DEFINITION ------------------------------------------------------------------------------>>
//------------------------------------------------------------------------------------------------------------->>


//////////////////////////////////////////////////////////////////////////////////
function we_popup(URL,width,height)
{
	if(!width)
	{	
		width=750;
		height=460;
	}

	thing = open(URL, 'we_popup_window', 'toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=' + width + ',height=' + height)
	thing.focus();
}



//------------------------------------------------------------------------------------------------------------->>
// BEGIN openSurvey DEFINITION ---------------------------------------------------------------------------->>

// Opens up the survey in a new window
function openSurvey() {
	var w, h, l, t;

	w = 800;
	h = 600;
	l = (window.screen.width/2) - (w/2);
	t = (window.screen.height/2) - (h/2);

	var win = window.open(
		'http://www.surveymonkey.com/s.aspx?sm=bhs20pa28%2baTAA5Zsg2TgQ%3d%3d',
		'_blank',
		'height='+h+',width='+w+',left='+l+',top='+t+',scrollbars=yes,resizable=yes,status=no,titlebar=no,location=no,directories=no,toolbar=no'
	);

	if ( win.closed ) {
		alert( "You've already taken the survey" );
	}
	else {
		win.focus();
	}

	return false;
}

// END openSurvey DEFINITION ------------------------------------------------------------------------------>>