function validare(f){
	if(f.ce.value.length<3 && f.ce.value != ""){
		alert("Va rugam sa introduceti cuvinte cu lungimea mai mare de doua caractere.");
		return false;
	}else if(f.unde.value.length<3 && f.unde.value != ""){
		alert("Va rugam sa introduceti cuvinte cu lungimea mai mare de doua caractere.");
		return false;
	}else if(f.ce.value == "" && f.unde.value == ""){
		alert("Va rugam sa introduceti cel putin un criteriu de caractere.");
		return false;
	}else if(f.ce.value=="Cautare obiective" && f.unde.value=="Cautare strazi"){
		alert("Va rugam sa introduceti cel putin un criteriu de caractere.");
		return false;
	}
	
	return true;
}
// -->
////////////////

var s_start = null;
var s_end = null;

var start_value = null;
var end_value = null;

var cate_start = 0;
var cate_end = 0;

function m_over(cine){
	cine.style.background = '#D8F3FA';
}
function m_out(cine){
	if(cine != s_start && cine != s_end){
		cine.style.background = 'none';
	}
}
function selectat(ce,ix,iy,cine){
	if(ce == "start"){
		for(i = 0; i<cate_start; i++){
			document.getElementById("s_"+i).style.background = 'none';
		}
		cine.style.background = '#D8F3FA';
		s_start = cine;
		start_value = new VELatLong(ix,iy);
	}else{
		for(j = 0; j<cate_end; j++){
			document.getElementById("e_"+j).style.background = 'none';
		}
		cine.style.background = '#D8F3FA';
		s_end = cine;
		end_value = new VELatLong(ix,iy);
	}
	if(start_value != null && end_value != null){
		GetRouteMap(start_value,end_value);
	}
}


function validareaa(f){
	if(f.start.value.length<3 || f.end.value.length<3){
		alert('Criteriile de cautare trebuie sa aibe cel putin 3 caractere.');
		return false;
	}
}

var isIE = document.all ? true : false;

document.onmousemove = getMousePosition;
var posX;
var posY;

function getMousePosition(e) {
	var _x;
	var _y;
	if (!isIE) {
		_x = e.pageX;
		_y = e.pageY;
	}
	if (isIE) {
		_x = event.clientX + document.body.scrollLeft;
		_y = event.clientY + document.body.scrollTop;
	}
	posX = _x;
	posY = _y;
	return true;
}

function close_login(){
	document.getElementById('login').style.display = "none";
}

function show_login(){
	var l_div = document.getElementById('login');
	l_div.style.display = "block";
	
	l_div.style.left = parseInt(parseInt(posX)-parseInt(l_div.getW()))+"px";
	l_div.style.top = posY+"px";
}

function validare_(f,require){
	a = require.split(",");
	for(i=0;i<a.length;i++)
	if(f.elements[a[i]].value=="" && (f.elements[a[i]].type=="text" || f.elements[a[i]].type=="password" )){
		alert("Va rugam sa completati campurile marcate cu steluta..");
		f.elements[a[i]].focus();
		return false;
	}
	if(f.password.value!=f.password2.value){
		alert("Cele doua parole nu coincid!");
		return false;
	}
	if(!isEmail(f.email.value)){
		alert("Va rugam sa introduceti o adresa de email valida!");
		return false;
	}
}

function validare2_(f,require){
	a = require.split(",");
	for(i=0;i<a.length;i++){
		if(f.elements[a[i]].value=="" && (f.elements[a[i]].type=="text" || f.elements[a[i]].type=="password" )){
			alert("Va rugam sa completati campurile marcate cu steluta..");
			f.elements[a[i]].focus();
			return false;
		}
	}
	if(f.parent_id.options[f.parent_id.selectedIndex].value == "0"){
		alert("Va rugam sa alegeti categoria!");
		return false;
	}
}

function isEmail(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		  
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		     return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   
		    return false
		 }

 		 return true					
	}
	
function validare_contact(f){
	if(f.nume.value == ""){
		alert("Va rugam sa completati numele dvs.");
		f.nume.focus();
		return false;
	}
	if(f.email.value == ""){
		alert("Va rugam sa completati adresa de email.");
		f.email.focus();
		return false;
	}
	if(f.mesaj.value == ""){
		alert("Va rugam sa completati campul mesaj.");
		f.mesaj.focus();
		return false;
	}
	if(!isEmail(f.email.value)){
		alert("Va rugam sa introduceti o adresa de email valida.");
		f.email.focus();
		return false;
	}
}
/*
height:354px;
top:-354px;
*/

var state = 1;

var initH = "830px";
var initT = "-530px";
function hide_blurb(e,elem,divBtn,cont){
	var bb = document.getElementById(elem);
	if(elem == "blurb"){
		if(state == 1){
			bb.style.height = "20px";
			bb.style.top = "-20px";
			bb.style.overflow = "hidden";
			state = 2;
			e.src = "images/hide2.png";
			
		}else{
			bb.style.height = "354px";
			bb.style.top = "-354px";
			bb.style.overflow = "";
			state = 1;
			e.src = "images/hide.png";
		}
	}else{
		if(state == 1){
			
			state = 2;
			
			bb.style.height = "20px";
			bb.style.top = "-20px";
			e.src = "images/hide2.png";
			document.getElementById(cont).style.display = "none";
			bb.style.overflow = "hidden";
			
		}else{
			state=1;
				
			bb.style.height = initH;
			bb.style.top = initT;
			e.src = "images/hide.png";
			document.getElementById(cont).style.display = "block";
		}
	}
}

