/*
 Author: Roy Lindauer
 Project: UHN
 Date: July 2009
 Version: 1.0
*/

$(document).ready(function(){
	/* xhtml valid target=_blank alternative */
	$('.popup').click(function(){
		window.open($(this).attr('href'));
		return false;
	});
	
	/* provider search form */
	$('.ps_form').hide(); // hide all forms to start
	$('#ps_nevada').show(); // show first form
	$('.ps_tab[rel=ps_nevada]').addClass('active'); // start with first tab active
	
	$('.ps_tab').click(function(){ // show forms
		$('.ps_form').hide();
		$('.ps_tab').removeClass('active');
		var elem = $(this).attr('rel');
		$(this).addClass('active');
		$('#'+elem).fadeIn();	
		return false;
	});
	
	$('#messaging').cycle({
		timeout: 5000,
		speed: 2000
	});
	
	$('#np_badge').hide();
	$('#bp_badge_content').hide();
	$('#np_badge_link').toggle(function(){
		$(this).addClass('badge_active');
		$('#bp_badge_content').fadeIn();
	}, function(){
		$(this).removeClass('badge_active');
		$('#bp_badge_content').hide();
	});
	$('#np_badge_link').click(function(){
		$('#np_badge').slideToggle('slow');
		return false;
	});
	
});

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;
