// Attach class to HTML tag to allow hiding of elements via css 
$('HTML').addClass('JS');    

$(document).ready(function(){


// Superfish Nav 
	  	jQuery('#main-nav ul').superfish({	  
	  		delay:       1000,                            // one second delay on mouseout 
			animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
			speed:       'fast',                          // faster animation speed 
			autoArrows:  false,                           // disable generation of arrow mark-up 
			dropShadows: false                            // disable drop shadows 
		});


// News Horizontal Scroller
	$("div#news-scroller .main-story").remove();
	$("div#news-scroller .scrollable").scrollable({loop:true, size:3});
    
// News Horizontal Scroller
// initialize scrollable together with the navigator plugin
	$("div#banner-scroller .scrollable").scrollable({size:1}).navigator({navi:'#banner-navi ul'});	
   

// Flash     
	$("#flash-holder").flashembed("/fatheroftheyear/swf/foty-slider.swf");

// Form Label
	$(":text").labelify();

// Newsletter Show/Hide
//	$("#newsletter").click(function () { 
//		$("#newsletter-form").slideToggle("slow");
//		return false;
//	});

// Large Button Rollover	
	$('#sub-nav li a')
		.css( {backgroundPosition: "0px -160px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-150px 0px)"}, {duration:500})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-100px -160px)"}, {duration:400, complete:function(){
				$(this).css({backgroundPosition: "0px -160px"})
			}})
		})


	
// News Horizontal Scroller
	// The default axis is 'y', but in this demo, I want to scroll both
	// You can modify any default like this
	if($(".pane-holder").length > 0){
    $.localScroll.defaults.axis = 'x';
	
	$.localScroll({
		target: '.pane-holder', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
	}


	
	$("#news-media .main-story p:first").show();
    
    
    
    
    if($("#head-office").length > 0 ){
    $('#head-office').jmap('init', {mapCenter:[-33.892853,151.190186], mapZoom: 15});
    $('#head-office').jmap('CreateMarkerManager');
    $('#head-office').jmap('AddMarker', {'pointLatLng': [-33.892853,151.190186]});
    
	}
    if($("#sydney-office").length > 0 ){
    $('#sydney-office').jmap('init', {mapCenter:[-35.348064,149.039154], mapZoom: 15});
    $('#sydney-office').jmap('CreateMarkerManager');
    $('#sydney-office').jmap('AddMarker', {'pointLatLng': [-35.348064,149.039154]});

	}
    if($("#canberra-office").length > 0 ){
    $('#canberra-office').jmap('init', {mapCenter:[-33.939968,150.908188], mapZoom: 15});
    $('#canberra-office').jmap('CreateMarkerManager');
    $('#canberra-office').jmap('AddMarker', {'pointLatLng': [-33.939968,150.908188]});
	}
    if($("#liverpool-office").length > 0 ){
    $('#liverpool-office').jmap('init', {mapCenter:[-33.784348,151.181244], mapZoom: 15});
    $('#liverpool-office').jmap('CreateMarkerManager');
    $('#liverpool-office').jmap('AddMarker', {'pointLatLng': [-33.784348,151.181244]});
	}
    if($("#roseville-office").length > 0 ){
    $('#roseville-office').jmap('init', {mapCenter:[-33.892853,151.190186], mapZoom: 15});
    $('#roseville-office').jmap('CreateMarkerManager');
    $('#roseville-office').jmap('AddMarker', {'pointLatLng': [-33.892853,151.190186]});
	}
    if($("#wollongong-office").length > 0 ){
    $('#wollongong-office').jmap('init', {mapCenter:[-33.932747,151.148834], mapZoom: 15});
    $('#wollongong-office').jmap('CreateMarkerManager');
    $('#wollongong-office').jmap('AddMarker', {'pointLatLng': [-33.932747,151.148834]});
	}    


// Display news story banner code if image is there

	if ($(".main-story .image img").length) {
    	$(".main-story .image").show();
    }    

});

