// initialize global variables
	var g_fade_element = ('');
	var g_fade_item = (1);
	var g_popup = (0);
	var g_scroll = (0);
	var g_timer = ('');

/* On Load */
	function body_onload()
	{
	}

/* Fade */
	function fade(p_fade, p_actionacity)
	{
	// verify that we need to clear the timer
		if((p_fade == 0) && (g_timer != '')) clearTimeout(g_timer);
	// update opacity
		if(p_fade > p_actionacity) p_actionacity += (1);
		else p_actionacity -= (1);
	// modify the promo
		g_fade_element.style.opacity = (p_actionacity / 100);
		g_fade_element.style.filter = ('alpha(opacity=' + p_actionacity + ')');
	// verify that we need to continue the fade
		if(p_fade != p_actionacity) g_timer = setTimeout(('fade(' + p_fade + ', ' + p_actionacity + ');'), 1);
	// verify that we need to fade in
		else if(p_fade == 0)
		{
		// initialize fade
			g_fade_item++;
			if(g_fade_item == g_fade_images.length) g_fade_item = (1);
			g_fade_element.src = (g_fade_images[g_fade_item]);
			setTimeout('fade(100, 0);', 1000);
		}
	// verify that we need to fade out
		else setTimeout('fade(0, 100);', 5000);
	}

/* Filter */
	function filters(p_action, p_filter)
	{
	// verify that we need to modify page filters
		if(p_action == 'page')
		{
		// initialize filters
			document.frm_filters.p_filters_page.value = (p_filter);
			for(l_element = 0; l_element < document.frm_filters.elements.length; l_element++) if((document.frm_filters.elements[l_element].name.indexOf("_filters") > 0) && (document.frm_filters.elements[l_element].value == '')) document.frm_filters.elements[l_element].value = ('~');
		}
	// verify that we need to reset filters
		else if(p_action == 'reset')
		{
		// initialize filters
			for(l_element = 0; l_element < document.frm_filters.elements.length; l_element++) if(document.frm_filters.elements[l_element].name.indexOf("_filters") > 0) document.frm_filters.elements[l_element].value = ('');
		}
	// verify that we need to modify sort filters
		else if(p_action == 'sort')
		{
		// initialize filters
			l_sort = (' ASC');
			if(document.frm_filters.p_filters_sort.value == (p_filter + l_sort)) l_sort = (' DESC');
			document.frm_filters.p_filters_sort.value = (p_filter + l_sort);
		}
	// update filters
		document.frm_filters.submit();
	}

/* Format Currency */
	function format_currency(amount)
	{
/*
		var delimiter = ","; // replace comma if desired
		var n = new String(amount);
		var a = [];
		while(n.length > 3)
		{
			var nn = n.substr(n.length-3);
			a.unshift(nn);
			n = n.substr(0,n.length-3);
		}
		if(n.length > 0) { a.unshift(n); }
		n = a.join(delimiter);
		return n;
*/
		var i = parseFloat(amount);
		if(isNaN(i)) { i = 0.00; }
		var minus = '';
		if(i < 0) { minus = '-'; }
		i = Math.abs(i);
		i = parseInt((i + .005) * 100);
		i = i / 100;
		s = new String(i);
		if(s.indexOf('.') < 0) { s += '.00'; }
		if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
		s = minus + s;
		return s;
	}

/* Determines If The Supplied Value Is Numeric */
	function is_numeric(p_value)
	{
	// initialize locals
		l_valid_chars = ("0123456789");
		l_valid = (true);
	// check each character in the value
		for(l_char = 0; ((l_char < p_value.length) && (l_valid == true)); l_char++)
		{
		// check char to see if it is valid
			if(l_valid_chars.indexOf(p_value.charAt(l_char)) == -1)  l_valid = (false);
		}
		return(l_valid);
	}

/* Display Popup */
	function popup(p_popup, p_action, p_background, p_video)
	{
	// display popup
		l_action = ('inline');
		if(p_action == 'inline') l_action = ('none');
		if(p_video != '') document.getElementById(p_video).style.display = (l_action);
		if(p_background == 'yes') document.getElementById('table_popups').style.display = (p_action);
		if(p_background == 'yes') document.getElementById('div_popup_background').style.display = (p_action);
		document.getElementById(p_popup).style.display = (p_action);
	}

/* Scroll Testimonials */
	function scroll_testimonials()
	{
	// scroll the testimonials
		g_scroll += (1);
		document.getElementById("div_testimonials").scrollTop = (g_scroll);
	// initialize timeout
		l_height = (document.getElementById("div_testimonials").style.height);
		l_height = (document.getElementById("div_testimonials").scrollHeight - l_height.substr(0, (l_height.length - 2)));
		l_height = (l_height + 50);
		if(g_scroll > l_height) g_scroll = (1);
	// set timeout for next scroll
		setTimeout("scroll_testimonials()", 75);
	}

/* Update Country */
	function update_country(p_state, p_country)
	{
	// check state
		l_st = (p_state.value);
		l_country = (p_country);
		if((l_st == "ACT") || (l_st == "NSW") || (l_st == "NT") || (l_st == "QLD") || (l_st == "SA") || (l_st == "TAS") || (l_st == "VIC") || (l_st == "AU-WA")) l_country.value = ("AU");
		else if((l_st == "AB") || (l_st == "BC") || (l_st == "MB") || (l_st == "NB") || (l_st == "NF") || (l_st == "NS") || (l_st == "NT") || (l_st == "ON") || (l_st == "PE") || (l_st == "QC") || (l_st == "SK") || (l_st == "YT")) l_country.value = ("CA");
		else if(l_st == "NZ") l_country.value = ("NZ");
		else if((l_st == "AS") || (l_st == "FM") || (l_st == "GU") || (l_st == "MH") || (l_st == "MP") || (l_st == "PW") || (l_st == "PR") || (l_st == "VI")) l_country.value = (l_st);
		else l_country.value = ("US");
	}