/*  This code copyright iWeb Solutions Pty Ltd 
	Bacchus Management systems Version 1.1
	Modified: January 2005
*/
/*highlght nav link for current section of site*/
function HighlightNavLink(){
	//alert("helllo");
	var url = location.href;
		//remove main domain name from url
		url = url.replace(/http\:.*\.au\//,"");
		//remove file name
		url = url.replace(/\/\w*.htm.*/g,"");
		url = url.replace(/\//g,"");
		url = url.toLowerCase();
		
		//alert("url : " + url);
		switch (url){
			case "": 
				var btn = document.getElementById('btn_home');
				btn.src = "/img/btn_home_ovr.gif";
				break;
			case "default.htm": 
				var btn = document.getElementById('btn_home');
				btn.src = "/img/btn_home_ovr.gif";
				break;
			case "about": 
				var btn = document.getElementById('btn_about');
				btn.src = "/img/btn_about_ovr.gif";
				break;
			case "transport": 
				var btn = document.getElementById('btn_transport');
				btn.src = "/img/btn_transport_ovr.gif";
				break;
			case "professionals": 
				var btn = document.getElementById('btn_professionals');
				btn.src = "/img/btn_professionals_ovr.gif";
				break;
			case "hospitality": 
				var btn = document.getElementById('btn_hospitality');
				btn.src = "/img/btn_hospitality_ovr.gif";
				break;
			case "web_dev": 
				var btn = document.getElementById('btn_web_dev');
				btn.src = "/img/btn_web_dev_ovr.gif";
				break;
			case "case_studies": 
				var btn = document.getElementById('btn_case_studies');
				btn.src = "/img/btn_case_studies_ovr.gif";
				break;
			case "contacts": 
				var btn = document.getElementById('btn_contact');
				btn.src = "/img/btn_contact_ovr.gif";
				break;
			//default : alert("error in nav bar");
		}
	
	
	}
/* Roll Over for navigation buttons */
function doButton(oButton) {  // Image swapper GIF
	if(oButton){
		var ext = oButton.src.substring(oButton.src.lastIndexOf("."), oButton.src.length)
		oButton.src = ((i = oButton.src.indexOf("_ovr")) >= 0) ? "/img/" + oButton.id + ext : "/img/" + oButton.id + "_ovr" + ext;
	}
}



/* Retrieves the base url from the current page */
function oBaseUrl(){
	var DocURL, protocolIndex, ServerIndex, BeginURL
	this.baseURL = null;
	DocURL = document.URL;
	protocolIndex=DocURL.indexOf("://",4);
	serverIndex=DocURL.indexOf("/",protocolIndex + 3);
	BeginURL=DocURL.indexOf("#",1) + 1;
	this.baseURL=DocURL.substring(BeginURL,serverIndex) + '/';
}

/*	WINDOW FUNCTIONS
	Usage:
		1. <a href="JavaScript:openWindowAtCentre('http://www.iwebsolutions.com.au','iWeb Solutions', 400, 200);">iWeb Solutions</a>
	->	2. <a href="http://www.heightdynamics.com.au" onclick="openScrollWindowAtCentre(this.href, 'Height Dynamics', 670, 700);return false;" onfocus="this.blur()">Height Dynamics</a><br>
*/

var oWin = null;

function openWindowAtCentre( location, name, sizeX, sizeY ) {
  var posx = (screen.availWidth-sizeX)/2;
  var posy = (screen.availHeight-sizeY)/2;
  var windowString = 'toolbar=no,location=no,menubar=no,status=no,resizable=no,directories=no,scrollbars=no,copyhistory=no,width='+sizeX+',height='+sizeY+',left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
  oWin = window.open(location, name, windowString);
  oWin.focus();
}



/* Image Gallery Functions */

function fnNext(){ 
	intID++;	
	if (intID > aImages.length - 1) { intID = 0; } 
	fnLoadImage(); 
}		
function fnPrevious(){ 
	intID--;	
	if (intID < 0 ) { intID = aImages.length - 1; }	
	fnLoadImage();
}		
function fnLoadImage(){	
	var oImg = document.getElementById("mImage"); 
	oImg.src = aImages[intID];
}		
function fnResize(oImage){ 
	var width = oImage.width + 34; 
	var height = oImage.height + 88;
	if (width > 100 && height > 100) window.resizeTo(width, height); 
}
