// JavaScript Document

function checkForm(f,must,msgval,captcha_input_verif) {

   var must_arr=must.split(",");
   var msgval_arr=msgval.split(",");

   var msg;
   var empty_fields="";
   for (var i = 0; i < must_arr.length; i++) {
        e=must_arr[i];
        //alert (e);

        if (f.elements[e].value == "") {
        //if (f.elements[i].value == "") {
                empty_fields+="- "+ msgval_arr[i] + "\n";
        }
   }
   if (f.email) {
	  if (!(f.email.value.match(/\b(^(\S+@).+((\.biz)|(\.info)|(\.name)|(\.pro)|(\.aero)|(\.coop)|(\.museum)|(\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))) {
              empty_fields+="- Email Invalid! \n";
	  }
   }
   
//verificare captcha
   if (f.captcha_input.value!=captcha_input_verif) {
	   empty_fields+="- Cod Securitate invalid! \n";
   }
   
   if (empty_fields) {
        msg="____________________________________________________________________________ \n\n";
        msg+="Formularul nu a fot trimis pentru ca unrmatoarele campuri sunt necompletate: \n";
        msg+=empty_fields;
        msg+="____________________________________________________________________________ \n\n";
        alert(msg);
        return false;
   }
   else {
        //return true;
        //document.form1.submit();

        document.forms[f.name].submit();
   }

  }

function schimbaInnerHtml(id,img,effect)
{
  if (img=='off')
  	newimg="on";
  else
  	newimg="off";
  if (effect=='Up')
  	neweffect="Down";
  else
  	neweffect="Up";
  document.getElementById('s'+id).innerHTML='<img src="/images/button'+img+'.gif" align="left" hspace="5" vspace="2" onclick="schimbaInnerHtml(\''+id+'\',\''+newimg+'\',\''+neweffect+'\');Effect.Blind'+effect+'(\'d'+id+'\'); return false;"/>';
}

function modificapret(pretvechi,pretoptional,statusbuton)
{
	if (statusbuton) {
		pretaux=parseInt(pretvechi)+parseInt(pretoptional);
	} else {
		pretaux=parseInt(pretvechi)-parseInt(pretoptional);
	}
	Dialog.alert("Pret Total: "+pretaux+" EURO", {width:300, height:100, okLabel: "OK", ok:function(win) {return true;}}); 
	document.getElementById('prettotal').innerHTML=pretaux;
}

function my_newwindow(myurl,windowtitle) {
	var win = new Window({className: "spread", title: windowtitle,top:20, left:100, width:805, height:530, url: myurl, showEffectOptions: {duration:1.5}})
	win.show(); 
}

