<!--
function rollOver(num, className, newPic)
{
	if (document.layers)
	{
		document['panelbottom'+num].className = className;
		document['link'+num].className = className;
		document['img'+num].src = newPic;
	}
	else if (document.all)
	{
		document.all['panelbottom'+num].className = className;
		document.all['link'+num].className = className;
		document.all['img'+num].src = newPic;
	}
	else if (document.getElementById)
	{
		document.getElementById('panelbottom'+num).className = className;
		document.getElementById('link'+num).className = className;
		document.getElementById('img'+num).src = newPic;
	}
}

function rollOver2(num, className)
{
	if (document.layers)
	{
		document['panel'+num].className = className;
		document['link'+num].className = className;
	}
	else if (document.all)
	{
		document.all['panel'+num].className = className;
		document.all['link'+num].className = className;
	}
	else if (document.getElementById)
	{
		document.getElementById('panel'+num).className = className;
		document.getElementById('link'+num).className = className;
	}
}

function gotopage(link)
{
	if (document.links[link])
	{
		window.location.href = document.links[link].href;
	}
	else if (document.layers)
	{
		window.location.href = document[link].href;
	}
	else if (document.all)
	{
		window.location.href = document.all[link].href;
	}
	else if (document.getElementById)
	{
		window.location.href = document.getElementById(link).href;
	}
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 5;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function initImage(imageId) {
	if (document.getElementById)
	{
		image = document.getElementById(imageId);
		setOpacity(image, 0);
		image.style.visibility = 'visible';
		fadeIn(imageId,0);
	}
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

function setalert(id)
{
	if (document.getElementById)
	{
		label = document.getElementById(id);
		label.style.color = '#ff0000';
	}
}

function clearalert(id)
{
	if (document.getElementById)
	{
		label = document.getElementById(id);
		label.style.color = '#000000';
	}
}

function validate_required(field,label)
{
	with (field)
	{
		if (value==null||value.trim()=="")
		{
		  	setalert(label);
		  	return false;
		}
		else
		{
			return true;
		}
	}
}

function validate_email(field,label)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
		{
			setalert(label);
			return false;
		}
		else
		{
			return true;
		}
	}
}

function clear_form(messageId)
{
	clearalert("name_lbl");
	clearalert("suburb_lbl");
	clearalert("email_lbl");
	clearalert("phone_lbl");
	clearalert("comments_lbl");
	
	if (document.getElementById)
	{
		label = document.getElementById(messageId);
		label.innerHTML = '&nbsp;';
	}
}	

function validate_form(thisform,messageId)
{
	clear_form(messageId);
	
	with (thisform)
	{
		got_name = validate_required(name,"name_lbl");
		got_suburb = validate_required(suburb,"suburb_lbl");
		got_email = validate_required(email_address,"email_lbl");
		got_phone = validate_required(phone,"phone_lbl");
		got_comment = validate_required(comments,"comments_lbl");
		
		if (got_name && got_suburb && got_email && got_phone && got_comment)
		{
			got_email = validate_email(email_address,"email_lbl");
		}
		
		if (got_name && got_suburb && got_email && got_phone && got_comment)
		{
			return true;
		}
		
		if (!got_comment)
		{
			comments.focus();
		}
		if (!got_phone)
		{
			phone.focus();
		}
		if (!got_email)
		{
			email_address.focus();
		}
		if (!got_suburb)
		{
			suburb.focus();
		}
		if (!got_name)
		{
			name.focus();
		}
		
		if (document.getElementById)
		{
			label = document.getElementById(messageId);
			label.innerHTML = 'Not all required fields have been completed. Please complete the highlighed fields and click the Send Message button again.';
		}
		
		return false;
	}
}

var preloaded = new Array();
var baseURL = '';

function preload_images()
{
    for (var i = 0; i < arguments.length; i++)
    {
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src',baseURL+arguments[i]);
    }
}

function limitText(limitField, limitCountId, limitNum)
{
	if (document.getElementById)
	{
		limitCount = document.getElementById(limitCountId);
		
		if (limitField.value.length > limitNum)
		{
			limitField.value = limitField.value.substring(0, limitNum);
		}
		else
		{
			limitCount.innerHTML = (limitNum - limitField.value.length).toString();
		}
	}
}

function resetLimit(limitCountId, limitNum)
{
	if (document.getElementById)
	{
		document.getElementById(limitCountId).innerHTML = limitNum;
	}
}

//-->