var oName, oEmail, oPhone, oEnquiry, oForm

function trim(str) 
{
	if (str == null) {return ''}
	return str.replace(/(^\s+)|(\s+$)/g,"");
}

function isValidEmail(str) {   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); }


function extras()
{
	var spnEmail = document.getElementById("spnEmail");
	spnEmail.innerHTML = "<img src='images/email.gif' /><a class='email' href='mailto:studio@whitelightproduction.com' title='Email'>studio@whitelightproduction.com</a>";

		oName = document.getElementById("txtName");
		oEmail = document.getElementById("txtEmail");
		oPhone = document.getElementById("txtPhone");
		oEnquiry = document.getElementById("txaEnquiry");

	if(is_ie)
	{
		oName.onfocus = Hi_txtName; oName.onblur = Lo_txtName;
		oEmail.onfocus = Hi_txtEmail;	oEmail.onblur = Lo_txtEmail;
		oPhone.onfocus = Hi_txtPhone; 	oPhone.onblur = Lo_txtPhone;
		oEnquiry.onfocus = Hi_txaEnquiry;	 oEnquiry.onblur = Lo_txaEnquiry;
	}

	oForm = document.getElementsByTagName("FORM")[0];
	oForm.onsubmit = returnCheck;


} 

function returnCheck()
{
	if(trim(oName.value)=='')
	{
		alert("Please type in your Name");
		oName.focus();
		return false;
	}

	if(!isValidEmail(oEmail.value))
	{
		alert("Please use a valid Email");
		oEmail.focus();
		return false;
	}

	if(trim(oEnquiry.value)=='')
	{
		alert("Please type in your Message");
		oEnquiry.focus();
		return false;
	}
}

/* hi and lo already defined, so changing to Hi, Lo */

function Hi(obj)
{
	obj.style.background = "#ddd none";
	obj.style.color = "#333";
	obj.style.borderLeft = "1px solid #f6f";
	obj.style.borderRight = "2px solid #86f";
	obj.style.borderTop = "1px solid #66c";
	obj.style.borderBottom = "1px solid #66f";
}

function Lo(obj)
{
	obj.style.background = "#C4C3CC -50px 0 url(../images/input.png) repeat-y";
	obj.style.color = "#000";
	obj.style.borderLeft = "1px solid #858";
	obj.style.borderRight = "2px solid #99c";
	obj.style.borderTop = "1px solid #66f";
	obj.style.borderBottom = "1px solid #ccf";
}


function Hi_txtName() { Hi(oName) } function Lo_txtName() { Lo(oName) }
function Hi_txtEmail() { Hi(oEmail) } function Lo_txtEmail() { Lo(oEmail) }
function Hi_txtPhone() { Hi(oPhone) } function Lo_txtPhone() { Lo(oPhone) }
function Hi_txaEnquiry() { Hi(oEnquiry) } function Lo_txaEnquiry() { Lo(oEnquiry) }

/* In future add script for :

- Validation

*/
