/***************************************\
| Variables
\***************************************/

var url="http://www.oistaging.net.au/cctourism/";
var regionMapObj;

/***************************************\
| On Ready
\***************************************/
$(document).ready(function()
{	


//
/// IMAGE SLIDERS
//
$('#whatsOn ul').bxSlider({
	mode: 'vertical',	
	auto: true,
	auto_controls: false,
	pager: false,
	speed: 3000,
	pause: 5000,
	controls:false
});


$('#featureBanner ul').bxSlider({
	mode: 'fade',	//horizontal
	auto: true,
	auto_controls: false,
	pager: false,
	speed: 2000,
	pause: 5000,
	controls:false
});

$('#partners ul').bxSlider({
	mode: 'fade',	//horizontal
	auto: true,
	auto_controls: false,
	pager: false,
	speed: 3000,
	pause: 10000,
	controls:false
});

$('#brochures ul').bxSlider({
	mode: 'fade',	//horizontal
	auto: true,
	auto_controls: false,
	pager: false,
	speed: 3000,
	pause: 10000,
	controls:false
});


//
///	IMAGE MAP
//
	//store the region image map as an object
	regionMapObj = $('#regionMap');	
	
	//coastal villages
	$("#mapLinkVillages").hover(
        function() {			
            highlightImageMapRegion('coastalvillages');
        },
        function() {
        	restoreImageMapDefault();
    });	
	$("#txtLinkVillages").hover(
		function() {			
            highlightImageMapRegion('coastalvillages');
        },
        function() {
        	restoreImageMapDefault();
	});
		
	//the entrance
	$("#mapLinkTheEntrance").hover(
        function() {			
            highlightImageMapRegion('theentrance');
        },
        function() {
        	restoreImageMapDefault();
    });	
	$("#txtLinkTheEntrance").hover(
		function() {			
            highlightImageMapRegion('theentrance');
        },
        function() {
        	restoreImageMapDefault();
	});
	
	//northern lakes
	$("#mapLinkNorthernLakes").hover(
        function() {			
            highlightImageMapRegion('northernlakes');
        },
        function() {
        	restoreImageMapDefault();
    });	
	$("#txtLinkNorthernLakes").hover(
		function() {			
            highlightImageMapRegion('northernlakes');
        },
        function() {
        	restoreImageMapDefault();
	});
	
	//hinterland
	$("#mapLinkHinterland").hover(
        function() {			
            highlightImageMapRegion('hinterland');
        },
        function() {
        	restoreImageMapDefault();
    });	
	$("#txtLinkHinterland").hover(
		function() {			
            highlightImageMapRegion('hinterland');
        },
        function() {
        	restoreImageMapDefault();
	});
	
	//gateways
	$("#mapLinkGateways").hover(
        function() {			
            highlightImageMapRegion('gateways');
        },
        function() {
        	restoreImageMapDefault();
    });	
	$("#txtLinkGateways").hover(
		function() {			
            highlightImageMapRegion('gateways');
        },
        function() {
        	restoreImageMapDefault();
	});
	
	//peninsula
	$("#mapLinkPeninsula").hover(
        function() {			
            highlightImageMapRegion('thepeninsula');
        },
        function() {
        	restoreImageMapDefault();
    });	
	$("#txtLinkPeninsula").hover(
		function() {			
            highlightImageMapRegion('thepeninsula');
        },
        function() {
        	restoreImageMapDefault();
	});

	
});

/***************************************\
| Functions
\***************************************/

//restore the default image map.
function restoreImageMapDefault(){
	regionMapObj.attr('src',url+'media/gfx/map-off.png');
	$('#mapPopBox li').hide();
}

//switch the image map to highlight given region
function highlightImageMapRegion(regionName){		
	rolloverImgPath=url+'media/gfx/map-'+regionName+'-active.png';
	regionMapObj.attr('src',rolloverImgPath);	
	//alert(regionName);
	//show pop up box.
	$('#mapPopBox li').hide();
	$('#descr'+regionName).fadeIn();
}

