/*
New suckerfish menu
*/
$(document).ready(function(){
	$("#nav-one li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function() { } 
	);

  	if (document.all) {
		$("#nav-one li").hoverClass ("sfHover");
	}
	
	rollovers();
	headerFlash();
	
	if($('div.scroller').length)
		$('div.scroller').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
});
	  
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};


function rollovers()
{
	$(".rollover").hover(
		function () {
			imgSrc = $(this).attr("src");
			newImgSrc = imgSrc.replace("_off","_on");
			
			$(this).attr("src",newImgSrc);
		}, 
		function () {
			imgSrc = $(this).attr("src");
			newImgSrc = imgSrc.replace("_on","_off");
			
			$(this).attr("src",newImgSrc);
		}
	);
}

function headerFlash()
{
	var randomnumber=Math.floor(Math.random()*1111111);
	var so = new SWFObject("http://www.blueroom.org.au/designs/blueroom/flash/blueroom_webbanner.swf?var="+randomnumber, "header_flash", "976", "199", "6", "");
	so.addParam("wmode","transparent");
	so.write("header");
	
	if($('#facebook').length) {
		var html = '<div id="face"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2F%23%21%2Ftheblueroomtheatre&amp;layout=button_count&amp;show_faces=true&amp;width=90&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:65px;" allowTransparency="true"></iframe></div>';
		$('#header').append(html);
	}
	
	$('#header_flash').click(function(){
	  window.location = "/";
	});
}

function clearField(el, str)
{
	el = $(el);

	if(el.val() == str)
		el.val("");
}
