try {
	if (typeof $ == 'function') {
		$(document).ready(function() {
			(function($) {
				$.is = {
					mobile: function() { 
						var sreturn = false;
						if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {	
							sreturn = true
						}
						return sreturn;
					}
				}
			})(jQuery);	
		});
	}
} catch(err) { }

function onRollOverCarousel(obj_img){
	
	obj_img.src = obj_img.src.split("off-").join("on-");
}

function onRollOutCarousel(obj_img){
	var str_image_page_id = obj_img.id.split("img-").join("");
	if (str_image_page_id == page_name){
		return;	
	}
	obj_img.src = obj_img.src.split("on-").join("off-");
}

var str_carouselloaded = "";
function initCarouselImg(obj_img){
	
	//alert(obj_img);
	
	
	if (str_carouselloaded.split("|"+obj_img.id+"|").length > 1){
		return;	
	}
	
	
	
	str_carouselloaded+="|"+obj_img.id+"|"
	
	var str_image_page_id = obj_img.id.split("img-").join("");
	if (str_image_page_id == page_name){
		obj_img.src = obj_img.src.split("off-").join("on-");
	}

} 

function e(id) {
	return document.getElementById(id)?document.getElementById(id):false;
}

function changeStateOn (id) {
	e(id + "-off").className = "hidden";
	e(id + "-on").className = "visible";
}

function changeStateOff (id) {
	e(id + "-off").className = "visible";
	e(id + "-on").className = "hidden";
}


function launchPopupWin(anchor_obj,width,height) {
	var new_win = window.open(anchor_obj.href,'popup','resizable=yes,scrollbars=yes,width='+width+',height='+height+',left='+String((screen.width-width)/2)+',top='+ String((screen.height-height)/2) );
	 if (new_win ) {
		 new_win .focus();
		 return false;
	 } else {
		return true;
	 }	 
}

/*---------------- QUEENSLAND MAP ------------------*/

var str_last_map_item;

function turnMapTextOn(id) {
	
	var str = id.split("map-").join("");
	var mapitem = "mapitem-" + str;

	if (document.getElementById(mapitem)) {
		
		//Hide the old map item
		if (document.getElementById(str_last_map_item)) {
			document.getElementById(str_last_map_item).className="map-item-off";
		}
		
		//Show the new item
		document.getElementById(mapitem).className = "map-item-on";
		str_last_map_item = mapitem;
	}
}

function turnMapTextOff(id) {
	var str = id.split("map-").join("");
	var mapitem = "mapitem-" + str;
	
	//Hide the old map item
	if (document.getElementById(mapitem).className == "map-item-on" ) {
		document.getElementById(mapitem).className="map-item-off";
	}
}

/*--------------------- Button fade in fade out ------------------*/

var int_btn_timer;
var bln_is_hover = false;

try {
	$(document).ready(function() {
		obj = $('#internal-feature .on');
		if (obj.length) {
			fadeButtonPause(obj);
			$('#feature-btn a').hover(
				function() {
					bln_is_hover = true;
					obj.fadeIn(100);
				},
				function() {
					bln_is_hover = false;
					fadeButtonPause(obj);
				}
			);
		}
	});
} catch (err) { }

function fadeButtonIn(obj) {
	if (!bln_is_hover) {
		obj.fadeIn(1000, function() { fadeButtonOut(obj); });
	}
}	
function fadeButtonOut(obj) {
	if (!bln_is_hover) {
		obj.fadeOut(1000,function() { fadeButtonPause(obj); });
	}
}
function fadeButtonPause(obj) {
	int_btn_timer = setTimeout(function() { fadeButtonIn(obj) }, 1000);
}

