var nv = (navigator.appName.indexOf("Netscape") != -1) || window.opera;

function initSettings()
{
	MM_preloadImages(site_root+'media/img/mnu/prima_pagina_on.jpg');	
}


function changeHSlidePages(elem){
	$("[class*=b_page]").removeClass('b_page_on').addClass('b_page');
	elem.className='b_page_on';
}

function changeSelectiiPages(elem){
	$("[class*=page]").removeClass('page_on').addClass('page');
	elem.className='page_on';
}

function checkComStep1(f){
	if(isEmpty(f.nume.value)){
		f.nume.focus();
		alert('Introduceti numele!');
		return false;
	}
	if(!isEMailAddr(f.email.value)){
		f.email.focus();
		alert('Adresa de e-mail invalida!');
		return false;
	}	
	if(isEmpty(f.telefon.value)){
		f.telefon.focus();
		alert('Introduceti telefon!');
		return false;
	}
	if(isEmpty(f.adresa.value)){
		f.adresa.focus();
		alert('Introduceti adresa livrare!');
		return false;
	}
	if(isEmpty(f.marime_v1.value) && isEmpty(f.marime_v2.value)){
		f.marime_v1.focus();
		alert('Introduceti marime cel putin pentru o verigheta!');
		return false;
	}
	if(isEmpty(f.marime_v1.value) || isEmpty(f.marime_v2.value)){
		f.marime_v2.focus();
		if(confirm('Sunteti sigur ca vreti sa comandati doar o verigheta?')){return true;}
		else{ return false;}
	}
return true;	
}

function changeMaps(elem){
	$("[class*=m_pics]").removeClass('m_pics_on').addClass('m_pics');
	$("#"+elem.value).removeClass('m_pics').addClass('m_pics_on');
	$("#adr_"+elem.value).removeClass('m_pics').addClass('m_pics_on');
}

function checkNltForm(f){
	if(!isEMailAddr(f.email.value)){
		f.email.focus();
		alert('Adresa de e-mail invalida!');
		return false;
	}else{
		$.ajax({
		   type: "POST",
		   url: site_root+"lib/ajaxHendler.php",
		   data: "action=addNltUser&email="+f.email.value,
		   success: function(msg){
			 html_res = get_response_tag('tag1',msg);
			 f.reset();
			 alert("E-mailul d-voastra a fost inregistrat!");
			 //$("#lc_tab_cont").html(html_res);  
		   }
		});
	}
}

function checkGSForm(f){
	if(isEmpty(f.nume.value)){
		f.nume.focus();
		alert('Introduceti numele!');
		return false;
	}
	if(!isEMailAddr(f.email.value)){
		f.email.focus();
		alert('Adresa de e-mail invalida!');
		return false;
	}	
	if(isEmpty(f.telefon.value)){
		f.telefon.focus();
		alert('Introduceti telefonul!');
		return false;
	}
	if(isEmpty(f.mesaj.value)){
		f.mesaj.focus();
		alert('Introduceti mesajul!');
		return false;
	}
	$.ajax({
		   type: "POST",
		   url: site_root+"lib/ajaxHendler.php",
		   data: "action=sendGSForm&nume="+f.nume.value+"&email="+f.email.value+"&telefon="+f.telefon.value+"&mesaj="+f.mesaj.value,
		   success: function(msg){
			 html_res = get_response_tag('tag1',msg);
			 f.reset();
			 alert("Mesajul d-voastra a fost trimis!");
			 //$("#lc_tab_cont").html(html_res);  
		   }
		});
}

function checkContactForm(f){
	if(isEmpty(f.nume.value)){
		f.nume.focus();
		alert('Introduceti numele!');
		return false;
	}
	if(!isEMailAddr(f.email.value)){
		f.email.focus();
		alert('Adresa de e-mail invalida!');
		return false;
	}	
	if(isEmpty(f.telefon.value)){
		f.telefon.focus();
		alert('Introduceti telefonul!');
		return false;
	}
	if(isEmpty(f.mesaj.value)){
		f.mesaj.focus();
		alert('Introduceti mesajul!');
		return false;
	}
	var dep_val = $("input[name='dep']:checked").val();
	$.ajax({
		   type: "POST",
		   url: site_root+"lib/ajaxHendler.php",
		   data: "action=sendContactForm&nume="+f.nume.value+"&email="+f.email.value+"&telefon="+f.telefon.value+"&mesaj="+f.mesaj.value+"&dep="+dep_val,
		   success: function(msg){
			 html_res = get_response_tag('tag1',msg);
			 f.reset();
			 alert("Mesajul d-voastra a fost trimis!");
			 //$("#lc_tab_cont").html(html_res);  
		   }
		});
}

function ccjud(elem){
	$("[class*=oras]").attr('src', site_root+'media/img/oras.gif');
	elem.src = site_root+'media/img/oras_on.gif';
	$("[class*=m_pics]").removeClass('m_pics_on').addClass('m_pics');
	$("#cont_"+elem.id).removeClass('m_pics').addClass('m_pics_on');
	$("#pic_"+elem.id).removeClass('m_pics').addClass('m_pics_on');
}
