		//preloader: img1=new Image();	img1.src="images/sp_r_01.jpg";


function msg(tmp){
if (tmp!='') alert(tmp);
}

function sterge_inregistrare(filename,id,ref){
if (confirm('Sunteti sigur ca vreti sa stergeti aceasta inregistrare?'))
		window.location.href=filename+'?id='+id+'&ref='+ref;
}

function cauta(){
document.getElementById('formCautare').submit();
}

function checkForm(e){
//id treb sa fie de forma id_field-lungime_camp-pattern-oblig lung/oblig pattern
//id_field treb sa fie numele campului care o sa apara in msj de alert
var letters=/^[a-zA-Z ]{1,50}$/;
var tel=/^[0-9\+\-]{6,20}$/;
var digits=/^[0-9 ]+$/;
var email=/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9_\.\-]+$/;
var alphanumeric=/^(.)+$/;
var path=/^[a-zA-Z0-9\.:\/]+$/;
var msg='';
var ar=e.elements;

for (i=0; i<ar.length; i++){
	if (ar[i].type!='submit'){
			elem=ar[i].id.split('-');
			//treb verificat doar ca lungine
			if (elem[3] == '10' && ar[i].length<=elem[1]) {
						ar[i].style.backgroundColor='#cc0000';
						msg+='Campul '+elem[0]+' este prea scurt! \n';
						}
						else
						ar[i].style.backgroundColor='#FFFFFF';
			//treb verif  pattern ul
			if (elem[3] == '01'){
					if (eval(elem[2]+'.test(\''+ar[i].value+'\')')==false){
							ar[i].style.backgroundColor='#cc0000';
							msg+='Campul '+elem[0]+' este prea scurt sau contine caractere interzise! \n';
						}
						else
						ar[i].style.backgroundColor='#FFFFFF';
			}
			//treb verif lungimea dar si pattern ul
			if (elem[3] == '11'){
					if (eval(elem[2]+'.test(\''+ar[i].value+'\')')==false || ar[i].length<elem[1]){
							ar[i].style.backgroundColor='#cc0000';
							msg+='Campul '+elem[0]+' este prea scurt sau contine caractere interzise! \n';
						}
						else
						ar[i].style.backgroundColor='#FFFFFF';
			}
			//treb verif daca selectul are valoare aleasa
			if (elem[3] == '00' && (ar[i].type=='select-one' || ar[i].type=='select-multiple')) {
					if (ar[i].selectedIndex==0){
							ar[i].style.backgroundColor='#cc0000';
							msg+='Nu ati ales o optiune pentru  '+elem[0]+'\n';
						}
						else
						ar[i].style.backgroundColor='#FFFFFF';
			}
	}
}

if (msg=='') return true;
		else alert(msg);
return false;
}

function enlarge2(poza){
window.open('popup_produs_poza.php?file='+poza,'enlarged','width=100px,height=100px,top=200px,left:400px,scrollbars=0,toolbars=0');
}

function enlarge(posPozeArray){
window.open('popup_produs_poza.php?file='+poze[posPozeArray],'enlarged','width=100px,height=100px,top=200px,left:400px,scrollbars=0,toolbars=0');
}

function changePic(posPozeArray){
if (posPozeArray<0) 
			{ alert('Aveti selectata prima poza!'); return false; }
if (posPozeArray>poze.length-1) 
			{ alert('Aveti selectata ultima poza!'); return false; }
curent=posPozeArray;
document.getElementById('poza_produs').src=thumbs[posPozeArray];
document.getElementById('pozaCurenta').innerHTML='Poza '+(curent+1)+' din '+poze.length+'.';
}


function dropNow(raise){
raise+=10;
document.getElementById('dropFlyer').style.top=raise+'px';
if (raise<=50)
    setTimeout('dropNow('+raise+')',10);
}

function hideAd(){
document.getElementById('dropFlyer').style.display='none';
document.getElementById('dropBg').style.display='none';
}
