
function validateForm(){

var nume=document.getElementById('nume');
var telefon=document.getElementById('telefon');
var email=document.getElementById('email');
var marcaAutoTurism=document.getElementById('marcaAutoTurism');
var modelAutoTurism=document.getElementById('modelAutoTurism');
var tipcar=document.getElementById('tipcar');
var anfab=document.getElementById('anfab');
var hp=document.getElementById('hp');
var cc=document.getElementById('cc');
var tipmotor=document.getElementById('tipmotor');
var carburant=document.getElementById('carburant');
var nri=document.getElementById('nri');
var lista=document.getElementById('lista');

var input_textare=document.getElementById('input_textare');
var str=email.value;
var x=str.indexOf("@");
var z=str.indexOf(".");



if(nume.value==''){alert("Numele si prenumele sunt obligatorii!"); return false;}
if(telefon.value==''){alert("Telefonul este obligatoriu!"); return false;}
if(email.value==''){alert("E-mail-ul este obligatoriu!"); return false;}
if((x==-1) || (z==-1) ){alert("E-mail invalid!"); return false;}
if(marcaAutoTurism.value==''){alert("Marca autoturism este obligatoriu!"); return false;}
if(modelAutoTurism.value==''){alert("Model autoturism este obligatoriu!"); return false;}
if(tipcar.value==''){alert("Tip caroserie este obligatoriu!"); return false;}
if(anfab.value==''){alert("An fabricatie este obligatoriu!"); return false;}
if(hp.value==''){alert("Putere motor este obligatoriu!"); return false;}
if(cc.value==''){alert("Capacitate cilindrica este obligatoriu!"); return false;}
if(tipmotor.value==''){alert("Tip motor este obligatoriu!"); return false;}
if(carburant.value==''){alert("Carburant este obligatoriu!"); return false;}
if(nri.value==''){alert("Numar identificare este obligatoriu!"); return false;}
if(lista.value==''){alert("Piese solicitate este obligatoriu!"); return false;}
}




function checkComanda()

{var cantitate_form=document.getElementById('cantitate_form');
var nume_form=document.getElementById('nume_form');
var telefon_form=document.getElementById('telefon_form');
var email_form=document.getElementById('email_form');
var str=email_form.value;
var a=str.indexOf("@");
var b=str.indexOf(".");

if(cantitate_form.value==''){alert("Introduceti nr. unitati dorite!"); return false;}	
if(nume_form.value==''){alert("Numele si prenumele sunt obligatorii!"); return false;}
if(telefon_form.value==''){alert("Telefonul este obligatoriu!"); return false;}
if(email_form.value==''){alert("E-mail-ul este obligatoriu!"); return false;}
if((a==-1) || (b==-1) ){alert("E-mail invalid!"); return false;}	
	
}






function fadeText(divId) {
  if(tickerObj)
  {
    if(hex>0) {
      hex-=5; // increase color darkness
      tickerObj.style.color="rgb("+hex+","+hex+","+hex+")";
      setTimeout("fadeText('" + divId + "')", fadeSpeed); 
    } else
      hex=255; //reset hex value
  }
}

function initialiseList(divId) {
  tickerObj = document.getElementById(divId);
  if(!tickerObj)
    reportError("Could not find a div element with id \"" + divId + "\"");
  list = tickerObj.childNodes;
  if(list.length<=0)
    reportError("The div element \"" + divId + "\" does not have any children");
  for (var i=0; i<list.length; i++) {
    var node = list[i];
    if ((node.nodeType == 3) && (!/\S/.test(node.nodeValue))) 
              tickerObj.removeChild(node);
  }
  run(divId, 0);
}

function run(divId, count) {
  fadeText(divId);
  list[count].style.display = "block";
  if(count > 0)
    list[count-1].style.display = "none";
  else
    list[list.length-1].style.display = "none";
  count++;
  if(count == list.length)
    count = 0;
  window.setTimeout("run('" + divId + "', " + count+ ")", interval*1000);
}
function reportError(error) {
  alert("The script could not run because you have errors:\n\n" + error);
  return false;
}




function asigurarevalidateForm()
{
var asigurarelista=document.getElementById('asigurare-lista');
var asigurarenume=document.getElementById('asigurare-nume');
var asiguraretelefon=document.getElementById('asigurare-telefon');
var asigurareemail=document.getElementById('asigurare-email');
var asigurarestr=asigurareemail.value;
var asigurarea=asigurarestr.indexOf("@");
var asigurareb=asigurarestr.indexOf(".");


if(asigurarenume.value==''){alert("Numele si prenumele sunt obligatorii!"); return false;}
if(asiguraretelefon.value==''){alert("Telefonul este obligatoriu!"); return false;}
if(asigurareemail.value==''){alert("E-mail-ul este obligatoriu!"); return false;}
if((asigurarea==-1) || (asigurareb==-1) ){alert("E-mail invalid!"); return false;}	
if(asigurarelista.value==''){alert("Asigurare solicitata este obligatoriu!"); return false;}	



}




function contact_validateForm()
{
var contact_lista=document.getElementById('contact-lista');
var contact_nume=document.getElementById('contact-nume');
var contact_telefon=document.getElementById('contact-telefon');
var contact_email=document.getElementById('contact-email');
var contact_str=contact_email.value;
var contact_a=contact_str.indexOf("@");
var contact_b=contact_str.indexOf(".");


if(contact_nume.value==''){alert("Numele si prenumele sunt obligatorii!"); return false;}
if(contact_telefon.value==''){alert("Telefonul este obligatoriu!"); return false;}
if(contact_email.value==''){alert("E-mail-ul este obligatoriu!"); return false;}
if((contact_a==-1) || (contact_b==-1)){alert("E-mail invalid!"); return false;}	
if(contact_lista.value==''){alert("Mesajul este obigatoriu!"); return false;}	



}


function checkCautare()

{
var rr=document.getElementById('cauta-input');

if(rr==''){alert("Introduceti un termen!"); return false;}	



}










