function Increment(txtcant, incrementor) {
	if (!isNaN(document.getElementById(txtcant).value)) {
		if (Number(document.getElementById(txtcant).value)+Number(incrementor) < 1){
			alert('Cantitate trebuie sa fie minim 1');
			document.getElementById(txtcant).value = 1;
		}else{
			document.getElementById(txtcant).value=Number(document.getElementById(txtcant).value)+Number(incrementor);
		}
  }else{
	  alert('Cantitatea trebuie sa fie o valoare numerica');
	  document.getElementById(txtcant).value = 1;
  }
} 

function calcpv(txtpa,txtproc,txtpv, txttva, txtpvtva) {
	var pa = Number(txtpa.value);
	var proc = Number(txtproc.value);
	var pv = Number(txtpv.value);
	var tva = Number(txttva.value);
	var pvtva = Number(txtpvtva);
	switch (true)
	{
	case isNaN(pa):
	  alert('Pretul de vanzare trebuie sa fie o valoare numerica');
	  document.getElementById('txtpa').value = 0;
	  document.getElementById('txtpa').select();
	  document.getElementById('txtpa').focus();
	  break;
	case isNaN(proc):
	  alert('Procentul de adaos trebuie sa fie o valoare numerica');
	  document.getElementById('txtproc').value = 0;
	  document.getElementById('txtproc').select();
	  document.getElementById('txtproc').focus();
	  break;
	case proc<0:
	  alert('Procentul de adaos trebuie sa fie mai mare ca zero');
	  document.getElementById('txtproc').value = 0;
	  document.getElementById('txtproc').select();
	  document.getElementById('txtproc').focus();
	  break; 
	case pa<0:
	  alert('Pretul de vanzare trebuie sa fie mai mare ca zero');
	  document.getElementById('txtpa').value = 0;
	  document.getElementById('txtpa').select();
	  document.getElementById('txtpa').focus();
	  break;    
	default:
	 pv=pa+pa*proc/100;
	 txtpv.value = pv;
	 tva = pv*19/100;
	 pvtva = pv+tva;
	 txttva.value = tva;
	 txtpvtva.value = pvtva;
	}
	
} 

function validpretpromo(txtpp,txtpv) {
	var pp = Number(txtpp.value);
	var pv = Number(txtpv.value);
	switch (true)
	{
	case isNaN(pp):
	  alert('Pretul promotional trebuie sa fie o valoare numerica');
	  txtpp.value = 0;
	  txtpp.select();
	  txtpp.focus();
	  break;
	case isNaN(pv):
	  alert('Pretul de vanzare trebuie sa fie o valoare numerica');
	  txtpv.value = 0;
	  txtpv.select();
	  txtpv.focus();
	  break;
	case pp<0:
	  alert('Pretul promotional trebuie sa fie mai mare ca zero');
	  txtpp.value = 0;
	  txtpp.select();
	  txtpp.focus();
	  break; 
	case pv<=pp:
	  alert('Pretul promotional trebuie sa fie mai mic decat pretul de vanzare');
	  txtpp.value = 0;
	  txtpp.select();
	  txtpp.focus();
	  break;    
	default:
	  txtpp.value = pp;
	}
	
} 


// Gallery script.
// With image cross fade effect for those browsers that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
function LoadGallery(pictureName,imageFile,titleCaption,captionText)
{
  var picture = document.getElementById(pictureName);
  if (picture.filters)
  {
    picture.style.filter="blendTrans(duration=1)";
    picture.filters.blendTrans.Apply();
  }
  picture.src = imageFile;
  if (picture.filters)
  {
    picture.filters.blendTrans.Play();
  }
 document.getElementById(titleCaption).innerHTML=captionText;
}

