function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}
function changeImages() {
  if (document.images && (preloadFlag == true)) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    }
  }
}
var preloadFlag = false;
function preloadImages() {
  if (document.images) {
    Content_01_Roll = newImage("../images/change-website-entry-point-roll.gif");
    Content_02_Roll = newImage("../images/saved-templates-roll.gif");
    Content_03_Roll = newImage("../images/pages-pending-approval-roll.gif");
    Content_04_Roll = newImage("../images/locked-pages-roll.gif");
    Content_05_Roll = newImage("../images/edit-ftp-connection-roll.gif");
    Content_06_Roll = newImage("../images/directory-view-roll.gif");
    Content_07_Roll = newImage("../images/deleted-pages-roll.gif");
    Content_08_Roll = newImage("../images/browse-view-roll.gif");
    preloadFlag = true;
  }
}

function hov(loc,cls) {
   if(loc.className)
      loc.className=cls;
}

function link_popup(url,height,width) {
    window.open(url,"","height="+height+",width="+width+",menubar=no,toolbar=no,location=no,scrollbars=no, resizable=no,status=no");
}

function css_toggle(id,css_class) {
    document.getElementById(id).className = css_class;
}

function pop_window (url,height,width) {
    pop_win = window.open(url,"","height="+height+",width="+width+",menubar=no,toolbar=no,location=no,scrollbars=yes, resizable=yes,status=no");
    onfocus = function() {pop_win.close()};
    
    // this messes up in firefox (mac) when there are form elements in the popwin
    // because unfocusing one element and then selecting another apparently unfocuses the window
    //pop_win.onload = function() {pop_win.onblur = function() {pop_win.close()}};
}

function pop_window_nocache (url,height,width) {
    // this version reloads the page, which helps prevent loading a cached version
    pop_win = window.open(url,"","height="+height+",width="+width+",menubar=no,toolbar=no,location=no,scrollbars=yes, resizable=yes,status=no");
    pop_win.onload = function() {popwin.location.reload();}
    onfocus = function() {pop_win.close()};
    
    // this messes up in firefox (mac) when there are form elements in the popwin
    // because unfocusing one element and then selecting another apparently unfocuses the window
    //pop_win.onload = function() {pop_win.onblur = function() {pop_win.close()}};
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

 function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}


