<!--

function getDate(strDate) {
    var strDateReturn = '';
    if (strDate!='') {
    var month=new Array(12);
    month[0]="January";
    month[1]="February";
    month[2]="March";
    month[3]="April";
    month[4]="May";
    month[5]="June";
    month[6]="July";
    month[7]="August";
    month[8]="September";
    month[9]="October";
    month[10]="November";
    month[11]="December";
    
    //var strDate = '12-15-2007';
    var strDate = strDate;
    var my_array = strDate.split("-");
    var my_month = my_array[0];
    var my_day = my_array[1];
    var my_year = my_array[2];
    strDateReturn = month[my_month-1]+' '+my_day+', '+my_year
    }
    return strDateReturn;
}

function getQuarter(strDate) {
    var strDateReturn = '';
    var q = '';
    if (strDate!='') {
        var month=new Array(12);
        month[0]="January";
        month[1]="February";
        month[2]="March";
        month[3]="April";
        month[4]="May";
        month[5]="June";
        month[6]="July";
        month[7]="August";
        month[8]="September";
        month[9]="October";
        month[10]="November";
        month[11]="December";
        
        
        //var strDate = '12-15-2007';
        var strDate = strDate;
        var my_array = strDate.split("-");
        var my_month = my_array[0];
        var my_day = my_array[1];
        var my_year = my_array[2];
        //strDateReturn = month[my_month-1]+' '+my_day+', '+my_year
        
        q = ((my_array[0]-1) / 3) + 1 
        
        q = Math.floor(q);
    
        switch (q)
        {
        case 1:
          strDateReturn = 'First Quarter ' + my_year;
          break;
        case 2:
          strDateReturn = 'Second Quarter ' + my_year;
          break;
        case 3:
          strDateReturn = 'Third Quarter ' + my_year;
          break;
        case 4:
          strDateReturn = 'Fourth Quarter ' + my_year;
          break;
        }

    }
    
    return strDateReturn;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


 function buildSelect() {
    var d = new Date();
    var current_year = d.getFullYear();
    /* set choices 1 and 2 */
    document.form1.yrsdistributions.options[0] = new Option('Historical Distributions','');
    for( i = 0; i <= 20; i++ ) {
        calc_year = current_year - i;
        document.form1.yrsdistributions.options[i+1] = new Option(''+ calc_year + '',calc_year);
    }   
    return;
    /*
    option2 = new Option("2007",2007)
    option2 = new Option("2006",2006)
    option3 = new Option("2005",2005)
    option4 = new Option("2004",2004)
    // write them
    document.form1.yrsdistributions.options[0] = option0
    document.form1.yrsdistributions.options[1] = option1
    document.form1.yrsdistributions.options[2] = option2
    document.form1.yrsdistributions.options[3] = option3
    document.form1.yrsdistributions.options[4] = option4
    
    return;
    */
}
                
function gotoURL( intYear ) {
    if (intYear != null ) {
        window.location = '/Funds/Distributions/default.asp?intYear=' +  intYear;
    }
}

function displayrecent() {
    
    if (document.getElementById("recentdiv") != null) {
    
    if (document.getElementById("fundnews") != null) {
    document.getElementById("fundnews").innerHTML= document.getElementById("recentdiv").innerHTML;
    }
    
    }
}

function displaycomments() {
    
    if (document.getElementById("comments-icon") != null) {
        document.getElementById("comments-icon").style.visibility = 'visible';
    }
}

function setCookie(c_name,value,expiredays) {
    if (value == 'professional') {
        if(document.getElementById('fp-login-section')!=null) {
            toggleTabHome('content_1', 'tab2', '#B7D3E3');showtextLogin(document.getElementById('fp-login-section').innerHTML, 'content_1');        }
    }
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}


function checkCookieExist()
{
    individual=getCookie('individual');
    if (individual!=null && individual!="") {
          return true;
    } 
    else {
         return false;
    }
}

function del_cookie(name) {
    document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
    alert('cookie deleted');
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function checkCookie()
{
    roycecookie=getCookie('RoyceFunds');
    if (roycecookie!=null && roycecookie!="") {
          return true;
    } 
    else {
         return false;
    }
}

function popUp(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'toolbar=1,height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
    //alert(winprops);
    
    win = window.open(mypage, myname, winprops)
}

function popUpLayer(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'toolbar=0,height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
    win = window.open(mypage, myname, winprops);
}

function makemail(strLink) {
  /* edit the following for your case */
  //subject = "Check out this link: <a href='" + strLink + "'>" + strLink + "</a>";
  //body = "Check out this link: <a href='" + strLink + "'>" + strLink + "</a>";
  subject = "Check";

  /* build the address from the components */
  x = "mailto:?subject=" + subject;
  //x += ";body=" + body;

  return x;
}

//DHTML Window script- Copyright Dynamic Drive (http://www.dynamicdrive.com)
//For full source code, documentation, and terms of usage,
//Visit http://www.dynamicdrive.com/dynamicindex9/dhtmlwindow.htm

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="200px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+150+"px" : iecompattest().scrollTop*1+150+"px"
document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}

function getElementsAndReplace() {
  var str = '';
  var x=document.getElementsByName("idrecent");
  for (i=0;i<x.length;i++){
    str = x[i].href;
    str = str.replace("royce_web/", "");
    x[i].href = str;
  }
}

function onlineAccountSubmit( obj ) {
    var str_url = window.location;
    window.open('', 'accountonline', '');
    top.location = str_url;
    return false;
}

function gotourl(url) {
        parent.location.href = url;
    }


function popDisclaimer(param1) {
    var strtemp = window.location.pathname;
    var patt1 = new RegExp("printer");
    var patt2 = new RegExp("qdistnote.asp");
    var patt3 = new RegExp("qdist.asp");
    /*  do not display disclaimer for distributions articles and printer articles */
    if (patt1.test(strtemp) || patt2.test(strtemp) || patt3.test(strtemp)) {    }
    else {
        if (param1 != '') {
            if (getDaysDifference(param1) > 90) {
                toggleBox2('archivediv',1); 
                return false;
            }
        }
    }
}
                  
function getDaysDifference(in1) {
    var y = String(in1);
    var x = y.split('-'), yrCount = 0, mthCount = 0, dayCount = 0;
    
    var nowDate = new Date();
    var startDate = new Date(x[2],x[0]-1,x[1]);
    var one_day=1000*60*60*24;
    var num_days = Math.floor((nowDate.getTime()-startDate.getTime()+(nowDate.getTime()-nowDate.getTime()))/(one_day));
    return num_days;
}

/* GLOBAL JS VARIABLES */

var strd = '';
var strwidth = '';
var strheight = '';
var winpagename = '';


/* **********************/
function gotoProfile( intValue ) {
    if (intValue) {
        if (intValue == "open") {
            window.location = '/Funds/Open';
        }
        else if (intValue == "annuity") {
            window.location = '/Funds/Annuity';
        }
        else if (intValue == "closed") {
            window.location = '/Funds/Closed';
        }
        else {
            window.location = '/Funds/' + getPath(intValue) + '?fund_id=' + intValue;
        }
    }
}

function gotoview( intValue ) {
    if (intValue) {
        if (intValue == '1') {
            window.location = '/Funds/Open/category/';
        }
        if (intValue == '2') {
            window.location = '/Funds/Open/Name/';
        }
        if (intValue == '3') {
            window.location = '/Funds/Open/Symbol/';
        }
        
    }
}

/* FUND INFO PAGES: I WANT TO SECTION CHOOSING DIFFERENT FUND DROPDOWN MENU  */

function getPath( intValue ) {
    /*Open*/
    if (intValue == 1) {
        return "Open/pmf/";
    }
    else if (intValue == 586) {
        return "Open/ptr/";
    }
    else if (intValue == 11) {
        return "Open/roh/";
    }
    else if (intValue == 597) {
        return "Open/rap/";
    }
    else if ( intValue == 12 ) {
        return "Open/rdf/";
    }
    else if ( intValue == 16 ) {
        return "Open/rdv/";
    }
    else if ( intValue == 181 ) {
        return "Open/res/";
    }
    else if ( intValue == 562) {
        return "Open/ris/";
    }
    else if ( intValue == 18 ) {
        return "Open/rfs/";
    }
    else if ( intValue == 581 ) {
        return "Open/rfv/";
    }
    else if ( intValue == 7 ) {
        return "Open/rgs/";
    }
    else if ( intValue == 180 ) {
        return "Open/rgv/";
    }
    else if ( intValue == 4 ) {
        return "Open/rhf/";
    }
    else if ( intValue == 14 ) {
        return "Open/rlp/";
    }
    else if ( intValue == 13 ) {
        return "Open/rmc/";
    }
    else if ( intValue == 620 ) {
        return "Open/rmm/";
    }
    else if ( intValue == 2 ) {
        return "Open/rof/";
    }
    else if ( intValue == 639 ) {
        return "Open/ros/";
    }
    else if ( intValue == 8 ) {
        return "Open/rpr/";
    }
    else if ( intValue == 5 ) {
        return "Open/rs1/";
    }
    else if ( intValue == 6 ) {
        return "Open/rs2/";
    }
    else if ( intValue == 209 ) {
        return "Open/rss/";
    }
    else if ( intValue == 208 ) {
        return "Open/rsv/";
    }
    else if ( intValue == 3 ) {
        return "Open/rse/";
    }
    else if ( intValue == 17 ) {
        return "Open/rtv/";
    }
    else if ( intValue == 15 ) {
        return "Open/rtr/";
    }
    else if ( intValue == 9 ) {
        return "Open/rvv/";
    }
    else if ( intValue == 10 ) {
        return "Open/rvp/";
    }
    else if ( intValue == 645 ) {
        return "Open/rgd/";
    }
    else if ( intValue == 646 ) {
        return "Open/rip/";
    }
    else if ( intValue == 647 ) {
        return "Open/rmi/";
    }
    else if ( intValue == 648 ) {
        return "Open/rsm/";
    }
    /*Annuity*/
    else if ( intValue == 59 ) {
        return "Annuity/rcm/";
    }
    else if ( intValue == 58 ) {
        return "Annuity/rcs/";
    }
    /*Closed*/
    else if ( intValue == 21 ) {
        return "Closed/rft/";
    }
    else if ( intValue == 20 ) {
        return "Closed/rmt/";
    }
    else if ( intValue == 19 ) {
        return "Closed/rvt/";
    }
    
    
}

/* PEOPLE FUNCTIONS */

function getNickName( strName ) {
    switch ( strName ) {
        case 'Charles Dreifus':
            return 'Charlie Dreifus';
            break;
        case 'Charles Royce':
            return 'Chuck Royce';
            break;
        case 'James Harvey':
            return 'Jim Harvey';
            break;
        case 'James Skinner':
            return 'Chip Skinner';
            break;
        case 'Boniface Zaino':
            return 'Buzz Zaino';
            break;
        case 'Christopher Clark':
            return 'Chris Clark';
            break;
        case 'Edward Coyne':
            return 'Ed Coyne';
            break;
        case 'Robert Fahy':
            return 'Bob Fahy';
            break;
        case 'David Gruber':
            return 'Dave Gruber';
            break;
        case 'Michael Rosenthal':
            return 'Mike Rosenthal';
            break;
        case 'Kenneth Smolanoff':
            return 'Ken Smolanoff';
            break;
        case 'Nicholas Spiezo':
            return 'Nick Spiezo';
            break;
        default:
            return strName;
            break;
    }
}

function showRecentNews() {
    var intCounter = 1;
        for (i=1;i<=5;i++) {
            //alert(document.getElementById('recent' + i).href == window.location.href);
            if (document.getElementById('recent' + i).href == window.location.href) {
                document.getElementById('recent' + i).style.visibility='hidden';
                document.getElementById('recent' + i).style.display='none';
                document.getElementById('lirecent' + i).style.visibility='hidden';
                document.getElementById('lirecent' + i).style.display='none';
            } else {
                intCounter += 1;
            }
            if (intCounter == 6) {              
                document.getElementById('recent5').style.visibility='hidden';
                document.getElementById('recent5').style.display='none';
                document.getElementById('lirecent5').style.visibility='hidden';
                document.getElementById('lirecent5').style.display='none';
            }
            
            /*
            if (document.getElementById('recent' + i).href == window.location.href) {
                document.getElementById('recent5').style.visibility='hidden';
                document.getElementById('recent5').style.display='none';
                document.getElementById('lirecent5').style.visibility='hidden';
                document.getElementById('lirecent5').style.display='none';
            } else {
                intCounter += 1;
                if (intCounter != 6) {              
                    document.getElementById('recent' + i).style.visibility='visible';
                    document.getElementById('recent' + i).style.display='block';
                    document.getElementById('lirecent' + i).style.visibility='visible';
                    document.getElementById('lirecent' + i).style.display='block';
                }
            }*/
            
        }
}


    function checkLogin( form_name ){
        var strErrors = '';     
        var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
         if (document.advisorloginpage.EMailAddress.value.search(emailRegEx) == -1) {
              strErrors += 'Please enter a valid email address.\n';
         }
         if (document.advisorloginpage.Password.value == '') {
              strErrors += 'Please enter a password.\n';
         }
         if (strErrors != '') {
            alert(strErrors);
            return false;
         }
         else {
            document.advisorloginpage.submit();
         }
    }
    
    function checkRegister( form_name ){
        var strErrors = '';     
        var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
         if (document.advisor_registration.fname.value == '') {
              strErrors += 'Please enter your first name.\n';
         }
         if (document.advisor_registration.lname.value == '') {
              strErrors += 'Please enter your last name.\n';
         }
         if (document.advisor_registration.email.value.search(emailRegEx) == -1) {
              strErrors += 'Please enter a valid email address.\n';
         }
         
         if (strErrors != '') {
            alert(strErrors);
            return false;
         }
         else {
            ajaxFunction( 'ajaxvalue', document.advisor_registration.email.value, document.advisor_registration.fname.value, document.advisor_registration.lname.value );
         }
    }
    
    function forgotPasswordLink ( email ) {
        window.location = '/Advisors/AdvisorForgotPassword.asp?email=' + email ;
    }
    
    
    function ajaxFunction( update, email, fname, lname ) {  
        var xmlHTTP2;
        var url="checkContact.asp";
        if(email != '') {
            url=url+"?EmailAddress="+email;
        } 
        url=url+"&sid="+Math.random();
        //alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP2=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP2=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP2=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP2.onreadystatechange=function() {
            if(xmlHTTP2.readyState==4){
                //alert(document.getElementById('ajaxvalue').value);
                document.getElementById('ajaxvalue').value=xmlHTTP2.responseText;
                if (document.getElementById('ajaxvalue').value == '1') {
                    //document.getElementById('emailvalue').value = email;
                    //alert('exist');
                    sm2('box2',500,120);
                    
                    //alert('It appears that you are already registered with that email address. ');
                }
                else {
                    document.getElementById('emailvalue').value = email;
                    document.getElementById('fnamevalue').value = fname;
                    document.getElementById('lnamevalue').value = lname;
                    //alert('doesnt exist');
                    sm('box3',500,157);
                }
            }
          }
          xmlHTTP2.open("GET",url,true);
          xmlHTTP2.send(null);  
    }


    function checkProgessAjax(id) {
        var temp = document.getElementById(id);
        temp.style.visibility = 'visible';
        temp.style.display = 'block';
    }
    
    function hideProgessAjax(id) {
        var temp = document.getElementById(id);
        temp.style.visibility = 'hidden';
        temp.style.display = 'none';
    }

    function hideSection( id ) {
        var myTextField = document.getElementById(id);
        if (myTextField != null) {
            if(myTextField != "undefined"){
                myTextField.style.visibility = 'hidden';
                myTextField.style.display = 'none';
            }
        }
    }
    
    function showSection( id ) {
        
        var myTextField = document.getElementById( '' + id + '');
        
        if (myTextField != null) {
            if(myTextField != "undefined"){
                myTextField.style.visibility = 'visible';
                myTextField.style.display = 'block';
            }
        }
    }   

    function switchArrow(id,table) {
        temp = document.getElementById(id);
        if(temp.src.match("down")) {
            temp.src='/images/icons/up.gif';
            toggleDiv(table, false);
        }
        else {
            temp.src= '/images/icons/down.gif';
            toggleDiv(table, false);
        }
    }


    function goToPath (strPath) {
        if ( strPath != null ) {
            window.location = 'http://' + window.location.host  + strPath;
        }
    }
    
    function buildSelectDistributions() {
        var d = new Date();
        var current_year = d.getFullYear();
        var obj = document.getElementById("distribution-id")
        /* set choices 1 and 2 */
        obj.options[0] = new Option('Distributions & Capital Gains','');
        for( i = 0; i <= 20; i++ ) {
            calc_year = current_year - i;
            obj.options[i+1] = new Option(''+ calc_year + '',calc_year);
        }   
        return;
    }

    function isIE() {
        var browser=navigator.appName;
        if (browser=="Microsoft Internet Explorer"){
            return true;
        }
        else {
            return false;
        }
    }
    
    function openWindow(file,winname) {
        var width = 600;
        var height = 500;
        openDimWindow(file, width, height, winname);
    }
    
    function openDimWindow(file, width, height, winname) {
        if (!winname) winname = 'win1';
        dimension="toolbar=yes,status=no,location=no,scrollbars=yes,resizable=yes,width="+width+",height="+height; 
        window.open(file, winname, dimension);
    }
    
    function openChild(file,window) {
        childWindow=open(file,window,'toolbar=no,status=no,location=no,scrollbars=yes,resizable=yes,width=550,height=430');
        if (childWindow.opener == null) childWindow.opener = self;
    }
    
    function gotourltrack(pageType) {
        parent.location.href = 'default.asp?q=1&trkfunds=1&pricetype=' + pageType;
        document.getElementById('idprogresshome').style.visibility='visible';
        document.getElementById('idprogresshome').style.display='block';
    }
    
    function checkValueExist( id ) {
        var objElem = document.getElementById( id );
        if (objElem.value == 'Enter E-Mail') {
            objElem.value = '';
            objElem.style.color = '#000000';
        }
        
    }
    
    function checkValueOnBlur( id ) {
        var objElem = document.getElementById( id );
        if (objElem.value == '') {
            objElem.value = 'Enter E-Mail';
            objElem.style.color = '#868686';
        }
    }
    
        
    function togglesection ( id, bool ) {
        temp = document.getElementById(id).style;
        if (bool) {
            temp.visibility = 'visible';
            temp.display = 'block';
        } else {
            if (temp.visibility == 'visible') {
                temp.visibility = 'hidden';
                temp.display = 'none';
            }
            else {
                temp.visibility = 'visible';
                temp.display = 'block';
                temp.height = 'auto';
            }   
        }
        
    }
    
    function toggleradio ( id, bool ) {
        document.getElementById(id).checked = bool;
    }
    
    function togglespan ( id, bool ) {
        temp = document.getElementById(id);
        if (bool == 0) {
            temp.style.textDecoration = 'none';
            temp.style.color = '#676767';
            temp.style.cursor = 'none';
        }
        else {
            temp.style.textDecoration = 'underline';
            temp.style.color = '#2d699b';
            temp.style.cursor = 'pointer';
            temp.style.cursor = 'hand';
        }
        
    }

    function toggleTabHome(szDivID, tabID, istyle) // 1 visible, 0 hidden
    {

            var obj = document.getElementById(szDivID);
            var objtabl = document.getElementById(tabID);
            obj.style.backgroundColor = istyle;
            
            if(tabID=='tab2'){
                objtabl.style.color = '#1F3363';
                var objtabl2 = document.getElementById('tab1');
                objtabl2.style.color = '#5C73A4';
            }
            if(tabID=='tab1'){
                objtabl.style.color = '#1F3363';
                var objtabl2 = document.getElementById('tab2');
                objtabl2.style.color = '#5C73A4';
            }
            
            if(tabID=='tabcompare2'){
                objtabl.style.color = '#000000';
                var objtabl2 = document.getElementById('tabcompare1');
                objtabl2.style.color = '#868686';
            }
            if(tabID=='tabcompare1'){
                objtabl.style.color = '#000000';
                var objtabl2 = document.getElementById('tabcompare2');
                objtabl2.style.color = '#868686';
            }
            
    }
    
    function checkShareType( id_div ) {
        var objelem = document.getElementById(''+ id_div + '');
        //alert(objelem.value);
    }
    
    function setShareValueType ( id_div, intValue ) {
        var objelem = document.getElementById(''+ id_div + '');
        objelem.value = intValue;
        //alert(objelem.value);
    }
    
    function unsetShareValueType ( id_div ) {
        var objelem = document.getElementById(''+ id_div + '');
        objelem.value = '';
        //alert(objelem.value);
    }
    
    function get_url_parse(name){
        name = name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"); 
        var regex = new RegExp("[\?&]"+name+"=([^&#]*)"); 
        var results = regex.exec(window.location.href); 
        return results == null ? "" : results[1];
    }
    
    function displayNewsCommentary () {
        var objsource = document.getElementById('newscomment-info');
        var objdest = document.getElementById('newscommentid');
        if (objsource != null) {
            objdest.innerHTML = objsource.innerHTML;
        }
    }

function display_div( id_source, id_dest  ) {
        
        if (document.getElementById(id_source) != null) {
            //document.getElementById(id_dest).innerHTML= document.getElementById(id_source).innerHTML.replace('<p>','').replace('</p>','');
            
            var strHTML = replaceAll(document.getElementById(id_source).innerHTML,"<p>","");
            strHTML = replaceAll(strHTML,"</p>","");
            document.getElementById(id_dest).innerHTML = strHTML;
            
        }
    }
    
    function document_write( id_source  ) {
        //alert(document.getElementById(id_source).innerHTML.replace('<p>','').replace('</p>','').replace('<p>&nbsp;</p>',''));
        //document.write(document.getElementById(id_source).innerHTML.replace('<p>&nbsp;</p>',''));
        //alert(document.getElementById(id_source).innerHTML.replace('<p>','').replace('</p>',''));
        //document.write(stripHTML(document.getElementById(id_source).innerHTML.replace(/(<([^>]+)>)/ig,"")));
        if(document.getElementById(id_source) != null) {
            var strHTML = replaceAll(document.getElementById(id_source).innerHTML,"<p>","");
            //if (id_source == 'id-bench') {
            //  alert(strHTML); 
            //}
            strHTML = replaceAll(strHTML,"</p>","");
            strHTML = replaceAll(strHTML,"<P>","");
            strHTML = replaceAll(strHTML,"</P>","");
            document.write(strHTML);
        }
    }
    
     function replaceAll( str, from, to ) {
        var idx = str.indexOf( from );
    
    
        while ( idx > -1 ) {
            str = str.replace( from, to ); 
            idx = str.indexOf( from );
        }
    
        return str;
    }

    function addCommas(nStr){
         nStr += '';
         x = nStr.split('.');
         x1 = x[0];
         x2 = x.length > 1 ? '.' + x[1] : '';
         var rgx = /(\d+)(\d{3})/;
         while (rgx.test(x1)) {
          x1 = x1.replace(rgx, '$1' + ',' + '$2');
         }
         return x1 + x2;
    }


    /* Functions for Force Download Impact */
    function ajaxFunctionImpact(  email, pass, fundid ) {   
        var xmlHTTP3;
        var url="/Advisors/checkContactImpact.asp";
        if(email != '') {
            url=url+"?emailimpact="+email;
            url=url+"&passimpact="+pass;
            url=url+"&fundid="+fundid;
        } 
        url=url+"&sid="+Math.random();
        //alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP3=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP3=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP3=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP3.onreadystatechange=function() {
            if(xmlHTTP3.readyState==4){
                gpflid = xmlHTTP3.responseText;
                if( gpflid != ''){
                    
                    /* GOING TO TRY TO FORCE DOWNLOAD THE PDF FILE */
                    ajaxDownloadImpactDL(gpflid); 
                    /* ********************************* */
                }
                else {
                    alert('No Impact and Attribution Available Report for this fund.');
                }
            }
          }
          xmlHTTP3.open("GET",url,true);
          xmlHTTP3.send(null);  
    }
 
    function ajaxFunctionImpact2(  email, pass, fundid ) {  
        var xmlHTTP3;
        var url="/Advisors/checkContactImpact.asp";
        if(email != '') {
            url=url+"?emailimpact="+email;
            url=url+"&passimpact="+pass;
            url=url+"&fundid="+fundid;
        } 
        url=url+"&sid="+Math.random();
        //alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP3=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP3=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP3=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP3.onreadystatechange=function() {
            if(xmlHTTP3.readyState==4){
                gpflid = xmlHTTP3.responseText;
                if( gpflid != ''){
                    
                    /* GOING TO TRY TO FORCE DOWNLOAD THE PDF FILE */
                    ajaxDownloadImpactDL2(gpflid); 
                    /* ********************************* */
                }
                else {
                    alert('No Impact and Attribution Available Report for this fund.');
                }
            }
          }
          xmlHTTP3.open("GET",url,true);
          xmlHTTP3.send(null);  
    }
      
      
    var url = location.href;
      
    function ajaxDownloadImpactDL(  gpflid ) {  
        var xmlHTTP5;
        var url="/Advisors/impact/DLIMPACT.asp";
        url=url+"?GPFLID="+gpflid;
        url=url+"&sid="+Math.random();
        //alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP5=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP5=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP5=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP5.onreadystatechange=function() {
            if(xmlHTTP5.readyState==4){
                
                if(gup('fund_id')!=''){
                    
                    window.location = url.substring(0,url.indexOf("?")) + '?fund_id=' + gup('fund_id') + '&filename=' + xmlHTTP5.responseText;
                }
                else {
                    window.location = url.substring(0,url.indexOf("?")) + '?filename=' + xmlHTTP5.responseText;
                }
                //alert(top.location.href);
                
                /*
                if(top.location.href.indexOf("?")>0){
                    
                    if(top.location.href.indexOf("&")>0){
                        
                        window.location = top.location.href + 'filename=' + xmlHTTP5.responseText;
                    }
                    else {
                        
                        window.location = top.location.href + '&filename=' + xmlHTTP5.responseText;
                    }
                }
                else {
                    
                     window.location = top.location.href + '?filename=' + xmlHTTP5.responseText;
                }
                */
                toggleBox('overdivimpact',0); 
                return false;
            }
          }
          xmlHTTP5.open("GET",url,true);
          xmlHTTP5.send(null);  
    }
    
    function ajaxDownloadImpactDL2(  gpflid ) { 
        var xmlHTTP5;
        var url="/Advisors/impact/DLIMPACT.asp";
        url=url+"?GPFLID="+gpflid;
        url=url+"&sid="+Math.random();
        //alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP5=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP5=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP5=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP5.onreadystatechange=function() {
            if(xmlHTTP5.readyState==4){
                
                if(gup('fund_id')!=''){
                    
                    window.location = url.substring(0,url.indexOf("?")) + '?fund_id=' + gup('fund_id') + '&filename=' + xmlHTTP5.responseText;
                }
                else {
                    window.location = url.substring(0,url.indexOf("?")) + '?filename=' + xmlHTTP5.responseText;
                }
                
                toggleBox2('archivediv1',0); 
                return false;
            }
          }
          xmlHTTP5.open("GET",url,true);
          xmlHTTP5.send(null);  
    }
    
       function ajaxDownloadImpactDL3(  gpflid ) {  
        var xmlHTTP5;
        var url="/Advisors/impact/DLIMPACT.asp";
        url=url+"?GPFLID="+gpflid;
        url=url+"&sid="+Math.random();
        //alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP5=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP5=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP5=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP5.onreadystatechange=function() {
            if(xmlHTTP5.readyState==4){
                
                if(gup('fund_id')!=''){
                    
                    window.location = url.substring(0,url.indexOf("?")) + '?fund_id=' + gup('fund_id') + '&filename=' + xmlHTTP5.responseText;
                }
                else {
                    window.location = url.substring(0,url.indexOf("?")) + '?filename=' + xmlHTTP5.responseText;
                }
                
                toggleBox2('archivediv1',0); 
                return false;
            }
          }
          xmlHTTP5.open("GET",url,true);
          xmlHTTP5.send(null);  
    }
    
    function ajaxDownloadImpact(  gpflid ) {    
        var xmlHTTP4;
        var url="/Advisors/impact/DL.asp";
        url=url+"?GPFLID="+gpflid;
        url=url+"&sid="+Math.random();
        alert(url);
        try {  // Firefox, Opera 8.0+, Safari  
          xmlHTTP4=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
          try {    xmlHTTP4=new ActiveXObject("Msxml2.XMLHTTP");    }
          catch (e) {    
            try {  xmlHTTP4=new ActiveXObject("Microsoft.XMLHTTP");      }
            catch (e) {      
                alert("Your browser does not support AJAX!");      
                return false;      }    
            } 
        }
          xmlHTTP4.onreadystatechange=function() {
            if(xmlHTTP4.readyState==4){
                
                /*
                //alert(xmlHTTP4.responseText);
                window.location = xmlHTTP4.responseText;
                */
            }
          }
          xmlHTTP4.open("GET",url,true);
          xmlHTTP4.send(null);  
    }
 
       
    function checkLoginImpact( form_name ){
        var strErrors = '';     
        var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
         if (document.forms[form_name].emailimpact.value.search(emailRegEx) == -1) {
              strErrors += 'Please enter a valid email address.\n';
         }
         if (document.forms[form_name].passimpact.value == '') {
              strErrors += 'Please enter a password.\n';
         }
         if (strErrors != '') {
            alert(strErrors);
            return false;
         }
         else {
            
            ajaxFunctionImpact( document.forms[form_name].emailimpact.value, document.forms[form_name].passimpact.value, document.forms[form_name].fundid.value  );
                document.getElementById('dllocklit').style.visibility = 'hidden';
                document.getElementById('dllocklit').style.display = 'none';
                document.getElementById('impactlock').style.visibility = 'hidden';
                document.getElementById('impactlock').style.display = 'none';
                document.getElementsByClassName('topItemClose')[0].style.backgroundImage="url('/images/designelements/spacer.gif')";
                document.getElementById('topItem').innerHTML = '<a href="?delCookie=1&strPreviousUrl=' + prevurl + '\'">Financial Professional Log Out</a>';    
                document.getElementById('dropMenu').style.display = 'none';
                document.getElementById('menudummy').style.visibility = 'visible';
                document.getElementById('menudummy').style.display = 'block';
                
                    
         }
    }
      
    function hasClass(ele,cls) {
        return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
    }  
      
    function changeClass(){
        jQuery('#topItem').removeClass('topItemClose');
        jQuery('#topItem').addClass('topLogOff');
        jQuery('#topItem').removeAttr('topItem');
    }  
       
    function checkLoginImpact2( form_name ){
        var strErrors = '';     
        var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
         if (document.forms[form_name].emailimpact.value.search(emailRegEx) == -1) {
              strErrors += 'Please enter a valid email address.\n';
         }
         if (document.forms[form_name].passimpact.value == '') {
              strErrors += 'Please enter a password.\n';
         }
         if (strErrors != '') {
            alert(strErrors);
            return false;
         }
         else {
            ajaxFunctionImpact2( document.forms[form_name].emailimpact.value, document.forms[form_name].passimpact.value, document.forms[form_name].fundid.value  );
            document.getElementsByClassName('topItemClose')[0].style.backgroundImage="url('/images/designelements/spacer.gif')";
                document.getElementById('topItem').innerHTML = '<a href="?delCookie=1&strPreviousUrl=' + prevurl + '\'">Financial Professional Log Out</a>';    
                document.getElementById('dropMenu').style.display = 'none';
                document.getElementById('menudummy').style.visibility = 'visible';
                document.getElementById('menudummy').style.display = 'block';
                
         }
    }
    
    
    function removeClassName(e,t) {
        if (typeof e == "string") {
            e = xGetElementById(e);
        }
        //code to change and replace strings
        var ec = ' ' + e.className.replace(/^s*|s*$/g,'') + ' ';
        var nc = ec;
        t = t.replace(/^s*|s*$/g,'');
        //check if not already there
        if (ec.indexOf(' '+t+' ') != -1) {
            //found, so lets remove it
            nc = ec.replace(' ' + t.replace(/^s*|s*$/g,'') + ' ',' ');
        }
        //return the changed text!
        e.className = nc.replace(/^s*|s*$/g,''); //trimmed whitespace
        return true;
    }

      
    
    function setfundidform( fund_id ){
         document.getElementById('impactfundid').value = fund_id;
         //alert(document.getElementById('impactfundid').value);
    }


    function gup( name )
    {
      name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
      var regexS = "[\\?&]"+name+"=([^&#]*)";
      var regex = new RegExp( regexS );
      var results = regex.exec( window.location.href );
      if( results == null )
        return "";
      else
        return results[1];
    }

    function moveBox ( divname ) {
        //document.getElementById( divname ).style.left = '';
        document.getElementById( divname ).style.position = 'absolute';
        document.getElementById( divname ).style.top = '190px';
        document.getElementById( divname ).style.left = '50px';
        document.getElementById( divname ).style.zIndex = '11111';
        
    }
    
    function moveBoxOrigin ( divname ) {
        //document.getElementById( divname ).style.left = '';
        document.getElementById( divname ).style.position = 'relative';
        document.getElementById( divname ).style.top = '-110px';
        document.getElementById( divname ).style.left = '20px';
        document.getElementById( divname ).style.zIndex = '11111';
        
    }
 
// -->
