/*!
#######################################################################
# 
# Dream Team
# JavaScript setup routines
#
# Hand-crafted by The Republic of Pete  (republicofpete.net)
#
#######################################################################
*/

	////////////////////////////////////////////////////////////////////
	//	Initialise setup routines
	////////////////////////////////////////////////////////////////////
	
		// Called when DOM is ready
		jQuery(document).ready( domSetup );
		
		// Called when entire page is loaded
		jQuery(window).load( pageSetup );
		
		// Called when DOM is unloaded
		jQuery(window).unload( domUnload );
	
	////////////////////////////////////////////////////////////////////
	//	Global variables
	////////////////////////////////////////////////////////////////////

	
	////////////////////////////////////////////////////////////////////
	//	Define setup routines
	////////////////////////////////////////////////////////////////////
	
	/* 
	domSetup()
	
	All JavaScript requiring initialisation on DOM LOAD should be called
	from this routine.
	-----------------------------------------------------------------------
	*/
	
	function domSetup() {
		
		////////////////////////////////////////////////////////////////////
		//	IE6 PNG fix
		////////////////////////////////////////////////////////////////////

			/* if( jQuery.browser.msie && jQuery.browser.version == '6.0' ) {
				DD_belatedPNG.fix('#header h1, #content h3 a');
			} */
		
		////////////////////////////////////////////////////////////////////
		//	IE6 PNG fix
		////////////////////////////////////////////////////////////////////
		
		////////////////////////////////////////////////////////////////////
		//	Navigation
		////////////////////////////////////////////////////////////////////

			/*
			Setup external links (target attribute not allowed by XHTML 1.1)
			(see http://www.sitepoint.com/article/standards-compliant-world/)
			*/
			jQuery('a[rel="external"],.external a').attr('target','blank');
		
		////////////////////////////////////////////////////////////////////
		//	/Navigation
		////////////////////////////////////////////////////////////////////
		
		////////////////////////////////////////////////////////////////////
		//	Enhancements
		////////////////////////////////////////////////////////////////////
			
		// tell the site that jQ has loaded
		jQuery('html').addClass('loaded');
		
		// add spans for rounded corners
		jQuery('#wrapper,#header,#inner,#radslide-1,#programme_list').append('<span class="tl" /><span class="tr" /><span class="bl" /><span class="br" />');
				
		// add some grammar to the address bits in the footer 
		jQuery('#footer h5,#footer dt,#contact dt').append(':');
		
		// do the long underscore on H1
		// jQuery('#inner h2').after('<hr class="underscore" />');
		
		// localscroll calls
		jQuery.localScroll();
				
		function initMenu() {
		jQuery('#programme_list > ul > li > ul').hide();
		jQuery('#programme_list > ul > li span').css('cursor','pointer');
		jQuery('#programme_list > ul > li span').css('display','block');
		jQuery('#programme_list > ul > li span').click(
		function() {
			var checkElement = jQuery(this).next();
				if((checkElement.is('#programme_list > ul > li > ul')) && (checkElement.is(':visible'))) {
					jQuery(this).next('#programme_list > ul > li > ul').slideToggle('normal')
					return false;
				}
				if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
					jQuery('#programme_list > ul > li > ul:visible').slideUp('normal');
					checkElement.slideDown('normal');
					return false;
				}
			}
		);
		}
		jQuery(document).ready(function() {initMenu();});
		////////////////////////////////////////////////////////////////////
		//	/Enhancements
		////////////////////////////////////////////////////////////////////

	} // End domSetup()
	
	/* 
	pageSetup()
	
	All JavaScript requiring initialisation on PAGE LOAD should be called
	from this routine (all images and elements should be loaded and ready to
	manipulate by this point)
	-----------------------------------------------------------------------
	*/
	
	function pageSetup() {
	

	} // End pageSetup()
	
	/* 
	domUnload()
	
	Called when page/DOM is unloaded
	-----------------------------------------------------------------------
	*/
	
	function domUnload() {

	} // End domUnload()
