
// Switches the message's pre-populated in the form fields on and off.


function checkClearValue(field, label){  
  if(field.value == label)
  {
	field.style.color = "#000000";
    field.value = "";
  }
}

function checkFillValue(field, label){
  if(field.value.length == 0)
  {
	field.style.color = "#96a456";
    field.value = label;
  }
  if(field.value == label)
  {
	field.style.color = "#96a456";  
  }
}

// Hides various elements 
function show_exif(objOne){
var exif=document.getElementById(objOne);
	if (exif.style.display == "none")
	{
	exif.style.display = ""; // ON 
	}
	else
	{
	exif.style.display = "none"; // OFF
	}
}
// Hide the form
function hideForm(objOne,objTwo)
{
		One.style.display = "none";
		Two.style.display = "none";
}
  

// Used to adjust width of Google Map 
function detectBrowserSize(){
	
	var obj=document.getElementById('google_map');
	
	switch (screen.width) 
	{
		case 800: obj.style.height = "320px"; break;
		case 1024: obj.style.height = "520px"; break;
		case 1200: obj.style.height = "800px"; break;
		default: obj.style.height = "520px"; break;
	}
	
}

// Blur effect, MSIE only. 
function blurObject(myObj)
{
	//alert("Hello World");
	var obj=document.getElementById(myObj);
	obj.style.filter = "progid:DXImageTransform.Microsoft.Blur(PixelRadius='10', MakeShadow='false', ShadowOpacity='0.25')";
}

// Cross-Browser Add To Favourites
function AddToFavourites (url,title)
{ 

var agt = navigator.userAgent.toLowerCase(); 
var app = navigator.appName.toLowerCase(); 
var ieAgent = agt.indexOf('msie'); 
var nsAgent = app.indexOf('netscape'); 
var opAgent = app.indexOf('opera'); 

	if (nsAgent!= -1) 
		{ // Mozilla Firefox Bookmark		
		window.sidebar.addPanel(title,url,"");	
		} 
	else if(ieAgent!= -1) 
		{ // IE Favorite		
		window.external.AddFavorite(url,title); 

		}	
	else if(opAgent!= -1)
			
			// Other methods of detecting Opera
			
			// window.opera && window.print 
			// opAgent!= -1
			// agt.substr(agt.indexOf('opera')+6,1) < 9
		{
				alert("You are using a browser that does not support adding Favorites by script, please add it manually");	
		}

}  



function openWindow(url,name,height,width) {
var newwindow;
newwindow=window.open(url,name,'height='+height+',width='+width+',resizable=yes,scrollbars=yes,toolbar=no,status=no');
	if (window.focus) {newwindow.focus()}
}


function closeWindow() {
  window.close();
}

// Does a nifty grey fade out when logging out 

function log_out()
{
	//ht = document.getElementById("qname");
	ht = document.getElementsByTagName("body"); 
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Are you sure you want to log out?'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}


// Function to disable right-clicking
var message="Function Disabled!";

function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

// document.oncontextmenu=new Function("alert(message);return false")












