function validateUser(thisObj){

  if(thisObj.Firstname.value==''){
  	alert('Please type users firstname!');
  	thisObj.Firstname.focus();
  	return false;
  }
  if(thisObj.Lastname.value==''){
  	alert('Please type users lastname!');
  	thisObj.Lastname.focus();
  	return false;
  }
  if(thisObj.email.value==''){
  	alert('Please type your email address!');
  	thisObj.email.focus();
  	return false;
  }
  if(thisObj.username.value==''){
  	alert('Please type username!');
  	thisObj.username.focus();
  	return false;
  }
  if(thisObj.password.value==''){
  	alert('Please type password!');
  	thisObj.password.focus();
  	return false;
  }
  if((thisObj.password.value.length<4)||(thisObj.password.value.length>12)){
  	alert('Password must be minimum 4 characters and maximum 12 characters!');
  	thisObj.password.focus();
  	return false;
  }
  if(thisObj.password.value!=thisObj.repassword.value){
  	alert('Passwordfields do NOT match! Please type again!');
	thisObj.password.value = '';
	thisObj.repassword.value = '';
  	thisObj.password.focus();
  	return false;
  }
  var illegalChars = /[\W_]/; 
  if(illegalChars.test(thisObj.password.value)) {
    alert('The password contains illegal characters.');
	thisObj.password.value = '';
	thisObj.repassword.value = '';
  	thisObj.password.focus();
	return false;
  }
  
  if(!thisObj.agree.checked){
  	alert('Make sure you read and agrees with our member user agreement!');
  	return false;
  }


  return true;
}


function validateUpload(thisObj){

  if(thisObj.headline.value==''){
  	alert('Please type a photo headline!');
  	thisObj.headline.focus();
  	return false;
  }
  if(thisObj.desc.value==''){
  	alert('Please type a description!');
  	thisObj.desc.focus();
  	return false;
  }

  uploadFile1 = thisObj.file1.value;
  ext=uploadFile1.substr(uploadFile1.lastIndexOf(".")).toLowerCase();
	if (ext!=".jpeg"&&ext!=".jpg") {
		thisObj.file1.select();
		alert("You can only upload .jpg images!");
		return false;
  }
	
  if(!thisObj.agree.checked){
  	alert('Make sure you read and agrees the the terms of use!');
  	return false;
  }

  return true;
}



function validateTown(thisObj){

  if(thisObj.townname.value==''){
  	alert('Please type a town name!');
  	thisObj.townname.focus();
  	return false;
  }

  return true;
}


function openWindow(doc, myTitle, myWidth, myHeight)
{
    if((myWidth == "") || (myHeight == ""))
    {
        myWidth = 300;
        myHeight = 300;
    }

    var easyPeazy = window.open(doc,myTitle,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=" + myWidth + ",height=" + myHeight + "");
    easyPeazy.focus();
	return false;
}

function deleteOk(){
	if (confirm('Note! This action can NOT be undone! Are you sure you want to completely delete this photo?')){
	return true;
	}else{
	return false;
	}
}



function validateContact(thisObj){

  if(thisObj.name.value==''){
  	alert('Please type your name!');
  	thisObj.name.focus();
  	return false;
  }
  if(thisObj.email.value==''){
  	alert('Please type your email address!');
  	thisObj.email.focus();
  	return false;
  }
  if(thisObj.subject.value==''){
  	alert('Please type your email address!');
  	thisObj.subject.focus();
  	return false;
  }
  if(thisObj.msg.value==''){
  	alert('Please type a message!');
  	thisObj.msg.focus();
  	return false;
  }

  return true;
}

