function cufonizer()
{
	Cufon.replace(".menu_st_item",{fontFamily:"mic32",fontWeight:"normal",hover:{color:'black'}});	
	Cufon.replace(".menu_user",{fontFamily:"mic32",fontWeight:"normal",hover:{color:'black'}});	

}
function ucfirst (str) {
    // Makes a string's first character uppercase  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/ucfirst    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: ucfirst('kevin van zonneveld');
    // *     returns 1: 'Kevin van zonneveld'    str += '';
    if(str=='eau')
    return 'EAU';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}
function validEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}
function valid_cautare()
{
	nume_h = document.getElementById('nume_hotel').value;
	eroare = 0;
	if(nume_h.length <= 2)
	{
		mesaj_eroare = 'Introduceti cel putin 3 caractere pentru cautare!';
		eroare = 1;
	}
	if(eroare == 1)
	{
		alert(mesaj_eroare);
		return false;
	}
}
function val_hotel_statiune2(id_form)
{
	arg = "hotel" + id_form;
	index_h = document.getElementById(arg).options.selectedIndex;
	eroare = 0;
	if(index_h == 0)
	{
		eroare = 1;
		mesaj_eroare = "Selectati un hotel";		
	}
	if(eroare == 1)
	{
		alert(mesaj_eroare);
		return false;
	}
}
function val_hotel_statiune()
{
	index_hotel = document.getElementById('hotel').options.selectedIndex;
	eroare = 0;
	if(index_hotel == 0)
	{
		eroare = 1;
		mesaj_eroare = "Selectati un hotel!";
	}
	if(eroare == 1)
	{
		alert(mesaj_eroare)
		return false;
	}
	
}
function get_hotels()
{				
	$.ajax({
          type: "GET",
          url: "http://teztour.ro/new/pub/php/genxml.php?regiunea="+$("#regiunea").val(),
          success: function(rasp){            		
                $("#hotel_layer").html(rasp);
                                                
          }
	});

}
function validEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}
function valid_newsletter()
{	
	//abonat_l = document.getElementById('abonat').checked;
	//dezabonat_l = document.getElementById('dezabonat').checked;
	turist_l = document.getElementById('turist').checked;
	agentie_l = document.getElementById('agentie').checked;
	email = document.getElementById('emails').value;
	eroare = 0;
	if(!validEmail(email))
	{
		eroare=1;
		mesaj_eroare = 'Emailul este invalid!';
	}
	if(turist_l == false && agentie_l == false)
	{
		eroare = 1;
		mesaj_eroare = 'Trebuie sa tipul de abonat!';
	}	
	if(eroare == 1)
	{
		alert(mesaj_eroare);
		return false;
	}
}
var site_path = "http://teztour.ro/tari/";
function put_links(tara)
{			
	linkuri = new Array();
	functii = new Array();
	index = 0;	
	linkuri[index] =  new Array();
	functii[index] = 'oferte_tez_tour';
	linkuri[index][0] = "Oferte Tez Tour";	
	if(tara == 'egipt' || tara == 'turcia')
	{
		linkuri[index++][1] = site_path+tara+"/oferte_tez_tour/preturi_standard/";
	}
	else
	{
		linkuri[index++][1] = site_path+tara+"/oferte_tez_tour";
	}
	if(tara == 'egipt' || tara == 'turcia')
	{
		linkuri[index] =  new Array();
		functii[index] = 'oferte_tez_tour/preturi_standard';
		linkuri[index][0] = "Preturi Standard";		
		linkuri[index++][1] = site_path+tara+"/oferte_tez_tour/preturi_standard/";	
		
		linkuri[index] =  new Array();
		functii[index] = 'oferte_tez_tour/oferte_speciale';
		linkuri[index][0] = "Oferte Speciale";		
		linkuri[index++][1] = site_path+tara+"/oferte_tez_tour/oferte_speciale/";	
		
		linkuri[index] =  new Array();
		functii[index] = 'oferte_tez_tour/early_booking';
		linkuri[index][0] = "Early Booking";		
		linkuri[index++][1] = site_path+tara+"/oferte_tez_tour/early_booking/";	
	}
	if(tara == 'egipt')
	{
		linkuri[index] =  new Array();
		functii[index] = 'croaziera_pe_nil';
		linkuri[index][0] = "Croaziera";		
		linkuri[index++][1] = site_path+tara+"/croaziera_pe_nil";	
	}
	if(tara == 'spania' || tara == 'turcia' || tara == 'egipt' || tara == 'bulgaria' || tara == 'eau' || tara == 'thailanda' || tara == 'austria')
	{
		linkuri[index] =  new Array();
		functii[index] = 'despre';
		linkuri[index][0] = "Despre " + ucfirst(tara);
		linkuri[index++][1] = site_path+tara+"/despre";
	}
	if(tara == 'spania' || tara == 'cuba' || tara == 'thailanda')
	{
		linkuri[index] =  new Array();
		functii[index] = 'info';
		linkuri[index][0] = "Info";
		linkuri[index++][1] = site_path+tara+"/info";
	}
	linkuri[index] =  new Array();
	linkuri[index][0] = "Cauta sejur";
	functii[index] = 'cauta_sejur';
	linkuri[index++][1] = site_path+tara+"/cauta_sejur";	
	linkuri[index] =  new Array();
	linkuri[index][0] = "Confirmare imediata";
	functii[index] = 'confirmare_imediata';
	linkuri[index++][1] = site_path+tara+"/confirmare_imediata";
	linkuri[index] =  new Array();
	linkuri[index][0] = "Catalog hoteluri";
	functii[index] = 'catalog_hoteluri';
	linkuri[index++][1] = site_path+tara+"/catalog_hoteluri";
	linkuri[index] =  new Array();
	linkuri[index][0] = "Stop Sales";
	functii[index] = 'stop_sales';
	linkuri[index++][1] = site_path+tara+"/stop_sales";		
	if(tara == 'turcia')     
	{
		linkuri[index] =  new Array();
		functii[index] = 'zboruri';	
		linkuri[index][0] = "Zboruri";
		linkuri[index++][1] = site_path+tara+"/zboruri";	
	}
	if(tara == 'turcia' || tara == 'egipt' || tara == 'eau' )         
	{
		linkuri[index] =  new Array();
		functii[index] = 'transferuri';
		linkuri[index][0] = "Transferuri";
		linkuri[index++][1] = site_path+tara+"/transferuri";	
	}
	
	linkuri[index] =  new Array();
	functii[index] = 'excursii';
	linkuri[index][0] = "Excursii";
	linkuri[index++][1] = site_path+tara+"/excursii";	
	
	linkuri[index] =  new Array();
	linkuri[index][0] = "Asigurare";
	functii[index] = 'asigurare';
	linkuri[index++][1] = site_path+tara+"/asigurare";	
	if(tara == 'turcia' || tara == 'egipt')
	{	
		linkuri[index] =  new Array();
		linkuri[index][0] = "Exclusivitati";
		functii[index] = 'exclusivitati';
		linkuri[index++][1] = site_path+tara+"/exclusivitati";	
		linkuri[index] =  new Array();
		functii[index] = 'recomandari';
		linkuri[index][0] = "Recomandari";
		linkuri[index++][1] = site_path+tara+"/recomandari";	
	}
	if(tara == 'turcia')
	{
		linkuri[index] =  new Array();
		functii[index] = 'proprietate';
		linkuri[index][0] = "Proprietate";		
		linkuri[index++][1] = site_path+tara+"/proprietate";	
		
		linkuri[index] =  new Array();
		functii[index] = 'preturi';
		linkuri[index][0] = "Preturi";		
		linkuri[index++][1] = site_path+tara+"/preturi";	
	}
	//meniul orizontal initial
	content = "<table style='margin:0px; border-collapse:collapse;height:60px'>";
	// meniul vertical
	content2 = "<span style='font-size:18px'><b>"+ucfirst(tara)+"</b></span><br/><br/>";
	for(i = 0; i < linkuri.length; i++)
	{
		target='_self';
		if(linkuri[i][0] == 'Confirmare imediata')
		{
			target = '_blank';
		}
		if(i % 6 == 0)
		{
			if(i != 0)
			{
				content+="</tr>";
			}
			content += "<tr>";
		}		
		content += "<td><a class='link_meniu_tari' style='text-decoration:none' target='"+target+"' href='"+linkuri[i][1]+"'> &bull;" + linkuri[i][0] + " </a></td>";
		content2 += "<div ";		
		nivel = 0;
		if(linkuri[i][0] == "Preturi Standard" || linkuri[i][0] == "Oferte Speciale" || linkuri[i][0] == "Early Booking")
		{
			nivel = 1;
		}
		if(  nivel == 1 && (link_curent != "oferte_tez_tour/preturi_standard" && link_curent != "oferte_tez_tour/oferte_speciale" && link_curent != "oferte_tez_tour/early_booking" ))
		{
			// ascund cele trei submeniuri
			content2 += "style='padding-left:10px;height:4px;display:none'";			
		}
		else
		{
			content2 += "style='height:4px;'";
		}
		
		content2 += "><a class='menu_st_item'";
		if(functii[i] == link_curent)
			content2 += " style='text-decoration:none; color:black;' ";
		else
			content2 += " style='text-decoration:none;' ";
		content2 += " target='"+target+"' href='"+linkuri[i][1]+"'>";
		if(nivel == 1)
		{
			content2 += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		}
		content2+="&bull;" + linkuri[i][0] + " </a></div>";
		if( nivel == 1 && (link_curent != "oferte_tez_tour/preturi_standard" && link_curent != "oferte_tez_tour/oferte_speciale" && link_curent != "oferte_tez_tour/early_booking" ))
		{
			
		}
		else
		{
			content2 += "<br/>";	
		}
		
			
	}
	content += "<table/>";		
	//document.getElementById('links_layer').innerHTML = content;	
	//document.getElementById('meniu_dr_nou').innerHTML = content2;
}
var on = true;
var tara_veche = "";
function toggle_div(tara)
{	
	//alert(tara + " | " + tara_veche);
	if(tara != tara_veche && tara_veche != "")
	{
		$('#meniu_tara').fadeIn('slow');
		 put_links(tara);
		 on = true;
		 document.getElementById('tara_'+tara).style.color = 'black';
		 document.getElementById('tara_'+tara_veche).style.color = '#39addf';
	}
	else
	{
		if(on == true)
		{
			$('#meniu_tara').fadeIn('slow');
			put_links(tara);	
			document.getElementById('tara_'+tara).style.color = 'black';					
		}
		else
		{
			$('#meniu_tara').fadeOut('slow');		
			document.getElementById('tara_'+tara).style.color = '#39addf';					
		}
	}
	if(on == true)
	{
		on = false;
	}
	else
	{
		on = true;
	}
	tara_veche = tara;
	
}
deschis = true;
function toggle_part()
{
	if(deschis)
	{
		$('#part_div').fadeIn('slow');
		deschis = false;
	}
	else
	{
		$('#part_div').fadeOut('slow');
		deschis = true;
	}
	
}
index_of = 1;
var id_oferta = 1;
var t;
function change_of(id,mod)
{			
	arg= "of" + id;
	document.getElementById(arg).className = 'oferta_activa';	
	arg2 = "oft"+id;
	document.getElementById(arg2).setAttribute('class','verdana18alb');
	for(i=1;i<=5;i++)
	{
		if(i != id)
		{			
			arg= "of" + i;
			document.getElementById(arg).className = 'oferta_inactiva';			
			arg2 = "oft" + i;
			document.getElementById(arg2).setAttribute('class','verdana18');
		}
	}		
	
	$("#dreapta_of").fadeOut('slow',function (){document.getElementById('dreapta_of').innerHTML = bgs[id];	$("#dreapta_of").fadeIn('slow');});			
		 				
	id_oferta = id;			
	if(mod == 'manual')
	{
		clearTimeout(t);
		id_oferta++;
		if(id_oferta == 6)
			if_oferta = 1;		
		t = setTimeout('toggle_banner()',5000);
	}
	return false;
}
function toggle_banner()
{	
	if(id_oferta >= 6)
		id_oferta = 1;	
	change_of(id_oferta,'automat');
	id_oferta++;	
	t = setTimeout('toggle_banner()',5000);			
	
} 



function valid_feed1()
{
	if($("#nume").val() == "")
	{
		 alert("Nu ati introdus numele.");
		 return false;
	}
	
	if($("#prenume").val() == "")
	{
		 alert("Nu ati introdus prenumele.");
		 return false;
	}
	
	var emailval = $("#email").val();
	var email_filter = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	
	if(emailval == "")
	{
		alert("Nu ati introdus adresa de email.")
		return false;
		
	}
	if(!email_filter.test(emailval))
	{
		alert("Adresa de email nu este valida.");
		return false;
	}
	
	if($("#hotel").val() == "")
	{
		 alert("Nu ati introdus hotelul.");
		 return false;
	}
	
	if($("#statiune").val() == "")
	{
		 alert("Nu ati introdus statiunea.");
		 return false;
	}
	
	if($("#agentia").val() == "")
	{
		 alert("Nu ati introdus agentia.");
		 return false;
	}
	
	
	if($("#opinie").val() == "")
	{
		 alert("Nu ati introdus opinia dvs.");
		 return false;
	}
	
	
	return true;
	
		
}
function valid_feed2()
{
	nume = $('[name=nume2]').val();	
	email = $('[name=email2]').val();	
	telefon = $('[name=telefon]').val();	
	agentie = $('[name=agentie2]').val();
	oras = $('[name=oras]').val();
	pozitie = $('[name=pozitie]').val();
	s1 = $('[name=seminar1]').attr('checked');
	s2 = $('[name=seminar2]').attr('checked');
	s3 = $('[name=seminar3]').attr('checked');	
	s4 = $('[name=seminar3]').attr('checked');	
	eroare = false;	
	if(s1 != true && s2 != true && s3 != true && s4 != true)
	{
		eroare = true;
		mesaj_eroare = "Trebuie sa optati pentru cel putin un seminar!";
	}
	else if(nume.length == 0)	
	{
		eroare = 1;
		mesaj_eroare = "Introduceti numele dumneavoastra!";
	}	
	else if(agentie.length == 0)	
	{
		eroare = 1;
		mesaj_eroare = "Introduceti numele agentiei pe care o reprezentati!";
	}	
	else if(oras.length == 0)	
	{
		eroare = 1;
		mesaj_eroare = "Introduceti orasul agentiei pe care o reprezentati!!";
	}
	else if(pozitie.length == 0)	
	{
		eroare = 1;
		mesaj_eroare = "Introduceti calitatea in care reprezentati agentia!";
	}
	else if(!validEmail(email))	
	{
		eroare = 1;
		mesaj_eroare = "Introduceti un email valid!";
	}
	else if(telefon.length == 0)	
	{
		eroare = 1;
		mesaj_eroare = "Introduceti un numar de telefon!";
	}
	if(eroare == true)
	{
		alert(mesaj_eroare);
		return false;
	}
	
}
function fill_cod_secret()
{	
	document.getElementById('cod_secret').value = '123!@456$%^';
}
function valid_fii_partener()
{
	nume = $('[name=persoana_contact]').val();	
	email = $('[name=email]').val();	
	telefon = $('[name=telefon]').val();	
	agentie = $('[name=nume_agentie]').val();
	mesaj = $('[name=mesaj]').val();
	eroare = 0;
	if(agentie == "")
	{
		eroare = 1;
		mesaj_eroare = "Introduceti numele agentiei de turism.";
	}
	else if (!validEmail(email))
	{
		eroare = 1;
		mesaj_eroare = "Introduceti un email valid!";
	}
	else if (telefon == "")
	{
		eroare = 1;
		mesaj_eroare = "Introduceti un numar de telefon."
	}
	else if(nume == "")
	{
		eroare = 1;
		mesaj_eroare = "Introduceti numele persoanei de contact.";
	}
	else if(mesaj == "")
	{
		eroare = 1;
		mesaj_eroare = "Introduceti mesajul dumneavoastra.";
	}
	if (eroare == 1)
	{
		alert(mesaj_eroare);
		return false;
	}
	
}
function citeste_mai_mult(id)
{
	target = "descriere" + id;
	target_div = document.getElementById(target);
	$.ajax({
          type: "GET",
          url: "http://teztour.ro/pub/php/get_descriere_statiune.php?statiune="+id,
          success: function(rasp){            		          		
                target_div.innerHTML = rasp;
                                                
          }
	});
}
function change_img(div_src,folder)
{
	content = "<a onmouseout='change_img2(\""+div_src+"\",\""+folder+"\")' href='http://teztour.ro/register'><img src='http://teztour.ro/pub/js/"+folder+"/index_files/ebbtcbindex1_1.gif'  /></a>";
	document.getElementById(div_src).innerHTML = content;
}
function change_img2(div_src,folder)
{
	content = "<a onmouseover='change_img(\""+div_src+"\",\""+folder+"\")' href='http://teztour.ro/register'><img src='http://teztour.ro/pub/js/"+folder+"/index_files/ebbtcbindex1_0.gif'  /></a>";
	document.getElementById(div_src).innerHTML = content;
}
/*
var index_banner_home = 0;
var images_banner = new Array();
images_banner[0] = "spania-Destinatie-noua.jpg";
images_banner[1] = "Turcia-Super-oferta.jpg";
var tariz = new Array();
tariz[0] = "spania";
tariz[1] = "turcia";
var content = "";
function rotate_banner_home()
{
	//alert(index_banner_home);
	images_path = "http://teztour.ro/new/pub/img/bannere/";
	content = "<a href='http://teztour.ro/tari/"+tariz[index_banner_home]+"/oferte_tez_tour/'><img src='" + images_path + images_banner[index_banner_home] + "' /></a>";

	$('#bannere_tari').fadeOut('slow', function(){$('#bannere_tari').html(content); $('#bannere_tari').fadeIn('slow');})
	index_banner_home++;	
	setTimeout('rotate_banner_home()', 5000);
	if(index_banner_home == 2)
		index_banner_home = 0;
}
*/
