var isMac = (navigator.userAgent.indexOf("Macintosh") != -1);
var isWin = (navigator.userAgent.indexOf("Windows 95") != -1 || navigator.userAgent.indexOf("Windows NT") != -1);
var isNS =  (navigator.appName == "Netscape");
var isIE =  (navigator.userAgent.indexOf("MSIE") != -1);
var ieWin = (navigator.userAgent.indexOf("MSIE") != -1 && (navigator.userAgent.indexOf("Windows 95") != -1 || navigator.userAgent.indexOf("Windows NT") != -1));


function ValidateForm(){
	//verify the 2 form fields

	//make sure that the first name is not blank.
	if (document.demo_account_form.first_name.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti prenumele dumneavoastra");
		document.demo_account_form.first_name.focus();
		//and return false so the form doesn't get submitted
		return false;
	}
		
	//make sure that the last name field is not blank.
	if (document.demo_account_form.last_name.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti numele dumneavoastra");
		document.demo_account_form.last_name.focus();
		//and return false so the form doesn't get submitted
		return false;
	}

	//make sure that the address_1 field is not blank.
	if (document.demo_account_form.address_1.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti adresa dumneavoastra");
		document.demo_account_form.address_1.focus();
		//and return false so the form doesn't get submitted
		return false;
	}

	//make sure that the city field is not blank.
	if (document.demo_account_form.city.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti localitatea dumneavoastra");
		document.demo_account_form.city.focus();
		//and return false so the form doesn't get submitted
		return false;
	}

	//make sure that the state field is not blank.
	if (document.demo_account_form.state.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti judetul dumneavoastra");
		document.demo_account_form.state.focus();
		//and return false so the form doesn't get submitted
		return false;
	}

	//make sure that the zip field is not blank.
	if (document.demo_account_form.zip.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti codul dumneavoastra postal");
		document.demo_account_form.zip.focus();
		//and return false so the form doesn't get submitted
		return false;
	}

	//make sure that the country field is not blank.
	if (document.demo_account_form.country.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti tara dumneavoastra");
		document.demo_account_form.country.focus();
		//and return false so the form doesn't get submitted
		return false;
	}
	
	//make sure that the phone field is not blank.
	if (document.demo_account_form.phone.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti numarul dumneavoastra de telefon");
		document.demo_account_form.phone.focus();
		//and return false so the form doesn't get submitted
		return false;
	}
	
	//make sure that the email field is not blank.
	if (document.demo_account_form.email.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam introduceti adresa dumneavoastra de e-mail");
		document.demo_account_form.email.focus();
		//and return false so the form doesn't get submitted
		return false;
	}

	//make sure that the 2nd email field is not blank.
	if (document.demo_account_form.email2.value.length == 0)  {
		//it isn't so show the user an alert and go to that field
		alert ("Va rugam confirmati adresa dumneavoastra de e-mail");
		document.demo_account_form.email2.focus();
		//and return false so the form doesn't get submitted
		return false;
	}
	

	//make sure that the email addresses match
	if (document.demo_account_form.email.value != document.demo_account_form.email2.value)
	{
		//it isn't so ask the user to check their email
		alert ("Adresa dumneavoastra de e-mail nu se potriveste cu confirmarea");
		document.demo_account_form.email.focus();
		//and return false so the form doesn't get submitted
		return false;
	}			
	
	//everything checks out, submit the form
	return true;
}

function openTour(){
	window.open('http://www.forex.com/tour/index.html', 'new', 'toolbar=no, scrolling=no, width=625, height=580');
}
