// Assets Document

var $j = jQuery.noConflict();

/**
 * @desc  EXTERNAL LINKS - traps all links with rel="external" or class="external" or those that link to external sources
 * @author  Stephen Blignault
 * @version 2009/05/18
 */
function external_links()
{
	// turn rel="external" attributes into new window popups
	$j('a[rel^="external"]').click( function() {
		window.open( $j(this).attr('href') );
		return false;
	});
	// turn "external" classes into new window popups
	$j('a.external').click( function() {
		window.open( $j(this).attr('href') );
		return false;
	});
	// find all external links on a site and make new window popups
	$j("a[href^='http://']").not("a[href^='http://theoldoak.corecms.co.nz']").not("a[href^='http://www.theoldoak.co.nz']").not("a[href^='http://theoldoak.co.nz']").not('a[rel^="external"]').click(function(){
		window.open(this.href,'external');
		return false;
	});
	 // Email Converter
 	$j('a.email').each(function(){
 		e = this.title.replace('/','@');
 		this.href=" ";
		this.href = 'mailto:' + e; $j(this).text(e);
 	});
};

function disableContainer (element,pageName) {
	 if ( $j(element).hasClass(pageName) ) {
		$j(element).addClass("noshow");
	 }
	
}

/**
 * @desc	
 * @author	Stephen Blignault
 * @version	2009/11/10
 */
/*function HomepageBannerSlider()
{
	if ( $j('#placeholder-hero').length )
	{
		$j('#placeholder-hero').cycle(
			{
				fx:'fade', 
				speed: 3000,
				delay:-6000,
				random:1
			}
		);
	}
}*/

// Dom Load
$j(function()
{
	external_links();
	//HomepageBannerSlider();
	
	if  ( $j(".inner p") ) {
		$j(".inner p").eq(0).addClass("leadin");
	}
	
	disableContainer ( $j('#latest-announcements'),"events-activities" );

});




