///imagine in loc de checkbox

check = []; //this is an array that stores all the true/false values for each checkbox 

function checkBox(id) 
    { 

    if(check[id] != true) //if a value is not true, use this rather than == false, 'cos the first time no value will be set and it will be undefined, not true or false 
        { 
        document.getElementById('imgCheck' + id).src = "img/check-on.gif"; //change the image 
        document.getElementById('inputCheck' + id).value = "true"; //change the field value 
        check[id] = true; //change the value for this checkbox in the array 
        } 
    else 
        { 
        document.getElementById('imgCheck' + id).src = "img/check-off.gif"; 
        document.getElementById('inputCheck' + id).value = "false"; 
        check[id] = false; 
        } 
    }



function deschide_img(cPicture,nWidth,nHeight)
{
	NewWindow=window.open("","NewOne","HEIGHT="+nHeight+",WIDTH="+nWidth+",scrollbars=no,resizable=no,top=0,left=0");
	NewWindow.document.write ("<HTML><HEAD><TITLE>");
	NewWindow.document.write ("Prince Mekong Villa</TITLE></HEAD>");
	NewWindow.document.write ("<BODY topmargin=\"0\" leftmargin=\"0\">");	
	NewWindow.document.write ("<div align=\"center\"><IMG SRC=");
	NewWindow.document.write (cPicture);
	NewWindow.document.write ("></div>");
	NewWindow.document.write ("</BODY></HTML>");
	NewWindow.document.write ("</BODY></HTML>");
	NewWindow.document.close();
	return false;
}

////////////////////SELECT BOX////////////////////////////
//browser detection
geid = (document.getElementById)? 1 : 0;
nn4 = (document.layers)? 1 : 0;


// TO CREATE A SELECT BOX, use this format:
// createsbox('name','options you want separated by |', 'name of form it belongs to', 'its field name(name submitted in form)','left position', 'top position')
function createsbox(name,options,formname,formfield,left,top,width){
//CREATESBOX BEGIN

	//write layers
	sboxtemp = "drop('"+name+"')"
	selectbox  = '<div id="'+name+'dummy"></div>'
	selectbox += '<div id="'+name+'main" style="position:absolute; left:'+left+'px; top:'+top+'px; width: '+width+'px; z-index: 5"></div>'
	selectbox += '<div id="'+name+'click" style="position:absolute; left:1; top:1; z-index: 5"><a  href="javascript:'+sboxtemp+'"><img src="img/form-drop-down.gif" border="0" style="margin-top: 6px"></a></div>'
	selectbox += '<div id="'+name+'drop" style="visibility:hidden; position:absolute; left:'+left+'; width:'+width+'px; top: 0px; z-index:5"></div>'
	selectbox += '<input type="hidden" name="'+formfield+'">'
	document.write(selectbox);

	var option = new Array();
	var length = new Array();

	//create array "option" from variable "options"
	option = options.split("|");

	//get length of options
	for(i=0; i<option.length; i++)
		{length[i]=option[i].length;}

	//get longest option
	max = 0
	for(i=0; i<option.length; i++)
		{if(length[i]>length[max]){max=i}}

	//set current value to first option
	current(0,name,options,formname,formfield);

	if(nn4){
		//set width of selectbox based on max option
		document.layers[name+'dummy'].document.open();
		document.layers[name+'dummy'].document.write(option[max]);
		document.layers[name+'dummy'].document.close();
		height = document.layers[name+'dummy'].clip.height;
		document.layers[name+'main'].width = width;

		//set click layer position
		document.layers[name+'click'].left = parseInt(document.layers[name+'main'].left) + width -1;
		document.layers[name+'click'].top = parseInt(document.layers[name+'main'].top);

		//set drop layer position
		document.layers[name+'drop'].left = parseInt(document.layers[name+'main'].left);
		document.layers[name+'drop'].top = parseInt(document.layers[name+'main'].top) + 19;
		document.layers[name+'drop'].width = width + 15;

		//write options to drop layer
		for(i=0; i<option.length; i++){
			//currentdroptext = document.getElementById(name+"drop").innerHTML;
			nametemp= "'"+name+"'";
			optionstemp= "'"+options+"'";
			formnametemp= "'"+formname+"'";
			formfieldtemp= "'"+formfield+"'";
			document.layers[name+'drop'].document.open();
			document.layers[name+'drop'].document.write('<a href="javascript:current('+i+','+nametemp+','+optionstemp+','+formnametemp+','+formfieldtemp+')">'+option[i]+'</a><br>');
			document.layers[name+'drop'].document.close();
		}
	}else if(geid){
		//set width of selectbox based on max option
		document.getElementById(name+"dummy").innerHTML = option[max];
		height = document.getElementById(name+"dummy").offsetHeight;
		document.getElementById(name+"main").style.width = width;

		//set click layer position
		document.getElementById(name+"click").style.left = parseInt(document.getElementById(name+"main").style.left) + width -1;
		document.getElementById(name+"click").style.top = parseInt(document.getElementById(name+"main").style.top);

		//set drop layer position
		document.getElementById(name+"drop").style.left = parseInt(document.getElementById(name+"main").style.left);
		document.getElementById(name+"drop").style.top = parseInt(document.getElementById(name+"main").style.top) + 19;
		document.getElementById(name+"drop").style.width = width +15;

		//write options to drop layer
		for(i=0; i<option.length; i++){
			currentdroptext = document.getElementById(name+"drop").innerHTML;
			nametemp= "'"+name+"'";
			optionstemp= "'"+options+"'";
			formnametemp= "'"+formname+"'";
			formfieldtemp= "'"+formfield+"'";
			document.getElementById(name+"drop").innerHTML = currentdroptext + '<a class="droplink" href="javascript:current('+i+','+nametemp+','+optionstemp+','+formnametemp+','+formfieldtemp+')">'+option[i]+'</a><br>';
		}
	}else{
		//set width of selectbox based on max option
		document.all[name+'dummy'].innerHTML = option[max];
		height = document.all[name+'dummy'].offsetHeight;
		document.all[name+'main'].style.width = width;

		//set click layer position
		document.all[name+'click'].style.left = parseInt(document.all[name+'main'].style.left) + width;
		document.all[name+'click'].style.top = parseInt(document.all[name+'main'].style.top);

		//set drop layer position
		document.all[name+'drop'].style.left = parseInt(document.all[name+'main'].style.left);
		document.all[name+'drop'].style.top = parseInt(document.all[name+'main'].style.top) + height+2;
		document.all[name+'drop'].style.width = width;

		//write options to drop layer
		for(i=0; i<option.length; i++){
			currentdroptext = document.all[name+'drop'].innerHTML;
			nametemp= "'"+name+"'";
			optionstemp= "'"+options+"'";
			formnametemp= "'"+formname+"'";
			formfieldtemp= "'"+formfield+"'";
			document.all[name+'drop'].innerHTML = currentdroptext + '<a href="javascript:current('+i+','+nametemp+','+optionstemp+','+formnametemp+','+formfieldtemp+')">'+option[i]+'</a><br>';
		}

	}
//CREATESBOX END
}

function current(a,name,options,formname,formfield){
//function to change current value, in layer and in hidden form field
	var option = new Array();
	option = options.split("|");
	if(nn4){
		document.layers[name+'main'].document.open();
		document.layers[name+'main'].document.write(option[a]);
		document.layers[name+'main'].document.close();
		document.layers[name+'drop'].visibility = "hide";
		eval("document."+formname+"."+formfield+".value = option[a]");	
	}else if(geid){
		document.getElementById(name+"main").innerHTML = option[a];
		document.getElementById(name+"drop").style.visibility = "hidden";
		eval("document."+formname+"."+formfield+".value = option[a]");
	}else{
		document.all[name+'main'].innerHTML = option[a];
		document.all[name+'drop'].style.visibility = "hidden";
		eval("document."+formname+"."+formfield+".value = option[a]");	
	}
}

function drop(name){
//function to hide, show drop layer.
	if(nn4){
		if(document.layers[name+'drop'].visibility == "show")
		{document.layers[name+'drop'].visibility = "hide"}
		else{document.layers[name+'drop'].visibility = "show"}
	}else if(geid){
		if(document.getElementById(name+"drop").style.visibility == "visible")
		{document.getElementById(name+"drop").style.visibility = "hidden"}
		else{document.getElementById(name+"drop").style.visibility = "visible"}
	}else{
		if(document.all[name+'drop'].style.visibility == "visible")
		{document.all[name+'drop'].style.visibility = "hidden"}
		else{document.all[name+'drop'].style.visibility = "visible"}
	}
}

function sbsubmit(name){
//function to submit form.
	eval("document."+name+".submit()");
}



// JavaScript Document
<!--
function deschide2 (url, w, h) {
open(url, "",
'menubar=no,directories=no,location=no,resizable=no,scrollbars=yes,width=' + w + ',height=' + h);
}
//-->




function formValidation(form)
{
	if(notEmpty(form.f_name))
	{
		if(notEmpty(form.l_name))
		{
			if(notEmpty(form.email))
			{
				if(notEmpty(form.theDate))
				{
					if(notEmpty(form.theDate2))
					{
						if(notEmpty(form.nr_rooms))
						{
			{
				return true;
			}
						}
					}
				}
			}
		}
	}
	return false;
}

function notEmpty(elem)
{
	var str = elem.value;
	if((str.length == 0))
	{
		alert("You must fill in all required fields (*)");
		return false;
	}
	else
	{
		return true;
	}

}