function createImgLibrary(){
		if (document.getElementById('bigpicture')){
      		document.getElementById('bigpicture').style.width = "250px";
      		document.getElementById('bigpicture').style.height = "200px";
      		images = [];
          images = document.getElementsByTagName('A');
          for(var i=0;i<images.length;i++){
          				if(images[i].className == 'imglibrary'){
      																	 var img = images[i].childNodes[0];
      																	 img.width = "71";
      																	 img.height = "54";
      	    														 img.onclick = function(){																	 						 
      																							 var image = new Image();
      																							 image.src = this.src;
      																							 document.getElementById('bigpicture').innerHTML = "";
      																							 document.getElementById('bigpicture').appendChild(image);
      																							 }				
      	    			}
      		}
	 }
}

				 
function showAlert(message){
					 Dialog.alert(message,
					 										{windowParameters: {width:300, height:100}, okLabel: "OK",
															ok:function(win) {debug("validate alert panel"); return true}
															});
					 }
					 
function driveTestValidation(){
						var ok = true;
            if ((ok == true) && ($('nume').value.length == 0)) {
										 ok = false;
										 this.showAlert('Va rugam sa introduceti numele dumneavoastra');
										 }
						if ((ok == true) && ($('telefon').value.length == 0)) {
										 ok = false;
										 this.showAlert('Va rugam sa introduceti numarul dumneavoastra de telefon ');
										 }
						if ((ok == true) && ($('email').value.length == 0)) {
										 ok = false;
										 this.showAlert('Va rugam sa introduceti adresa dumneavoastra de e-mail');
										 }
						if (ok == true) document.getElementById('drive_test_form').submit();
						}

function validateContact(){
				 if (document.getElementById('mailform')){
				 document.getElementById('mailform').onsubmit = function(){
				 																							var ok = true;

                                                      if ($('mailformnume').value.length == 0) {
                                          										 ok = false;
                                          										 showAlert('Va rugam sa introduceti numele dumneavoastra');
                                          										 return false;
																															 }
                                          						if ((ok == true) && ($('mailformprenume').value.length == 0)) {
                                          										 ok = false;
                                          										 showAlert('Va rugam sa introduceti prenumele dumneavoastra');
                                          										 return false;
																															 }
                                          						if ((ok == true) && ($('mailformemail').value.length == 0)) {
                                          										 ok = false;
                                          										 showAlert('Va rugam sa introduceti adresa dumneavoastra de e-mail');
                                          										 return false;
																															 }
																											if ((ok == true) && (!$('mailformemail').value.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/))){
																												 			 ok = false;
                                          										 showAlert('Va rugam sa introduceti o adresa de e-mail valida');
                                          										 return false;																															 
																															 }
																											}
																					}				
				 }
				 
function validateTur(){
				 if (document.getElementById('mailform')){
				 document.getElementById('mailform').onsubmit = function(){
				 																							var ok = true;

                                                      if ($('mailformnume').value.length == 0) {
                                          										 ok = false;
                                          										 showAlert('Va rugam sa introduceti numele dumneavoastra');
                                          										 return false;
																															 }
                                          						if ((ok == true) && ($('mailformtelefon').value.length == 0)) {
                                          										 ok = false;
                                          										 showAlert('Va rugam sa introduceti numarul dumneavoastra de telefon');
                                          										 return false;
																															 }
                                          						if ((ok == true) && ($('mailformemail').value.length == 0)) {
                                          										 ok = false;
                                          										 showAlert('Va rugam sa introduceti adresa dumneavoastra de e-mail');
                                          										 return false;
																															 }
																											if ((ok == true) && (!$('mailformemail').value.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/))){
																												 			 ok = false;
                                          										 showAlert('Va rugam sa introduceti o adresa de e-mail valida');
                                          										 return false;																															 
																															 }
																											}
																					}				
				 }
var pFenster = null;
function pWindow(datei) {
	if (pFenster && pFenster.closed){
        pFenster = null;
    }

    if(!pFenster){
        options = "menubar=1,scrollbars=1,width=540,height=680";
        pFenster=window.open(datei,'pWindow',options);	
        pFenster.focus()
    } else{
		pFenster.focus();
	}
}

