// JavaScript Document
function bookmarksite(){
var url = window.location;
var title = 'Lake Annecy Offer';
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}


var initialsubj="Hay buddy, take a look at this"
var initialmsg="Hi:\n You may want to check out this site: "+window.location
var good;
function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.email);
if (good) {

//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
   }
}

function validateFormContact(form)
{
var sir, i, tmp
	if ( document.getElementById("name").value == "" ){
		alert ("Please complete the name!" );
		document.getElementById("name").focus();
		return false;	
	}	
		
	if ( document.getElementById("message").value == "" ){
		alert ("Please complete the message!" );
		document.getElementById("message").focus();
		return false;	
	}	
	return true;
}

function verificaEmail(obj){
//start verificare email
var sir, i, tmp
	sir = obj.mail.value;
	//caut @ dupa primul caracter
	tmp = sir.indexOf("@", 1);
	if (tmp == -1) {
		alert("Your email address is not valid !");
        obj.mail.focus()
		return false;
	}
    //caut . dupa @
	tmp = sir.indexOf(".", (tmp+1) );
	if (tmp == -1) {
		alert("Your email address is not valid!");
        obj.mail.focus()
		return false;
	}
    //verific daca sunt cel putin 2 caractere dupa .
	tmp = sir.substr(tmp+1, (sir.length-1-tmp) );
	if (tmp.length<2) {
		alert("Your email address is not valid !");
        obj.mail.focus()
		return false;
	}
//end verificare email	
return true
}

function validateForm(obj){
	//start verificare email
var sir, i, tmp
	sir = obj.email.value;
	//caut @ dupa primul caracter
	tmp = sir.indexOf("@", 1);
	if (tmp == -1) {
		alert("Your email address is not valid !");
        obj.email.focus()
		return false;
	}
    //caut . dupa @
	tmp = sir.indexOf(".", (tmp+1) );
	if (tmp == -1) {
		alert("Your email address is not valid !");
        obj.email.focus()
		return false;
	}
    //verific daca sunt cel putin 2 caractere dupa .
	tmp = sir.substr(tmp+1, (sir.length-1-tmp) );
	if (tmp.length<2) {
		alert("Your email address is not valid !");
        obj.email.focus()
		return false;
	}
//end verificare email	
	if ( document.getElementById("password").lenght.value < 6 ){
		alert ("Please fill Password!" );
		document.getElementById("password").focus();
		return false;	
	}
	if ( document.getElementById("firstname").value == "" ){
		alert ("Please fill Firstname!" );
		document.getElementById("firstname").focus();
		return false;	
	}
	if ( document.getElementById("lastname").value == "" ){
		alert ("Please fill Lastname!" );
		document.getElementById("lastname").focus();
		return false;	
	}
	if ( document.getElementById("country").value == "" ){
		alert ("Please fill Country!" );
		document.getElementById("country").focus();
		return false;	
	}
return true
}
