/*
	Title: Common JavaScript [Version 3]
	Description: Common javascript functions for all websites
	Author: James Hartcher
	Created: 22/07/2003
	Modified: 11/12/2006
	
	Copyright © 2005/6 Internet Design Studios Pty Ltd, All Rights Reserved
	www.idstudios.com.au
*/

// Image Change
function image_change(obj,image) {
	objElement = find_object(obj);
	objElement.src = image;
}

// Class Change
function class_change(obj,class_name) {
	objElement = find_object(obj);
	objElement.classname = class_name;
}

// Change Z-Index
function zindex_change(obj,index) {
	objElement = find_object(obj);
	objElement.style.zIndex = index;
}

// Find object
function find_object(obj) {
	var ie=document.all;
	var ns6=document.getElementById && !document.all;
	if (ie||ns6) {
		var objElement = document.all? document.all[obj] : document.getElementById? document.getElementById(obj) : "";
	}
	return objElement;
}

// Toggle display on a div
function ToggleDisplay(identity) {
	if (find_object(identity).style.display == 'block') {
		find_object(identity).style.display = 'none';
	}
	else {
		find_object(identity).style.display = 'block';
	}
}

// Swap display of two div's
// Identity1 = being swapped out
// Identity2 = the replacement for Identity1
function ToggleSwap(identity1, identity2) {
	if (find_object(identity1).style.display == 'none') {
		find_object(identity1).style.display = 'block';
		find_object(identity2).style.display = 'none';
	}
}

// Popup Window
function popup_window(window_url, window_width, window_height) {
	new_window = window.open(window_url,"popup_window","width="+window_width+",height="+window_height+",resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no");
	if (window.focus) {
		new_window.focus();
	}
	return false;
}

// Page Jump (Select Box Navigation)
function page_jump(obj,page_prefix) {
	select_options = obj; //find_object(obj);
	page_suffix = select_options.options[select_options.selectedIndex].value;
	if (page_suffix) {
		destination = page_prefix + page_suffix;
		location.href = destination;
	}
}

// Go Blank (Used to replace Default Fields)
function go_blank(obj,default_value) {
	input_field = obj; //find_object(obj);
	current_value = input_field.value;
	if (current_value == default_value) {
		input_field.value = "";
		input_field.style.backgroundImage = "none";
	}		
}

// Print Page
function print_page() {
	window.print();  
}

// Insert Flash
function InsertFlash(html)
{
	document.write(html);
}

// Menu rollovers
function rollover(sender, image) {
  // Change image
 sender.getElementsByTagName('img')[0].src = image;
  
}

function rolloff(sender, image) {
  // Change image
 sender.getElementsByTagName('img')[0].src = image;
  
}


// Toggle Login
function ShowLogin() {

	// Find Objects
    var objLogin 		= find_object('signin');
	var objLoginEmail 	= find_object('login_email');
	
	// Toggle Display
    if (objLogin.style.display == "none" || !objLogin.style.display) {
        objLogin.style.display = "block";
      	objLoginEmail.focus();
    } else if (objLogin.style.display == "block") {
        objLogin.style.display = "none";
    }

	// Return False
    return false;
	
} 

