var Debug

//start home_popup section
function DisplayPopUp( ) {
  var PERCENT = 100;    // Set this to the Percentage of users to see PopUp
  var Height  = 475;   // Height and Width of popup window
  var Width   = 372;
//  var URL     = "http://public.wsj.com/nonsub-popup.htm"; // URL of new Window
  var URL     = "/home/nonsub-popup"; // URL of new Window
  var Debug   = 0;     // Set this to 1 to turn on Testing Mode (0 otherwise)

  var oneDay = 24 * 60 * 60 * 1000;  // (milliseconds)
  var oneMonth= oneDay * 30;

  var expDate = new Date( );
  expDate.setTime( expDate.getTime( ) + oneDay * 10 ); // Expires in Ten Days

  // ----- DO NOT MODIFY BELOW THIS LINE ------

  var agent = navigator.userAgent;
  if ( agent.indexOf( 'Mozilla' ) != -1 ) { // almost all browsers send this

    // only select users who haven't seen the popup recently.
    if ( ( ! HasLoginCookie() ) || Debug ) {
	    if ( ( ! HasSurveyCookie() ) || Debug ) {
	
	      // only select a percentage of those potential users.
	      var theDate = new Date( );
	      if ( ( theDate.getTime( ) % 100 ) < PERCENT ) {
	
	        // try to set the cookie.
	        document.cookie = 'survey=true; expires=' +
	                          expDate.toGMTString( ) + '; path=/';
	
	        // if they accepted the cookie; give them the popup!
	        if ( HasSurveyCookie( ) ) {
	          window.open( URL, 'SurveyPopUp',
	                       'toolbar=no,location=no,directories=no,' +
	                       'status=no,scrollbars=auto,menubar=no,' +
	                       'width=' + Width + ',height=' + Height);
	        }
	      }
	    }
	}    
  }
}

function getCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
      endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg)
                        return getCookieVal (j);
                i = document.cookie.indexOf(" ", i) + 1;
                        if (i == 0)
                                break;
                }
   return null;
}


function HasSurveyCookie( ) {
  var idx = parseInt( document.cookie.indexOf( 'survey' ) );
  return ( idx > -1 );
}

function HasLoginCookie( ) {
  var idx = parseInt( document.cookie.indexOf( 'WSJIE_LOGIN' ) );
  return ( idx > -1 );
}


function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString() + "; domain=.wsj.com";
}
// END home_popup section

//START lib_Hide_Module_Javascript section
			var selEdWindow;
		  	function hideConfirmation(category) {
				re = / /g;	
		     	category = category.replace(re,"+");
				var setURL = "/setup/hide_confirmation?category=" + category
				selEdWindow = window.open(setURL,'newwin','height=260,width=310,status=yes,menubar=no,scrollable=no,resizable=no,top=100,left=300')
  			}
//END lib_Hide_Module_Javascript section


function checkSymbol(){
	
	var form1=window.document.US_search;
	var form2=window.document.fund_search;
	var sym = form1['transform-value-quote-search'].value;
	var outString;
	var frontIndex = 0
	var backIndex = sym.length - 1;        
	
	while (sym.charAt( frontIndex ) == "" || sym.charAt( frontIndex ) == "\t" || sym.charAt( frontIndex ) == "\n" || sym.charAt( frontIndex ) == "\r")  
	{
		frontIndex++;
	}
	
	while (sym.charAt( backIndex ) == "" || sym.charAt( backIndex ) == "\t" || sym.charAt( backIndex ) == "\n" || sym.charAt( backIndex ) == "\r" )  
	{
		backIndex--;
	}
	
	sym = sym.substring( frontIndex, (backIndex + 1) );
	
// Catches user entry of all whitespace - All whitespace searches will cause company research page to display incorrectly

	if (backIndex < 0){
	alert ("Please enter a name or symbol.");
	return false;
	}
	
// Catches user entry of all Mutual Fund Symbols
	if ( (form1.elements["transform-name-quote-search"][0].checked) && (sym.length == 5) && (sym.charAt(4) == 'x' || sym.charAt(4) == 'X') && (sym.indexOf(" ") <0) && (sym.indexOf(".") <0)){
		form2.sym.value = sym;
		form2.submit();
	}
	
		
// Changes station based on radio button selected
	else if  (form1.elements["transform-name-quote-search"][0].checked) {
		form1.elements["route"].value="BOEH";
		form1.submit();
	}	
	
	
	else {
		form1.elements["route"].value="BOEH";
		form1.submit();
		
	}
		
}


<!-- Begin Generic Popup
function GenericPopUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1,width=820,height=500,left=10, right=10');");
}
// End -->



//start REUTERS link section
function NewWindow(mypage, myname, w, h, scroll) {
var winl = 100;
var wint = 100;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
win = window.open(mypage, myname, winprops);
win.window.focus();
}
//end REUTERS link section



	// Added by WFK, 04/23/2001
	// Personal Journal, Define the default field to receive focus on rendering
	function PJ_SetDefaultFocus () {
		// alert ('We are in PJ_SetDefaultFocus test value = ' + document.myForm.category.value);
		if (document.myForm != null) {
			if (document.myForm.category != null) {
				switch (document.myForm.category.value) {
					case "Columns":	{	document.myForm.companyList.selectedIndex = 0;
										document.myForm.companyList.focus();
										break;
									}
					case "Companies":	{	document.myForm.companyfund_1.selectedindex = 0;
											document.myForm.companyfund_1.focus();
											break;
										}
					case "Industries":	{	document.myForm.companyList.selectedIndex = 0;
											document.myForm.companyList.focus();
											break;
										}
					case "Layout":	{	document.myForm.myLayout.selectedIndex = 0;
										document.myForm.myLayout.focus();
										break;
									}
					case "Markets":	{	document.myForm.companyList.selectedIndex = 0;
										document.myForm.companyList.focus();
										break;
									}
					case "Topics":	{	document.myForm.companyList.selectedIndex = 0;
										document.myForm.companyList.focus();
										break;
									}
					default: break;
				}
			}
		}
	}
//END lib_Onload_Javascript section

//START lib_Dropdown_Nav_Javascript section
function update_frame(myoptions) 
{
destination=myoptions[myoptions.selectedIndex].value;
if(destination=="null")
{
return true;
}
window.open(destination, '_top');
myoptions.selectedIndex=0;
return true;
}
//END lib_Dropdown_Nav_Javascript section

fileNOTloaded = false;
