/**
 * add multiple JavaScript onload functions
 * @function
 */ 
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

// prevent user from selecting html text
// corrects the bug w/ the scrollbar in IE (white box displays upon text selection or scrolling)

function disabletext(e) {
	return false  
}  
  
function reEnable() {
	return true  
}  
  
//if the browser is IE4+

function stopSelection(id) {
	document.getElementById(id).onselectstart=new Function ("return false")  
	  
	//if the browser is NS6  
	if (window.sidebar){  
	document.getElementById(id).onmousedown=disabletext  
	document.getElementById(id).onclick=reEnable  
	}
}
 
// popup window

function popupWindow(url,windowName,w,h)
{
  var width=w;
  var height=h;
  var from_top=350;
  var from_left=500;
  var toolbar='no';
  var location='no';
  var directories='no';
  var status='no';
  var menubar='no';
  var scrollbars='yes';
  var resizable='yes';
  var atts='width='+width+'show,height='+height+',top='+from_top+',screenY=';
  atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
  atts+=',location='+location+',directories='+directories+',status='+status;
  atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
  window.open(url,windowName,atts);
}


// lightbox code


var LaunchRulesOverlay = Class.create();

//debugger;

LaunchRulesOverlay.prototype = {
	initialize: function() {
		this.backdrop = new ModalBackdrop();
	}, 
	
	/**
	* displays a given gallery, based on the variable name passed
	*/
	show: function() {
		// turn on the lightbox modal backdrop effect
		this.backdrop.enable();
		// show the overlay
		$('rulesOverlay').style.display = 'block';		
	},
	
	/**
	* closes the gallery
	*/
	close: function() {
		this.backdrop.disable();
		$('rulesOverlay').style.display = 'none';
	}
}

// Toggle Overlays
function toggle(x) {
	if ($(x).style.visibility == 'visible') {
		$(x).style.visibility = 'hidden';
	} else {
		$(x).style.visibility = 'visible';
	}
}