window.addEvent('domready', function(){
	
//alert('sdfsdf');	
	 //Cycle menu, and highlight where appropriate
    var MenuItems = $("menu").getFirst().getChildren("li");

    var urlArray = document.location.toString().split("/");


    if (urlArray.length == 3 || urlArray[3] == "" || urlArray[3] == "Default.aspx") {
        //Highlight home page link
        var firstLink = MenuItems[0].getFirst();

        firstLink.setStyle("background", "url(/Resources/images/menuBg.png)");
        firstLink.setStyle("background-repeat", "repeat-x");
        firstLink.setStyle("background-position", "top");
    }
   
    MenuItems.each(function(e, i, a) {
        //alert(e.getFirst().getProperty("href"));
        var urlArrayLink = e.getFirst().getProperty("href").split("/");

        if (urlArrayLink.length > 3) {
            if (urlArrayLink[3].toLowerCase() == urlArray[3].toLowerCase()) {
                // Highlight e (the li) as link)
                var linkitem = e.getFirst();

                linkitem.setStyle("background", "url(/Resources/images/menuBg.png)");
                linkitem.setStyle("background-repeat", "repeat-x");
                linkitem.setStyle("background-position", "top");
            }
        }
    });

		$("Message").addEvent("focus", function()
	 {
		 if ($("Message").getProperty("value") == "Message *")
		 {
			$("Message").setProperty("value", "");
		 }
	 });
	
	 $("Message").addEvent("blur", function()
	 {
		 if ($("Message").getProperty("value") == "")
			{
			 $("Message").setProperty("value", "Message *");
			}
	 });
	
	
	
	$("contactEmail").addEvent("focus", function()
	 {
		 if ($("contactEmail").getProperty("value") == "Email Address *")
		 {
			$("contactEmail").setProperty("value", "");
		 }
	 });
	
	 $("contactEmail").addEvent("blur", function()
	 {
		 if ($("contactEmail").getProperty("value") == "")
			{
			 $("contactEmail").setProperty("value", "Email Address *");
			}
	 });




	$("contactNo").addEvent("focus", function()
	 {
		 if ($("contactNo").getProperty("value") == "Contact No *")
		 {
			$("contactNo").setProperty("value", "");
		 }
	 });
	
	 $("contactNo").addEvent("blur", function()
	 {
		 if ($("contactNo").getProperty("value") == "")
			{
			 $("contactNo").setProperty("value", "Contact No *");
			}
	 });


$("Address").addEvent("focus", function()
	 {
		 if ($("Address").getProperty("value") == "Address *")
		 {
			$("Address").setProperty("value", "");
		 }
	 });
	
	 $("Address").addEvent("blur", function()
	 {
		 if ($("Address").getProperty("value") == "")
			{
			 $("Address").setProperty("value", "Address *");
			}
	 });
	
	

	$("fullName").addEvent("focus", function()
	 {
		 if ($("fullName").getProperty("value") == "Full Name *")
		 {
			$("fullName").setProperty("value", "");
		 }
	 });
	
	 $("fullName").addEvent("blur", function()
	 {
		 if ($("fullName").getProperty("value") == "")
			{
			 $("fullName").setProperty("value", "Full Name *");
			}
	 });


	$('contactUsSubmit').addEvent("click", function()
	{
		return ValidateForm();
	});
 });
	
//Form validation starts here 

function ValidateForm()
{
var msg = "";
//alert(msg);
 
   if ($("Message").getProperty("value") == "Message *" || $("Message").getProperty("value") == "")
 {

 $("Message").focus();
 $("Message").morph({ "background-color": ["#993366", "#ffffff"] });
 msg = msg + "You must enter your name\n"
 }
 
 
 
 
 
 if ($("contactEmail").getProperty("value") == "Email Address *" || $("contactEmail").getProperty("value") == "")
 {

 $("contactEmail").focus();
 $("contactEmail").morph({ "background-color": ["#993366", "#ffffff"] });
 msg = msg + "You must enter your name\n"
 }
 
 
 
 if ($("contactNo").getProperty("value") == "Contact No *" || $("contactNo").getProperty("value") == "")
 {

 $("contactNo").focus();
 $("contactNo").morph({ "background-color": ["#993366", "#ffffff"] });
 msg = msg + "You must enter your name\n"
 }
 
 
 if ($("Address").getProperty("value") == "Address *" || $("Address").getProperty("value") == "")
 {

 $("Address").focus();
 $("Address").morph({ "background-color": ["#993366", "#ffffff"] });
 msg = msg + "You must enter your name\n"
 } 
 
if ($("fullName").getProperty("value") == "Full Name *" || $("fullName").getProperty("value") == "")
 {

 $("fullName").focus();
 $("fullName").morph({ "background-color": ["#993366", "#ffffff"] });
 msg = msg + "You must enter your name\n"
 }
  if (msg.length > 0)
 {
 //alert(msg);
 return false;
 }

 return true;
} 





