/* - - - - - - - - - - - - - - - - - - - - -

Title : Biennale of Sydney (Australia)
URL : http://www.bos2008.com

Author : SiteSuite Australasia
Author URL : http://www.sitesuite.com.au

Description : Custom jQuery Includes

- - - - - - - - - - - - - - - - - - - - - */

$(function() {

// Buttons Hovers
$(".rollover").hover(
	function(){
		if($(this).attr("src").indexOf("-active") == -1) {
			var newSrc = $(this).attr("src").replace(".gif","-active.gif#hover");
			$(this).attr("src",newSrc);
		}
	},
	function(){
		if($(this).attr("src").indexOf("-active.gif#hover") != -1) {
			var oldSrc = $(this).attr("src").replace("-active.gif#hover",".gif");
			$(this).attr("src",oldSrc);
		}
	});

// Breadcrumbs and Plugins
$(function(){
	var path = location.pathname.substring(1);
	
	if ( path ) { // Breadcrumbs - Highlight selected
		if (!$('title').is(':contains(Whats On)') ) {
			$('#crumbs a[@href$="' + path + '"]').attr('class', 'selected').css({cursor:"default"});
		}
		$('#subNav a[@href$="' + path + '"]').parent("li").attr('class', 'selected').css({cursor:"default"});
		}
});

// Plugin - Text Field Hint
// $("#s").search();
$.fn.search = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			$(this).css({color:"#444"});
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			$(this).css({color:"#999"});
			this.value = this.defaultValue;
		}
	});
};

	// Semantic External Links 
	$("a[@rel$='external']").click(function(){
	 this.target = "_blank"});
	
	// Popup window 
	$("a[@id$='pier']").click(function(){
	 	window.open('/form/school_booking_form.html?venue=pier2_3','Bookings',
		'width=710px,height=600px,top=0,toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
		return false;
	});
	$("a[@id$='cockatoo']").click(function(){
	 	window.open('/form/school_booking_form.html?venue=cockatoo','Bookings',
		'width=710px,height=600px,top=0,toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
		return false;
	});
	$("#bookWindow").click(function(){
	 	var linkURL = $(this).attr('href');
		window.open(linkURL,'Bookings',
		'width=740px,height=670px,top=0,toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
		return false;
	});

});

