// This file will contain the JavaScript code for the home page (index.php) and other related pages //

/*
File Name: scripts.js
Date: 3/06/08
Programmer: Greg Blaisdell
*/

function checkPassword()
{
  // loads the URL into a variable
  var url = window.location.href;

  // Splits the url by the ?
  var qparts = url.split("?");

  // Then find the querystring, everything after the ?
  var query = qparts[1];
    
  	// Check if the correct password
    if (query != "smile")
    {
    // promptPassword
	promptPassword();
    }
}

// Password Protection popup

function promptPassword()
{
	var passWord;
	passWord = prompt("This page is under construction. If you are the administrator, please enter the Password: ","");

    if(passWord=="smile")
		{
	location="index.php?smile";
	
		}

    else
    	{
	alert("Invalid Password");
	location="wrongPassword.html";
		}
}

	var myrules = {
		'a' : function(element){
			element.onclick = function(){
				// Your onclick event goes here - eg;
				location="wrongPassword.html";
				return false;
			}
		}
	};

//Behaviour.register(myrules);