 var isNS = (navigator.appName == "Netscape") ? 1 : 0;
 if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEUP);
 function mischandler(){
    return false;
 }
 function mousehandler(e){
 	var myevent = (isNS) ? e : event;
 	var eventbutton = (isNS) ? myevent.which : myevent.button;
    if((eventbutton==2)||(eventbutton==3)) {
        //alert("Sorry, right clicking has been disabled on images.");
        return false;
    }
    return true;
 }

 function trap()
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].oncontextmenu = mischandler;
      document.images[i].onmouseup = mousehandler;
      //document.images[i].onmousedown = mousehandler;
      }
    }
  }

document.onclick = function(e)
{
  var target = e ? e.target : window.event.srcElement;

  while (target && !/^(a|body)$/i.test(target.nodeName))
  {
    target = target.parentNode;
  }

 if (target && target.getAttribute('rel')) {
  	 if (target.rel.indexOf("external") + 1 > 0) {
		var external = window.open(target.href);
		return external.closed;
	 }
	 else if (target.rel.indexOf("collapser") + 1 > 0) {
		return false; 
	 }
  }
  
}

function addLoadListener(fn)
{
	if (typeof window.addEventListener != 'undefined')
	{
	window.addEventListener('load', fn, false);
}
else if (typeof document.addEventListener != 'undefined')
{
	document.addEventListener('load', fn, false);
}
else if (typeof window.attachEvent != 'undefined')
{
	window.attachEvent('onload', fn);
}
else
{
	var oldfn = window.onload;
	if (typeof window.onload != 'function')
	{
	window.onload = fn;
	}
	else
	{
	window.onload = function()
	{
	oldfn();
	fn();
	};
	}
	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

	//determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(var i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    } 
}

function makeOpacityZero(id) {
	var thisZero = document.getElementById(id);
	thisZero.style.opacity = (0 / 100); 
	thisZero.style.MozOpacity = (0 / 100); 
	thisZero.style.KhtmlOpacity = (0 / 100); 
	thisZero.style.filter = "alpha(opacity=0)";
}

function deleteConfirm() {

	confirm_message = "Are you sure you want to delete?";

	if (confirm(confirm_message)) {
		return true;
	}

	return false;
}

function addslashes( str ) {
    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}

function fullInitialize() {
    if(typeof initialize == "function") {
        initialize();
    }
    trap();
}

