<!--
  //Written by Steven E. Hopgood
  //Reference: Stupid Web Tricks
  //2002
 

  //declarations of the browser name and browser version
  browser_name = navigator.appName;
  browser_version = parseInt(navigator.appVersion);
  
  ////////////////////////////////////////////////////////////////////////////////////////
  //replacing all ;'s with a space
  var ua = window.navigator.userAgent;

  while (ua.indexOf(";") >= 0)
  {
     ua = ua.replace(";"," ");
  }
  
  //replacing all ('s with spaces for both MSIE and Netscape
  if (ua.indexOf("MSIE") >= 0) 
  {
    ua = ua.replace("("," ");
  }
  else
  {
    ua = ua.replace("[(]"," ");
  }
    
  //replacing all double spaces with one space
  if (ua.indexOf("  ") >= 0)
  {
    ua = ua.replace("  "," ");
  }
 
  //removing trailing space, if any
  if (ua.substring(ua.length - 1) == " ")
  {
    ua = ua.substring(0, ua.length - 1);
  }  
  /////////////////////////////////////////////////////////////////////////////////////// 
  //now our user agent should look similar to this Mozilla 4.0 compatible MSIE 4.0 Win95
  
  //converting the string to an array
  var binfo = new Array();
  binfo = ua.split(" ");
  
  if (browser_name == "Microsoft Internet Explorer")
  {

  //////////////////////////////////////////////////////////////////////////////////////
  //sets the version variable by reading through the array
  for (pos = 2;pos < binfo.length; pos++)
  {    
    if (binfo[pos] == "MSIE")
    {
      browser = binfo[pos];
      if (pos + 1 < binfo.length)
      {
        version = parseInt(binfo[pos+1]);
      }
    }    
  }
  //////////////////////////////////////////////////////////////////////////////////////
  
  //redirect css
  if (version <= 4)
  {
    document.write('<link href="/css/dreyfus_styles_2008.css" rel="stylesheet" type="text/css">');
  }
  else
  {
    document.write('<link href="/css/dreyfus_styles_2008.css" rel="stylesheet" type="text/css">');
  }
  ////////////////////////////////////////////////////////////////////////////////////////
  }
  //If it is not MSIE
  else if(browser_name == "Netscape")
  {
    version = parseFloat(navigator.appVersion);
    if (version >= 4.79)
    {
      document.write('<link href="/css/dreyfus_styles_2008.css" rel="stylesheet" type="text/css">');
    } 
    else
    {
      document.write('<link href="/css/dreyfus_styles_2008.css" rel="stylesheet" type="text/css">');
    }   
  }
  else
  {
  	document.write('<link href="/css/dreyfus_styles_2008.css" rel="stylesheet" type="text/css">');
  }

  function getHref(content) {
    var path_name = window.location.pathname;
    var sInd1 = "/content/";
    var sInd2 = "/control";

    var ind1 = path_name.indexOf(sInd1);
    var ind2 = path_name.indexOf(sInd2);
   
    var id = "";

    if (ind2 > ind1) {
        id = path_name.substring(ind1 + sInd1.length, ind2);
    }

    if (id == "hm") 
        id = "dr";

    if (id == "") {
        location.href="/content/dr/control?Content=" + content;
    } else {
        location.href="/content/" + id + "/control?Content=" + content;
    }
  }

  function ValSSN(ctl, num)
  {

        rTxt = "";
  
        var ssn = trim(ctl);

        if( ssn == "" )
        {
           rTxt = "Please enter Tax Identification Number";
        }
        else
        {
            if( !IsNumStr(ssn) )
                rTxt = "Invalid Tax Identification Number.";
            else if(ssn.length != num)
                rTxt = "Tax Identification Number must be " + num + " digits long.";
        }

        if (rTxt!="") {
          alert(rTxt);

          return false;
        }

        return true;
  }

  function IsNumStr(s)
  {
        return !s.match(/\D/);
  }

  function trim(value) {
      if (value == null) {
          return null;
      }
      var temp = value;
      var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
      if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
      return temp;
  }


function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie = name + "=" + escape(value) +
                      ((expires) ? "; expires=" + expires : "") +
                      ((path) ? "; path=" + path : "") +
                      ((domain) ? "; domain=" + domain : "") +
                      ((secure) ? "; secure" : "");
}

function getCookie(name)
{
    var cookie = " " + document.cookie;
    var search = " " + name + "=";
    var setStr = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0)
    {
        offset = cookie.indexOf(search);
        if (offset != -1)
        {
            offset += search.length;
            end = cookie.indexOf(";", offset)
            if (end == -1)
            {
                end = cookie.length;
            }
            setStr = unescape(cookie.substring(offset, end));
        }
    }
    return(setStr);
}

function openWinNoOptNoSize(url,name) {

    var tempwin=window.open(url,name,"width=300,height=300,left=-10000,right=-10000,toolbar=no,location=no,scrollbars=yes,resizable=yes");

    try
    {
       if (tempwin != null) {
           tempwin.moveTo(100,100);
           tempwin.focus();
       }
	}
    catch (e)
    {
    }
}

function acctWindow(url, name)
{
    var agent = navigator.userAgent.toLowerCase();
    var macosx = (agent.indexOf("mac os x") != -1);
    var aol = (agent.indexOf("aol") != -1);

    if (aol && macosx)
    {
        CDwindow = window.open(url,name,'height=480,width=600,menubar=YES,resizable,scrollbars,status');
    }
    else
    {
        CDwindow = window.open(url,name,'width=600,height=480,menubar=YES,toolbar=yes,scrollbars=yes,resizable=yes,status=yes');
    }

    try
    {
   	    if (CDwindow != null) {
            CDwindow.focus();
	    } else {
            return false;
	    }
	}
    catch (e)
    {   
		return false;
    }
}

function acctWindow700w(url, name)
{
    var agent = navigator.userAgent.toLowerCase();
    var macosx = (agent.indexOf("mac os x") != -1);
    var aol = (agent.indexOf("aol") != -1);

    if (aol && macosx)
    {
        CDwindow = window.open(url,name,'height=480,width=700,menubar=YES,resizable,scrollbars,status');
    }
    else
    {
        CDwindow = window.open(url,name,'width=700,height=480,menubar=YES,toolbar=yes,scrollbars=yes,resizable=yes,status=yes');
    }

    try
    {
   	    if (CDwindow != null) {
            CDwindow.focus();
	    } else {
            return false;
	    }
	}
    catch (e)
    {   
		return false;
    }
}

var holdingsWindow = null;

function acctWindowDailyHoldings(url)
{
    var name = "dailyholdings";
    var agent = navigator.userAgent.toLowerCase();
    var macosx = (agent.indexOf("mac os x") != -1);
    var aol = (agent.indexOf("aol") != -1);

    try {
        if (agent.indexOf("msie") > 0 ) {
            holdingsWindow = window.open("/content/docs/close_win.htm",name,'left=100000, top=100000, width=1,height=1,menubar=YES,toolbar=yes,scrollbars=yes,resizable=yes,status=yes');
            holdingsWindow.close();
            setTimeout("",25);
        } 
    } catch(e) {}

    if (aol && macosx)
    {
        holdingsWindow = window.open(url,name,'height=480,width=700,menubar=YES,resizable,scrollbars,status');
    }
    else
    {
        holdingsWindow = window.open(url,name,'width=700,height=480,menubar=YES,toolbar=yes,scrollbars=yes,resizable=yes,status=yes');
    }

    try {
        if (holdingsWindow != null) {
            holdingsWindow.focus();
        } 
    } catch (e) {}
}

function acctWindowPershing(url, name)
{
    var agent = navigator.userAgent.toLowerCase();
    var macosx = (agent.indexOf("mac os x") != -1);
    var aol = (agent.indexOf("aol") != -1);

    if (aol && macosx)
    {
        CDwindow = window.open(url,name,'height=480,width=755,menubar=YES,resizable,scrollbars,status');
    }
    else
    {
        CDwindow = window.open(url,name,'width=755,height=480,menubar=YES,toolbar=yes,scrollbars=yes,resizable=yes,status=yes');
    }

    try
    {
        if (CDwindow != null) {
            CDwindow.focus();
        } else {
            return false;
        }
    }
    catch (e)
    {
        return false;
    }
}

function extLinkWin(extUrl)
{
    var encUrl = escape(extUrl);

    var url = "/content/dr/control?Cmd=extLink&target=" + encUrl + "&Template=2";
    CDwindow = window.open(url, 'extWindow', 'width=480, height=350, menubar=no, toolbar=no, scrollbars=no, resizable=no, status=no');

    try
    {
   	if (CDwindow != null)
        {
            CDwindow.focus();
        }
        else
        {
            return false;
        }
    }
    catch (e)
    {   
        return false;
    }
}

//-->
