<!--

	//================================================================================================
	// VARIABLES DECLARATION
	//================================================================================================


	//================================================================================================
	// AJAX FUNCTIONS
	//================================================================================================
	function signupNewsletter(fullname, email, address, suburb, state, postcode, phone, existing, message)
	{
		var url = "process.asp";

		var data = "process=contact";
		data = data + "&fullname=" + fullname;
		data = data + "&email=" + email;
		data = data + "&address=" + address;
		data = data + "&suburb=" + suburb;
		data = data + "&state=" + state;
		data = data + "&postcode=" + postcode;
		data = data + "&phone=" + phone;
		data = data + "&existing=" + existing;
		data = data + "&message=" + message;
		data = data + "&sid=" + Math.random();

		var req = new Request( {method: 'get', url: '' + url,

			onSuccess: function(txt) {
				alert(txt);

				hideContact();

				//clear form
				var form = document.contactform;

				form.fullname.value = "Name";
				form.email.value = "Email";
				form.address.value = "Street Address";
				form.suburb.value = "Suburb";
				form.state.value = "State";
				form.postcode.value = "Postcode";
				form.phone.value = "Phone";
				form.existing.checked = false;
				form.message.value = "Message or enquiry";

			},

			onFailure: function() {
				alert("Error connecting to server. Please refresh this page...");
			}

		}).send(data);
	}

	//================================================================================================
	// Form functions
	//================================================================================================
	function submitSignUpNewsletter()
	{
		var form = document.contactform;

		var c_fullname = form.fullname.value;
		var c_email = form.email.value;
		var c_address = form.address.value.replace("Street Address", "");
		var c_suburb = form.suburb.value.replace("Suburb", "");
		var c_state = form.state.value.replace("State", "");
		var c_postcode = form.postcode.value.replace("Postcode", "");
		var c_phone = form.phone.value.replace("Phone", "");
		var c_existing = form.existing.checked;
		var c_message = form.message.value.replace("Message or enquiry", "");

		var valid = true;

		if ((c_fullname == "") || (c_fullname == "Full name"))
		{
			valid = false;
			alert("Please make sure you have entered your full name.");
		}
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(c_email)))
		{
			valid = false;
			alert("Please make sure you have entered a valid e-mail address.");
		}

		if (valid == true)
		{
			signupNewsletter(c_fullname, c_email, c_address, c_suburb, c_state, c_postcode, c_phone, c_existing, c_message);
		}
	}

	//================================================================================================
	// LAYOUT FUNCTIONS 
	//================================================================================================
	function showPopUp(block)
	{
		slideMenu.showMenu(block);
	}

	function hidePopUp(block)
	{
		slideMenu.hideMenu(block);
	}

	function resetMenuPositions()
	{
		var w = (window.getWidth() -920) / 2;

		if($chk($('aboutContainer')))
			$('aboutContainer').setStyle('left', (w + 145) + 'px');

		if($chk($('coursesContainer')))
			$('coursesContainer').setStyle('left', (w + 260) + 'px');

		if($chk($('trainingContainer')))
			$('trainingContainer').setStyle('left', (w + 375) + 'px');

		if($chk($('employerContainer')))
			$('employerContainer').setStyle('left', (w + 490) + 'px');

		if($chk($('studentContainer')))
			$('studentContainer').setStyle('left', (w + 605) + 'px');

		if($chk($('fixed_box')))
			$('fixed_box').setStyle('right', (w + 60) + 'px');
	}

	function hideContact()
	{
		$('container_contact').setStyle('display', 'none');
	}

	function showContact()
	{
		$('container_contact').setStyle('display', 'block');
	}

	function toggleContact(element)
	{
		if($('container_contact').getStyle('display') == "block")
		{
			hideContact();
		}
		else
		{
			//$('container_contact').setStyle('left', (parseInt($(element).getPosition().x) - 150) + 'px');
			showContact();
		}
	}

	//================================================================================================
	// EVENTS FUNCTIONS
	//================================================================================================
	function setupActions()
	{
		if ($chk($$('.nav_slide')))
		{
			$$('.nav_slide').addEvents({
				'mouseout' : function() {
					hidePopUp(this.getProperty('id'));
				},
				'mouseover' : function() {
					showPopUp(this.getProperty('id'));
				}
			});
		}

		if ($chk($$('.subnav')))
		{
			$$('.subnav').addEvents({

				'mouseover' : function(e) {
					this.setStyle('background-color', '#002355');
					this.setStyle('color', '#ffffff');
				},

				'mouseout' : function(e) {
					this.setStyle('background-color', '#ffffff');
					this.setStyle('color', '#333333');
				}

			});
		}

		if ($chk($$('.courses_nav_normal')))
		{
			$$('.courses_nav_normal').addEvents({

				'mouseover' : function(e) {
					this.setStyle('background-color', '#8c1414');
				},

				'mouseout' : function(e) {
					this.setStyle('background-color', '#999999');
				}

			});
		}

		if ($chk($$('.courses_nav_selected')))
		{
			$$('.courses_nav_selected').addEvents({

				'mouseover' : function(e) {
					this.setStyle('background-color', '#8c1414');
				},

				'mouseout' : function(e) {
					this.setStyle('background-color', '#002355');
				}

			});
		}
	}	

	function setupSlideshows()
	{
		if($chk($('masthead')))
			var homeShow = new Slideshow('masthead', false, {delay: 5000, width: 920, height: 255});

		if($chk($('news_slideshow')))
			fadeTicker('news_slideshow','slide_news', 10000, 1500);
	}

	//================================================================================================
	// START THIS WHEN PAGE DOM READY
	//================================================================================================
	window.addEvents({

		'domready' : function(e) {
			setupActions();
			setupSlideshows();
			resetMenuPositions();
			//applySiFR();
			//sfHover();
		},
		'resize' : function() {
			resetMenuPositions();
		}

	});

//-->