//Script by Raul Ujog@3madd.com - Valid check

function gup( name )
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}


function sendDataL (typc) {
var url = 'http://www.soberustice.ro/submit.php';
var categv = gup('categ');
var gel = document.getElementsByClassName("xxx");
var lung = gel.length;

if(typc=="comanda"){
var pars = 'nume='+escape($F('nume'))+'&adresa='+escape($F('adresa'))+'&local='+escape($F('local'))+'&judet='+escape($F('judet'))+'&tel='+escape($F('tel'))+'&mail='+escape($F('mail'))+'&categ=comanda';

for (i=0;i<lung;i++){
pars +='&cant'+i+'='+escape($F('cant'+i));
}

}else if(typc=="contact"){
var pars = 'nume='+escape($F('nume'))+'&mail='+escape($F('mail'))+'&mesaj='+escape($F('mesaj'))+'&categ=contact';
}
var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onLoading: showLoadL, onComplete: showResponseL} );
}
function showLoadL () {
$('containerL').style.display = 'none';
$('loaduser').style.display = 'block';
}
function showResponseL (xmlHttp) {
var newData = xmlHttp.responseText;
if(newData=="Mesajul a fost trimis" || newData=="Your message has been sent"){
	Form.disable('form1');
	//$('btn').style.display = 'none';
	$('btn').setStyle({opacity: 0.5});
	$('loaduser').style.display = 'none';
	$('containerL').style.display = 'block';
	$('containerL').innerHTML =newData;
}
else{
$('loaduser').style.display = 'none';
$('containerL').style.display = 'block';
$('containerL').innerHTML =newData;
}
}

