// JavaScript Document
// Global User Interface Elements on UOW
$j(function() {
	   // IE does not support input:focus in CSS so used this for all text boxes, text areas etc...
	  $j("input[type='text'], textarea").focus(
	  function () {
		$j(this).addClass("sys_input-focus");
	  });
	  
	  $j("input[type='text'], textarea").blur(
	  function () {
		$j(this).removeClass("sys_input-focus");
	  });		  

        // This applies alternate table row colours
        $j("table.Standard-Table.DataTable tr:nth-child(even)").addClass("sys_altrow");
	$j("table.Standard-Table tr:nth-child(even)").addClass("sys_alternaterow");
	
	// This opens related links in a new window
	$j(".sys_RelatedDocuments li a").attr('target', '_blank');
	
	// This sets up the Fancybox (lightbox) options
	$j('a.lightbox-youtube').click(function() {
		$j.fancybox({
			'width' 	: 680, 
			'height' 	: 495,
			'href' 		: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type' 		: 'swf',
			'title'		: this.title,
			'swf' 		: {
			   	'wmode'		  : 'transparent',
				'allowfullscreen' : 'true'
			}
		});
		
		return false;
	});
		
	$j('a.lightbox-webpage').fancybox({
		'width' : 700, 
		'height' : 425,
		'type' : 'iframe'
	});
	
	$j('a.lightbox-image').fancybox({
		'type' : 'image',
		'showNavArrows'	: true
	});
	
	// Open PDF links in a new window
	$j('a.sys_21').attr('target', '_blank');
	
	// Ticker	
	// cycle the ticker
	$j(".sys_ticker div.sys_ticker-area").cycle({
		  fx: 'scrollLeft',
		  timeout: 2000,
		  speed: 7000,
		  delay:-7000,
		  sync: true
	});
	
	
});
