//oxyk 2009

var form = $('contact');


$('Email').onfocus = function() {
$temp = $('Email').value;
if ($temp == 'Email') this.clear();
};

$('Email').onblur = function() {
$temp = $('Email').value;
if ($temp == '') this.value = 'Email';
};

$('Name').onfocus = function() {
$temp = $('Name').value;
if ($temp == 'Name') this.clear();
};

$('Name').onblur = function() {
$temp = $('Name').value;
if ($temp == '')  {
$('Name').value = 'Name';
}

};


$('Phone').onfocus = function() {
$temp = $('Phone').value;
if ($temp == 'Phone (numbers only)') this.clear();
};

$('Phone').onblur = function() {
$temp = $('Phone').value;
if ($temp == '') this.value = 'Phone (numbers only)';
};


$('Comments').onfocus = function() {
$temp = $('Comments').value;
if ($temp == 'Question or Comments') {
	this.clear();
	//$('Comments').classNames().inspect();
	//$('Comments').className = 'required validation-failed';
}
};

$('Comments').onblur = function() {
$temp = $('Comments').value;
if ($temp == '') { 
	this.value = 'Question or Comments';
	//$('Comments').classNames().inspect();
	//$('Comments').className = 'required validation-failed';
	
}
};



okfunc = function(){
//$('forma').hide();

window.location.href = "thankyou.htm";
//window.open ("thankyou.htm", "mywindow","menubar=1,resizable=1,width=400,height=250");

//$('roma').update('<b>Thank you!</b><br /><br /><br />');
//$('roma').innerHTML;
};



function formCallback(result, form) {

//check what's in the fields


//if ($F(form['Comments']) == 'Question or Comments') {

//$('Comments').classNames().inspect();
//$('Comments').className = 'required validation-failed';

//}



if (true == result){

//kick it
new Ajax.Updater('roma', 'contact_process.php', {asynchronous:true, parameters:Form.serialize('contact'), evalScripts:true});
return true;
}

}


var valid = new Validation('contact', {immediate:true, useTitles:true, onFormValidate : formCallback});
