
function OnLanguageChange( lang_id )
{
//	alert( "Language ID: " + lang_id );
	var dtExpire	= new Date();
	dtExpire.setTime ( dtExpire.getTime() + 2592000);
	document.cookie = "CurrentLanguage" + "=" + lang_id + "; expires=" + dtExpire.toGMTString();
	//Load ( top.Data.location.href , "top.Data" );
	document.location.reload();
}

function login( login_form_action )
{
	var error="";
	if (document.login_form.user.value == "")
		error+="Introduceti userul de administrare ! \n";
	if (document.login_form.passwd.value == "")
		error+="Introduceti parola! ";
	if (error == "")
	{
		//document.login_form.action="admin/login.php";
		document.login_form.action=login_form_action;
		document.login_form.submit();
	}
	else
		alert (error);
}

function events_validation ()
{
	var error = "";
	if ( '' == document.form_adauga_eveniment.titlu.value )
		error += "Introduceti titlul evenimentului ! \n";

	if ( '' == document.form_adauga_eveniment.data.value )
		error += "Introduceti data evenimentului ! \n";

	
	if (error == "")
	{
		return true;
	}
	else
	{
		alert (error);
		return false;
	}
}

function news_validation ()
{
	var error = "";
	if ( '' == document.form_adauga_news.titlu.value )
		error += "Introduceti titlul noutatii ! \n";

	if ( '' == document.form_adauga_news.data.value )
		error += "Introduceti data noutatii ! \n";

	
	if (error == "")
	{
		return true;
	}
	else
	{
		alert (error);
		return false;
	}
}

function mag_validation ()
{
	var error = "";
	if ( '' == document.form_adauga_magazin.titlu.value )
		error += "Introduceti titlul magazinului ! \n";

	
	if (error == "")
	{
		return true;
	}
	else
	{
		alert (error);
		return false;
	}
}



function valid( valid_text )
{	
	return confirm( valid_text );
}


function password_validation ()
{
	error = "";
	if ( document.form1.old_password.value == "" )
		error += "Introduceti parola veche !\n";
	if ( document.form1.new_password.value == "" )
		error += "Introduceti parola noua !\n";
	if ( document.form1.c_password.value == "" )
		error += "Confirmati parola noua !\n";
	if ( document.form1.new_password.value != "" && document.form1.new_password.value != document.form1.c_password.value )
		error += "Parola noua si confirmarea parolei nu sunt egale. Introduceti din nou!'\n";

	if (error == "")
	{
		return true;
	}
	else
		alert (error);
		return false;
}


function open_popup( url )
{
	var x = (screen.width-1015)/2;
	var y = (screen.height-709)/2;
	var popup=window.open(url, "window1","toolbar=0,location=0,status=0,left="+x+",top="+y+",menubar=0,scrollbars=0 resizable=0,width=1015,height=709");

	if ( window.focus ) 
	{
		popup.focus()
	}

	return false;
}


function formCtrl(form){
		azi=form.dateLeavingYear.value+form.dateLeavingMonth.value+form.dateLeavingDay.value;
		maine=form.dateReturningYear.value+form.dateReturningMonth.value+form.dateReturningDay.value;
			
		if (   azi>maine  )
		{
			alert('The check in date must be prior to the check out date.');
			return;
		}
		
		if (   azi <  2007810  )
		{
			alert('The soonest check in date can be tomorrow');
			return;
		}
		
		form.submit();
	}


	function Check(obiect){
		ok=0;
		var selectul=eval(obiect).nr_camere;
		for (formIndex = 0; formIndex < selectul.length; formIndex++)
		{
			if (selectul[formIndex].value!=0)
			{
				ok=1;
			}
		}
		if (ok==0){
			alert("Please select one or more rooms you want to book.");
		}else{
			eval(obiect).submit();
		}
		
	}
