// Browser Detection
isMac	=(navigator.appVersion.indexOf("Mac")!=-1)?true:false;
NS4	=(document.layers)?true:false;
IEmac	=((document.all)&&(isMac))?true:false;
IE4plus	=(document.all)?true:false;
IE4	=((IE4plus)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1))?true:false;
IE5	=((IE4plus)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1))?true:false;
ver4	=(NS4 || IE4plus)?true:false;
NS6	=(!NS4)&&(navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f) {
  if (IEmac && IE4){  // IE 4.5 blows out on testing window.onload
    window.onload = SafeOnload;
    gSafeOnload[gSafeOnload.length] = f;
  }else if(window.onload){
    if (window.onload != SafeOnload){
      gSafeOnload[0] = window.onload;
      window.onload = SafeOnload;
    }		
    gSafeOnload[gSafeOnload.length] = f;
  }else window.onload = f;
}
function SafeOnload() {
  for (var i=0;i<gSafeOnload.length;i++) gSafeOnload[i]();
}

// Call the following with your function as the argument
// SafeAddOnload(yourfunctioname);

//function disable_right_click(e){
//  var event_number=0;
//  if(NS4 || NS6){ event_number=e.which; }
//  else{ event_number=event.button; }
//  if(event_number==2 || event_number==3){
//    alert("Right Mouse Button Is Disabled for Pictures."); return false;
//  }
//  return true;
//}
//function trap_images_mouse_events() {
//  if(document.images){
//    for(var i=0;i<document.images.length;i++){
//      document.images[i].onmousedown=disable_right_click;
//    }
//  }
//}
//SafeAddOnload(trap_images_mouse_events);

var warningMessage='Right mouse button is disabled for pages with pictures.';
function onMouseDownIE4(){
  if(event.button==2){
    alert(warningMessage);
    return false;
  }
};

function onMouseDownNS4(e){
  if(document.layers||document.getElementById&&!document.all){
    if(e.which==2||e.which==3){
      alert(warningMessage);
      return false;
    }
  }
};

if(document.layers){
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown=onMouseDownNS4;
}else if(document.all&&!document.getElementById){
  document.onmousedown=onMouseDownIE4;
};

document.oncontextmenu=new Function("alert(warningMessage);return false");

function newWindow(w){
  var win=window.open(w,"New_Window",
    "height=600,width=700,resizable,scrollbars,toolbar"
  );
  win.window.focus();
}
function helpWindow(w) {
  var win=window.open(w,"Help_Window",
    "height=500,width=430,resizable,scrollbars,menubar"
  );
  return;
}

