var is_IE = (navigator.appName == "Microsoft Internet Explorer") ? true : false ;

function init()
{
	// make any link with the class 'popup' a popup link onclick with the correct icon / or no icon where necessary
	anchors = document.getElementsByTagName("a")
	for (x in anchors) {
		if (anchors[x].className == "popup" || anchors[x].className == "popup_no_icon" || anchors[x].className == "close" || anchors[x].className == "popup_no_icon_full") {
			// set onclick command
			my_options = ''
			if (anchors[x].className == "popup" || anchors[x].className == "popup_no_icon" || anchors[x].className == "popup_no_icon_full") {
				my_command = anchors[x].href
				if (anchors[x].className == "popup_no_icon") { my_options += "height=660px, width=620px, " }
				my_options += "scrollbars, resizable, menubar, location, toolbar, status, directories"
			}
			//assign command
			if(is_IE) {
				if (anchors[x].className == "close") {
					anchors[x].onclick=function(){window.close();}
				} else {
					anchors[x].onclick=function(){newWin=window.open(this.href,'popupwin', my_options);if(window.focus && newWin){newWin.focus()} return false;}
				}
			} else {
				if (anchors[x].className == "close") {
					anchors[x].setAttribute("onclick", "window.close()")
				} else {
					anchors[x].setAttribute("onclick", "newWin=window.open('" + my_command + "','popupwin', '" + my_options + "');if(window.focus){newWin.focus()} return false;")
				}
			}
			// add popup icon
			/* if (anchors[x].className == 'popup') {
				anchors[x].innerHTML += "&#160;<img src='./images/popup.gif' alt=''/>"
			} */
		}
	}
	if (document.getElementById('calendar_submit')) {
		document.getElementById('calendar_submit').style.display = 'none'
	}
}

function lightbox(title, html) {
	YAHOO.namespace("container");
	
	my_lightbox = document.createElement('div');
	my_lightbox.setAttribute ('id', 'lightbox_div')
	document.getElementsByTagName('body')[0].appendChild(my_lightbox)
	
	my_left = (document.documentElement.clientWidth)? document.documentElement.clientWidth/2 - 250 : false ;
	if (!my_left) { my_left = (window.innerWidth)? window.innerWidth/2 - 250 : document.body.clientWidth/2 - 250 ; }
	my_top = (document.documentElement.scrollTop)? document.documentElement.scrollTop + (document.documentElement.clientHeight/4) : false ;
	if (!my_top) { my_top = (window.pageYOffset)? window.pageYOffset + (window.innerHeight/4) : document.body.scrollTop + (document.body.clientHeight/4) ; }
	
	YAHOO.container.lightbox_div = 
	new YAHOO.widget.Panel('lightbox_div', { xy:[my_left,my_top], width:'500px', close:true, draggable:false, zindex:4, modal:true, visible:false, underlay:'matte', effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.3} } );
	YAHOO.container.lightbox_div.setHeader('<span>' + title + '</span>');
	YAHOO.container.lightbox_div.setBody(html);
	YAHOO.container.lightbox_div.render(document.body);
	YAHOO.container.lightbox_div.show();
}

function my_dimensions(the_obj) {
	if (the_obj) {
		my_values = new Array
		my_values[0] = (the_obj.offsetTop)? the_obj.offsetTop : the_obj.style.pixelTop ;
		my_values[1] = (the_obj.offsetLeft)? the_obj.offsetLeft : the_obj.style.pixelLeft ;
		my_values[2] = (the_obj.offsetWidth)? the_obj.offsetWidth : the_obj.style.pixelWidth ;
		my_values[3] = (the_obj.offsetHeight)? the_obj.offsetHeight : the_obj.style.pixelHeight ;
		return my_values
	}
}

window.onload = init
