   function OpenPopup(url) {

	popup = window.open(url,'blank',"width=416,height=500,resizable,scrollbars=yes");
    	popup.top.focus();
    }

   function OpenPopupSmall(url) {

	popup = window.open(url,'blank',"width=420,height=300,resizable,scrollbars=yes");
    	popup.top.focus();
    }

   function OpenPopupEinvite(url) {

	popup = window.open(url,'blank',"width=500,height=600,resizable=no,scrollbars=no");
    	popup.top.focus();
    }

   function OpenPopupLarge(url) {

	popup = window.open(url,'blank',"width=600,height=600,resizable,scrollbars=yes");
    	popup.top.focus();
    }


    var changesMade=false;
    var submitMade=false;
    var checkedRemove=false;
    


    function onUnloadChecklist() {
        if (changesMade && (!submitMade) &&confirm('Doriti sa salvati modificarile facute?')){
		document.listTask.submit();
		return true;
        }
    }

   function checkUncheck(checked,formName,fieldName){
	var hiddenField = document.getElementById(formName)[fieldName];
        changesMade=true;
        if(checked){
            hiddenField.value=1;
        }else{
            hiddenField.value=0;
        }
    }

   function saveAllBuget(){
	var bugetGroup = document.getElementsByTagName("form");
	for(var i=0;i<bugetGroup.length;i++){
		bugetGroup[i].submit();
		}
	}


    function onUnloadBuget() {
        if (changesMade && (!submitMade) && confirm('Doriti sa salvati modificarile facute?')){
		saveAllBuget();
		return true;
        }
    }

   function saveGuests(){
	document.organizeGuest.submit();
		}


 function addGuest(){ 
	var parent1 = document.getElementById('numeg');
	var parent2 = document.getElementById('prenumeg');
	var parent3 = document.getElementById('numeg_p');
	var parent4 = document.getElementById('prenumeg_p');

	var parent6 = document.getElementById('sideg');
	var element1 = null;
	var element2 = null;
	var element3 = null;
	var element4 = null;
	var element5 = null;
	var element6 = null;
	var nr = parseInt(document.addGuest.nrofguest.value)+1;

	try { // IE
         element1 = document.createElement('<input name="nume'+nr+'" type="text" value="">');
    	  element2 = document.createElement('<input name="prenume'+nr+'" type="text" value="">');
    	  element3 = document.createElement('<input name="nume_p'+nr+'" type="text" value="">');
	
    	  element4 = document.createElement('<input name="prenume_p'+nr+'" type="text" value="">');
 
    	  element6 = document.createElement('<select name="side'+nr+'">');
    	  element6.options[element6.options.length] = new Option('alege parte');
     	  element6.options[element6.options.length] = new Option('Miresei'); 
    	  element6.options[element6.options.length] = new Option('Mirelui');
	
    	} 
	catch (e) { // W3C
    		element1 = document.createElement("input");
    		element1.setAttribute("value", "");
   		element1.setAttribute("type", "text");
    		element1.setAttribute("name", "nume"+nr);

    		element2 = document.createElement("input");
    		element2.setAttribute("value", "");
    		element2.setAttribute("type", "text");
    		element2.setAttribute("name", "prenume"+nr);

    		element3 = document.createElement("input");
    		element3.setAttribute("value", "");
    		element3.setAttribute("type", "text");
    		element3.setAttribute("name", "nume_p"+nr);

    		element4 = document.createElement("input");
    		element4.setAttribute("value", "");
    		element4.setAttribute("type", "text");
    		element4.setAttribute("name", "prenume_p"+nr);



    		element6 = document.createElement("select");
    		element6.setAttribute("name", "side"+nr);
    		element6.options[element6.options.length] = new Option('alege parte');
    		element6.options[element6.options.length] = new Option('Miresei'); 
    		element6.options[element6.options.length] = new Option('Mirelui');
    		}
		parent1.appendChild(element1);
		parent2.appendChild(element2);
		parent3.appendChild(element3);
		parent4.appendChild(element4);

		parent6.appendChild(element6);

		document.addGuest.nrofguest.value = nr;
		}


