/*
	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
*/

	
// Page Tracking (JavaScript Analytics)
function PageTrack(url) {
    try {
        url = '/bdo/content/photos' + url;
        pageTracker._trackPageview(url);    // Google Analytics
        _rsEvent(url);  // Nielsen NetRatings
    } catch(e) {}
}

// Image Change
function ChangeImage(obj,image) {
	document.getElementById(obj).src = image;
}

// Class Change
function ChangeClass(obj,class_name) {
	document.getElementById(obj).classname = class_name;
}

// Change Z-Index
function ChangeZ(obj,index) {
	document.getElementById(obj).style.zIndex = index;
}

// Find object
function FindObject(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;
} 

// Popup Window
function PopupWindow(PopupURL, PopupName, PopupWidth, PopupHeight) {
	objWindow = window.open(PopupURL, PopupName,"width="+PopupWidth+",height="+PopupHeight+",resizable=no,status=no,scrollbars=yes,location=no,menubar=no,toolbar=no");
	if (window.focus) {
		objWindow.focus();
	}
	return false;
}

// Page Jump (Select Box Navigation)
function PageJump(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 GoBlank(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 PrintPage() {
	window.print();  
}


/*
	Author: James Hartcher
	Description: Javascript to Flash (ActionScript) functions
	Copyright (c) 2005-2007 Internet Design Studios, All Rights Reserved
*/

// Locate Movie
function FindMovie(MovieName) {
	// This function returns the appropriate syntax depending on the browser.
	if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return window[MovieName]
	} else {
		return document[MovieName]
	}
}

// Checks if movie is completely loaded.
function MovieIsLoaded(MovieName) {
	if (typeof(MovieName) != "undefined") {
		return MovieName.PercentLoaded() == 100;
	} else {
		return false;
	}
}

// Play
function PlayMovie(MovieName) {
	if (MovieIsLoaded(FindMovie(MovieName))) {
    	FindMovie(MovieName).Play();
  	}
}

// Stop
function StopMovie(MovieName) {
  	if (MovieIsLoaded(FindMovie(MovieName))) {
    	FindMovie(MovieName).StopPlay();
  	}
}

// GoTo Frame
function GoFrame(MovieName,Frame) {
  	if (MovieIsLoaded(FindMovie(MovieName))) {
    	FindMovie(MovieName).TGotoFrame("_level0/",Frame);
  	}
}

// GoTo Label
function GoLabel(MovieName,Label) {
	if (MovieIsLoaded(FindMovie(MovieName))) {
    	FindMovie(MovieName).TGotoLabel("_level0/",Label);
  	}
}

// Set Variable
function SetVariable(MovieName,Variable,Value) {
	if (MovieIsLoaded(FindMovie(MovieName))) {
    	FindMovie(MovieName).SetVariable(Variable, Value);
  	}
}
