intID=setInterval('swapImages()', 10000);
    $(document).ready(function(){
		$("#heroPanel").hover(	
			function(){
				clearInterval(intID);
			},
			function(){   
				intID=setInterval('swapImages()', 10000);
			}
		);

    });

$(document).ready(function(){	
	$('.newsItemContainer').corner("bottom left 7px");
	$('.staffMember').corner("bottom left 7px");
	$('.resourcesItem').corner("bottom left 7px");
	$('.staffPhoto').corner("bottom left 7px");
	$('.btn').corner();
	$('.corner').corner("bottom left 7px");
	$('.staffTitle').corner("bottom left 7px");
	$('.resourcesTitle').corner("bottom left 7px");
});

// DROP DOWN MENU
var timeout         = 0;
var closetimer		= 0;
var ddmenuitem      = 0;

function dropDownMenu_open()
{	dropDownMenu_canceltimer();
	dropDownMenu_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

function dropDownMenu_close()
{	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function dropDownMenu_timer()
{	closetimer = window.setTimeout(dropDownMenu_close, timeout);}

function dropDownMenu_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}}

document.onclick = dropDownMenu_close;


function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(function() {
	$(".newsticker-jcarousellite").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 3,
		auto:4000,
		speed:1000
	});
});

$(document).ready(function() {
	$('#dropDownMenu > li').bind('mouseover', dropDownMenu_open);
	$('#dropDownMenu > li').bind('mouseout',  dropDownMenu_timer);						   
});

function showExistingClientForm() {
	$('#existingClientForm').show();
	$('#newClientForm').hide();
}

function showNewClientForm() {
	$('#existingClientForm').hide();
	$('#newClientForm').show();
}

function resetDots(){
  $("#acts li").each(function(){
	$(this).attr('class','inact');
  });
}
function showImage(imageID){
	resetDots();
	
	$("#heroImagesPreload img").each(function(){
		$(this).attr('class', 'inactive');
		$(this).hide();
	});

	$("#hero"+imageID).attr('class', 'active');
	$("#act"+imageID).attr('class', 'act');
	$("#hero"+imageID).show();
	 $("#heroLink").attr('href', $("#heroLink"+imageID).attr('href'));
}

function swapImages(){ 

	$("#heroact").hide();
	 resetDots();
     var $active = $('#heroImagesPreload .active');
     var $next = ($('#heroImagesPreload .active').next().length > 0) ? $('#heroImagesPreload .active').next() : $('#heroImagesPreload img:first');

	 $active.fadeOut(function(){
		  heroID= $next.attr('id').split("hero");
		  $("#act"+heroID[1]).attr('class','act');

		  $active.removeClass('active');

		  $next.fadeIn().addClass('active');
			 $("#heroLink").attr('href', $("#heroLink"+heroID[1]).attr('href'));
			 $("#heroact").show();
	  });
}


function initialize() {
    var newcastleOfficeLatLng = new google.maps.LatLng(-32.922747, 151.747373);
	var snowyMountainsOfficeLatLng = new google.maps.LatLng(-36.415907, 148.621345);
	var sapphireCoastOfficeLatLng = new google.maps.LatLng(-36.864951, 149.916797);
	var centralCoastOfficeLatLng = new google.maps.LatLng(-33.2412, 151.503021);
	var centerLatLng = new google.maps.LatLng(-34.74161249883173, 150.325927734375);
    var myOptions = {
      zoom: 6,
      center: centerLatLng,
	  disableDefaultUI: false,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    var newcastleOfficeDetails = '<div style="width:300px;">'+
        '<strong>Newcastle Office</strong><br /><br />'+
	    '103 Beaumont Street, Hamilton NSW 2303</div>';
		
	var snowyMountainsOfficeDetails = '<div style="width:300px;">'+
        '<strong>Snowy Mountains Office</strong><br /><br />'+
	    '4 Gippsland Street, Jindabyne NSW 2627</div>';
		
	var sapphireCoastOfficeDetails = '<div style="width:300px;">'+
        '<strong>Sapphire Coast Office</strong><br /><br />'+
        '19 Tura Beach Drive, Tura Beach NSW 2548</div>';
     
	var centralCoastOfficeDetails = '<div style="width:300px;">'+
        '<strong>Central Coast Office</strong><br /><br />'+
        'Shop 901s, Lake Haven Shopping Centre<br />'+
		'Lake Haven NSW 2263</div>';
    
    var newcastleOfficeWindow = new google.maps.InfoWindow({
        content: newcastleOfficeDetails
    });
	
	var snowyMountainsOfficeWindow = new google.maps.InfoWindow({
        content: snowyMountainsOfficeDetails
    });
	
	var sapphireCoastOfficeWindow = new google.maps.InfoWindow({
        content: sapphireCoastOfficeDetails
    });
	
	var centralCoastOfficeWindow = new google.maps.InfoWindow({
        content: centralCoastOfficeDetails
    });

    var newcastleOfficeMarker = new google.maps.Marker({
        position: newcastleOfficeLatLng,
        map: map,
        title: 'Newcastle Office'
    });
	
	var snowyMountainsOfficeMarker = new google.maps.Marker({
        position: snowyMountainsOfficeLatLng,
        map: map,
        title: 'Snowy Mountains Office'
    });
	
	var sapphireCoastOfficeMarker = new google.maps.Marker({
        position: sapphireCoastOfficeLatLng,
        map: map,
        title: 'Sapphire Coast Office'
    });
	
	var centralCoastOfficeMarker = new google.maps.Marker({
        position: centralCoastOfficeLatLng,
        map: map,
        title: 'Central Coast Office'
    });
	
    google.maps.event.addListener(newcastleOfficeMarker, 'click', function() {
      newcastleOfficeWindow.open(map,newcastleOfficeMarker);
    });
	google.maps.event.addListener(snowyMountainsOfficeMarker, 'click', function() {
      snowyMountainsOfficeWindow.open(map,snowyMountainsOfficeMarker);
    });
	google.maps.event.addListener(sapphireCoastOfficeMarker, 'click', function() {
      sapphireCoastOfficeWindow.open(map,sapphireCoastOfficeMarker);
    });
	google.maps.event.addListener(centralCoastOfficeMarker, 'click', function() {
      centralCoastOfficeWindow.open(map,centralCoastOfficeMarker);
    });
  }
