$(document).ready(function() { 
	$('#image_rotate').innerfade({ 
		speed: 'slow', 
		timeout: 3000, 
		type: 'random', 
		containerheight: '250px'
	});
});




function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld.value == "") {
        fld.style.background = '#ffdecc'; 
        error = "1";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = '#ffdecc'; 
        error = "1";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#ffdecc'; 
        error = "1";
    } else {
        fld.style.background = 'White';
    }
    return error;
}






function validateEmpty(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = '#ffdecc'; 
        error = "1"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateFormOnSubmit2(theForm) {
var reason = "";

  reason += validateEmpty(theForm.e1x);
  reason += validateEmail(theForm.e2x);
  reason += validateEmpty(theForm.e3x);

  
  
      
  if (reason != "") {
    return false;
  }
  return true;
}



function validateFormOnSubmit(theForm) {
var reason = "";

  reason += validateEmpty(theForm.f1);
  reason += validateEmpty(theForm.f2);
  reason += validateEmpty(theForm.f8);
  reason += validateEmail(theForm.f10);

  
      
  if (reason != "") {
    return false;
  }
  return true;
}



//function goUp(){
//	alert("123");
//  //$('#dialog').jqm();
//}



