<!-- 

newdom=0;

var tid;

if (document.all) {

	layerRef="document.all";

	styleSwitch=".style";

}

else if (document.layers) {

	layerRef="document.layers";

  	styleSwitch="";

}

else if(document.getElementById) {

	newdom=1;

	layerRef="document.getElementById";

	styleSwitch=".style";

}





function showLayer(layerName) {

 if (tid) {  clearTimeout(tid)};

	if (newdom) {

	document.getElementById(layerName).style.visibility="visible";

	}

	else {	

	 	eval(layerRef+"['"+layerName+"']"+styleSwitch+'.visibility="visible"');

	}
}

  	

function hideLayer(layerName) {

	if (newdom) {

	document.getElementById(layerName).style.visibility="hidden";

	}

	else {	

	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');

}

}



function off() {
	hideLayer('menu1');
	hideLayer('menu2');
	hideLayer('menu3');
	hideLayer('menu4');	
	hideLayer('menu5');	
	hideLayer('menu7');	
	hideLayer('menu8');	
	hideLayer('menu31');	
	hideLayer('mainmenu');	
}

function offpics() {

	hideLayer('pic0');	
	hideLayer('pic1');	
	hideLayer('pic2');	
	hideLayer('pic3');	
	hideLayer('pic4');	
	hideLayer('pic5');	
	hideLayer('pic6');	
	hideLayer('pic7');	
}


function to() {

tid=setTimeout("off()",100);

}

function topfoto(){

}

function openPIC( pageToLoad, winName, width, height, left, center) {
xposition=200; yposition=20;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=0,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}


function check_addr(yyy) {
var retVal=false
if ((yyy.value.indexOf('@') != -1) && (yyy.value.indexOf('.') != -1))
	retVal=true	
return retVal
}

function valFieldsNEWS(theform) {

if (!check_addr(theform.visitor_email)){alert ("Klaidingas el. paðto adresas!"); return false; }
theform.submit();
return true;
}

function openAWindow( pageToLoad, winName, width, height, left, center, theform) {

if (!check_addr(theform.visitor_email)){alert ("Klaidingas el. paðto adresas!"); return false; }
//theform.submit();
xposition=200; yposition=20;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=1,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

	pageToLoad=pageToLoad+"?visitor_email="+theform.visitor_email.value;
    window.open( pageToLoad,winName,args );
}

function setCookie(name, value, expire) {
document.cookie = name + "=" + escape(value)
+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function openWindow( pageToLoad, winName, width, height, left, center) {
xposition=200; yposition=20;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=1,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}

function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { 
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
}

function showFoto(MenuStatus){

var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 1000*60*60*24*5)

var YourFavourite = getCookie("YF")
if (YourFavourite != null) {
	hideLayer('pic'+YourFavourite);
	if (YourFavourite<7) YourFavourite++
	else {
		if (MenuStatus=="on") YourFavourite = 0
		else YourFavourite = 1
	}
	setCookie("YF", YourFavourite, expires);
	showLayer('pic'+YourFavourite);
}
else {
	if (MenuStatus=="on") {
		showLayer('pic0');
		setCookie("YF", 0);
	}
	else {
		showLayer('pic1');
		setCookie("YF", 1);
	}
}

}

function loadFoto(MenuStatus){

offpics();
var YourFavourite = getCookie("YF")
if (YourFavourite != null) {
	showLayer('pic'+YourFavourite);
}
else {
//	alert(YourFavourite);
		if (MenuStatus=="on") {
			showLayer('pic0');
			setCookie("YF", 0);
		}
		else {
			showLayer('pic1');
			setCookie("YF", 1);
		}
	}
}

function setFoto(YourFavourite){
	var today = new Date()
	var expires = new Date()
	expires.setTime(today.getTime() + 1000*60*60*24*5);
	setCookie("YF", YourFavourite, expires);
	return true;
}

function notREADY(){
	alert("Ði funkcija dar neveikia ! ;)");
	return false;
}


function Persons(roomtype){
	switch(roomtype){
		case '1':
			persons = 1;
			break;
		case '11':
			persons = 2;
			break;
		case '2':
			persons = 2;
			break;
		case '210':
			persons = 3;
			break;
		case '211':
			persons = 3;
			break;
		case '210220':
			persons = 4;
			break;
		case '210221':
			persons = 4;
			break;
		case '211220':
			persons = 4;
			break;
		case '211221':
			persons = 4;
			break;
		case '3':
			persons = 3;
			break;
		case '31':
			persons = 4;
			break;
		case '4':
			persons = 4;
			break;
		case '5':
			persons = 5;
			break;
		case '6':
			persons = 6;
			break;
		case '7':
			persons = 7;
			break;
		case '8':
			persons = 8;
			break;
		default:
			persons = 0;
	}
return persons;
}

function getPrice(roomtype, theform){
	switch(roomtype){
		case '1':
			price = theform.p1.value;
			typestr = "vienvietis";
			break;
		case '11':
			price = theform.p11.value;
			typestr = theform.r11.value;
			break;
		case '2':
			price = theform.p2.value;
			typestr = "dvivietis";
			break;
		case '210':
			price = theform.p210.value;
			typestr = theform.r210.value;
			break;
		case '211':
			price = theform.p211.value;
			typestr = theform.r211.value;
			break;
		case '210220':
			price = theform.p210220.value;
			typestr = theform.r210220.value;
			break;
		case '210221':
			price = theform.p210221.value;
			typestr = theform.r210221.value;
			break;
		case '211220':
			price = theform.p211220.value;
			typestr = theform.r211220.value;
			break;
		case '211221':
			price = theform.p211221.value;
			typestr = theform.r211221.value;
			break;
		case '3':
			price = theform.p3.value;
			typestr = "trivietis";
			break;
		case '31':
			price = theform.p31.value;
			typestr = theform.r31.value;
			break;
		case '4':
			price = theform.p4.value;
			typestr = "keturvietis";
			break;
		case '5':
			price = theform.p5.value;
			typestr = "penkiavietis";
			break;
		case '6':
			price = theform.p6.value;
			typestr = "ðeðiavietis";
			break;
		case '7':
			price = theform.p7.value;
			typestr = "septynvietis";
			break;
		case '8':
			price = theform.p8.value;
			typestr = "aðtuonvietis";
			break;
		default:
			price = 0;
	}
	result = [price, typestr];
return result;
}

function showResult(eLement, textToShow) {

	el=document.getElementById(eLement);
	if (el.hasChildNodes()) {
			newtxt=document.createTextNode(textToShow);
			el.replaceChild(newtxt, el.lastChild);
	}
	else {
		newtxt=document.createTextNode(textToShow);
		el.appendChild(newtxt);
	}
}

function showTOTAL(theform) {

	theform.reservation_total.value = parseInt(theform.reservation_room1.value) + parseInt(theform.reservation_room2.value) + parseInt(theform.reservation_p1.value) + parseInt(theform.reservation_p2.value) + parseInt(theform.reservation_v1.value) + parseInt(theform.reservation_v2.value) + parseInt(theform.reservation_pv1.value) + parseInt(theform.reservation_pv2.value)+ parseInt(theform.reservation_w1.value) + parseInt(theform.reservation_w2.value)+ parseInt(theform.reservation_b1.value) + parseInt(theform.reservation_b2.value)+ parseInt(theform.reservation_c1.value) + parseInt(theform.reservation_c2.value)+ parseInt(theform.reservation_i1.value) + parseInt(theform.reservation_i2.value);
	showResult('TDtotal', theform.reservation_total.value); 
}

function showGRANDTOTAL(theform) {
	theform.reservation_grandtotal.value = parseInt(theform.reservation_total.value) + parseInt(theform.reservation_airtax.value); 
	showResult('TDviso', theform.reservation_grandtotal.value); 
}

function updateCH1(theform){

	var persons=Persons(theform.reservation_roomtype1.value);
	
	if (theform.more1 && theform.more1.checked) {
		theform.reservation_p1.value = theform.p.value * persons;
		showResult('TDp1', theform.reservation_p1.value);
	} 

	if (theform.more2 && theform.more2.checked) {
		theform.reservation_v1.value = theform.v.value * persons;
		showResult('TDv1', theform.reservation_v1.value);
	} 

	if (theform.more3 && theform.more3.checked) { 
		theform.reservation_pv1.value = theform.pv.value * persons;
		showResult('TDpv1', theform.reservation_pv1.value);
	} 

	if (theform.more4 && theform.more4.checked) {
		theform.reservation_w1.value = theform.w.value * persons;
		showResult('TDw1', theform.reservation_w1.value);
	} 

	if (theform.more5 && theform.more5.checked) {
		theform.reservation_b1.value = theform.b.value * persons;
		showResult('TDb1', theform.reservation_b1.value);
	} 

	if (theform.more6 && theform.more6.checked) {
		theform.reservation_c1.value = theform.c.value * persons;
		showResult('TDc1', theform.reservation_c1.value);
	} 

	if (theform.more7 && theform.more7.checked) {
		theform.reservation_i1.value = theform.i.value * persons;
		showResult('TDi1', theform.reservation_i1.value);
	} 
}

function updateCH2(theform){

	var persons=Persons(theform.reservation_roomtype2.value);

	if (theform.more8 && theform.more8.checked) {
		theform.reservation_p2.value = theform.p.value * persons;
		showResult('TDp2', theform.reservation_p2.value);
	} 

	if (theform.more9 && theform.more9.checked) { 
		theform.reservation_v2.value = theform.v.value * persons;
		showResult('TDv2', theform.reservation_v2.value);
	} 

	if (theform.more10 && theform.more10.checked) { 
		theform.reservation_pv2.value = theform.pv.value * persons;
		showResult('TDpv2', theform.reservation_pv2.value);
	} 

	if (theform.more11 && theform.more11.checked) {
		theform.reservation_w2.value = theform.w.value * persons;
		showResult('TDw2', theform.reservation_w2.value);
	} 

	if (theform.more12 && theform.more12.checked) {
		theform.reservation_b2.value = theform.b.value * persons
		showResult('TDb2', theform.reservation_b2.value);
	} 

	if (theform.more13 && theform.more13.checked) {
		theform.reservation_c2.value = theform.c.value * persons;
		showResult('TDc2', theform.reservation_c2.value);
	} 

	if (theform.more14 && theform.more14.checked) {
		theform.reservation_i2.value = theform.i.value * persons;
		showResult('TDi2', theform.reservation_i2.value);
	} 
}

function calcSUMA(theform, no){
	if (no==1) {
//		theform.reservation_room1.value = getPrice(theform.reservation_roomtype1.value, theform);
		both = getPrice(theform.reservation_roomtype1.value, theform);
		theform.reservation_room1.value = both[0];
		theform.reservation_roomtype1str.value = both[1];
		showResult('TDtotal1', theform.reservation_room1.value); 
		updateCH1(theform);
	}
	if (no==2) {
//		theform.reservation_room2.value = getPrice(theform.reservation_roomtype2.value, theform);
		both = getPrice(theform.reservation_roomtype2.value, theform);
		theform.reservation_room2.value = both[0];
		theform.reservation_roomtype2str.value = both[1];
		showResult('TDtotal2', theform.reservation_room2.value); 
		updateCH2(theform);
	}
	showTOTAL(theform);
	showGRANDTOTAL(theform);
}

function calcAIRTAX(theform){
	
	if (theform.reservation_persons.value>0)	theform.reservation_airtax.value = theform.reservation_persons.value * theform.travel_tax.value;
	showResult('TDairtax', theform.reservation_airtax.value); 
	showGRANDTOTAL(theform);
}

function clearChildren(theform){
	theform.reservation_persons.value = 0;
	theform.reservation_roomtype1.value = 0;
	theform.reservation_roomtype2.value = 0;
	calcSUMA(theform, 1);
	updateCH1(theform);
	calcSUMA(theform, 2);
	updateCH2(theform);
	theform.reset();
	calcAIRTAX(theform);
	showTOTAL(theform);
	showGRANDTOTAL(theform);
}

function showChildren(theform){
	calcSUMA(theform, 1);
	calcSUMA(theform, 2);
	calcAIRTAX(theform);
	showTOTAL(theform);
	showGRANDTOTAL(theform);
}

function calcMORE(theform, no){

	var persons = 0;
	if (no>7) persons=Persons(theform.reservation_roomtype2.value)
	else persons=Persons(theform.reservation_roomtype1.value);

	switch(no){
		case 1:
			if (theform.more1.checked) theform.reservation_p1.value = theform.p.value * persons
			else theform.reservation_p1.value = 0;
			showResult('TDp1', theform.reservation_p1.value);
			break;
		case 2:
			if (theform.more2.checked) theform.reservation_v1.value = theform.v.value * persons
			else theform.reservation_v1.value = 0;
			showResult('TDv1', theform.reservation_v1.value);
			break;
		case 3:
			if (theform.more3.checked) theform.reservation_pv1.value = theform.pv.value * persons
			else theform.reservation_pv1.value = 0;
			showResult('TDpv1', theform.reservation_pv1.value);
			break;
		case 4:
			if (theform.more4.checked) theform.reservation_w1.value = theform.w.value * persons
			else theform.reservation_w1.value = 0;
			showResult('TDw1', theform.reservation_w1.value);
			break;
		case 5:
			if (theform.more5.checked) theform.reservation_b1.value = theform.b.value * persons
			else theform.reservation_b1.value = 0;
			showResult('TDb1', theform.reservation_b1.value);
			break;
		case 6:
			if (theform.more6.checked) theform.reservation_c1.value = theform.c.value * persons
			else theform.reservation_c1.value = 0;
			showResult('TDc1', theform.reservation_c1.value);
			break;
		case 7:
			if (theform.more7.checked) theform.reservation_i1.value = theform.i.value * persons
			else theform.reservation_i1.value = 0;
			showResult('TDi1', theform.reservation_i1.value);
			break;
		case 8:
			if (theform.more8.checked) theform.reservation_p2.value = theform.p.value * persons
			else theform.reservation_p2.value = 0;
			showResult('TDp2', theform.reservation_p2.value);
			break;
		case 9:
			if (theform.more9.checked) theform.reservation_v2.value = theform.v.value * persons
			else theform.reservation_v2.value = 0;
			showResult('TDv2', theform.reservation_v2.value);
			break;
		case 10:
			if (theform.more10.checked) theform.reservation_pv2.value = theform.pv.value * persons
			else theform.reservation_pv2.value = 0;
			showResult('TDpv2', theform.reservation_pv2.value);
			break;
		case 11:
			if (theform.more11.checked) theform.reservation_w2.value = theform.w.value * persons
			else theform.reservation_w2.value = 0;
			showResult('TDw2', theform.reservation_w2.value);
			break;
		case 12:
			if (theform.more12.checked) theform.reservation_b2.value = theform.b.value * persons
			else theform.reservation_b2.value = 0;
			showResult('TDb2', theform.reservation_b2.value);
			break;
		case 13:
			if (theform.more13.checked) theform.reservation_c2.value = theform.c.value * persons
			else theform.reservation_c2.value = 0;
			showResult('TDc2', theform.reservation_c2.value);
			break;
		case 14:
			if (theform.more14.checked) theform.reservation_i2.value = theform.i.value * persons
			else theform.reservation_i2.value = 0;
			showResult('TDi2', theform.reservation_i2.value);
			break;
	}
	showTOTAL(theform);
	showGRANDTOTAL(theform);
}

function validateAndSubmit(theform) {
	theform.makereservation.disabled=false;
	return true
}

function isaPosNum(s) {
	return (parseInt(s) > 0)
}

function testMobile(StringToTest, RequiredInTheForm, theform, varname){

	// formatas (xxx)xxxxx
	telMobilus = /^\(6\d{2}\)\s*\d{5}$/;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti mobilaus telefono numerá.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !telMobilus.exec(StringToTest)) {
		alert("KLAIDA: neteisingas mobilaus telefono numeris arba ávedimo formatas.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testTelecomPhone(StringToTest, RequiredInTheForm, theform, varname){

	// formatas (5)2xxxxxx
	telVilnius = /^\(5\)\s*2\d{6}$/;

	// formatas (37)xxxxxx
	telDidieji = /^\((37|46|45|41)\)\s*\d{6}$/;

	// formatas (xxx)xxxxx
	telRajonai = /\((425|315|381|319|450|313|528|386|349|426|447|346|427|347|445|459|318|343|443|383|469|421|460|451|448|319|422|428|458|440|345|380|449|441|382|387|446|444|528|340|389|310|342|386|385)\)\s*\d{5}$/;


	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti telefono/fakso numerá.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !telVilnius.exec(StringToTest) && !telDidieji.exec(StringToTest) && !telRajonai.exec(StringToTest)) {
		alert("KLAIDA: neteisingas telefono/fakso numeris arba ávedimo formatas.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testPersonalCode(StringToTest, RequiredInTheForm, theform, varname){

	// kodo pradþia gali bûti 3,4,5,6
	aKodas = /^\s*(3|4|5|6)\d{10}\s*$/;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti asmens kodà.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !aKodas.exec(StringToTest)) {
		alert("KLAIDA: neteisingas asmens kodas.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testFirstname(StringToTest, RequiredInTheForm, theform, varname){

	// gali bûti du vardai
	Pfirstname=/^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$|^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$/;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti asmens vardà.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !Pfirstname.exec(StringToTest)) {
		alert("KLAIDA: neteisingas vardas(vardai).");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testLastname(StringToTest, RequiredInTheForm, theform, varname){

	// gali bûti dvi pavardës atskirto brûkðneliu arba ne
	Plastname=/^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$|^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}(\s*\-\s*|\s{1,})[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$/;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti asmens pavardæ.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !Plastname.exec(StringToTest)) {
		alert("KLAIDA: neteisinga pavardë.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testFullname(StringToTest, RequiredInTheForm, theform, varname){

	// gali bûti du vardai ir dvi pavardës atskirtos brûkðneliu arba ne; negali bûti vienas þodis
	Pbothnames=/^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$|^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$|^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}(\s*\-\s*|\s{1,})[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$|^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{1,}[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}(\s*\-\s*|\s{1,})[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s*$/;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti asmens vardà ir pavardæ.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !Pbothnames.exec(StringToTest)) {
		alert("KLAIDA: neteisingas asmens vardas ir pavardë.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testAddress(StringToTest, RequiredInTheForm, theform, varname){

	// prasideda ið didþiosios raidës
	Pbothnames=/^\s*[A-ZÀÈÆËÁÐØÛÞ]+[a-zàèæëáðøûþ]{2,}\s{0,}/;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti adresà.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !Pbothnames.exec(StringToTest)) {
		alert("KLAIDA: neteisingas adresas.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function testEmail(StringToTest, RequiredInTheForm, theform, varname){

	eMail=/^(\w{2,}|\w{1,}.\w{1,})(@\w{2,}.|@\w{2,}.\w{2,}.)(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$/i;

	if (RequiredInTheForm==1 && StringToTest=="") {
		alert("Praðau ávesti el. paðto adresà.");
		eval("theform."+varname+".focus()");
		return false
	} else if (StringToTest!="" && !eMail.exec(StringToTest)) {
		alert("KLAIDA: neteisingas el. paðto adresas.");
		eval("theform."+varname+".focus()");
		return false
	} else return true
}

function valPDATA(theform){
	if (!testFirstname(theform.reservation_firstname.value,1,theform,'reservation_firstname')) return false
	if (!testLastname(theform.reservation_lastname.value,1,theform,'reservation_lastname')) return false

	if (theform.reservation_phone.value=="" && theform.reservation_mob.value=="" && theform.reservation_fax.value=="" && theform.reservation_email.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti bent vienà savo kontaktà!");
		theform.reservation_phone.focus();
		return false 
	}

	if (theform.reservation_type[0].checked && theform.reservation_fax.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti savo fakso numerá, nes Jûs paþymëjote, kad norite gauti atsakymà faksu!");
		theform.reservation_fax.focus();
		return false 
	}

	if (theform.reservation_type[2].checked && theform.reservation_phone.value=="" && theform.reservation_mob.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti savo telefono arba mobilaus telefono numerá, nes Jûs paþymëjote, kad norite gauti atsakymà telefonu!");
		theform.reservation_fax.focus();
		return false 
	}

	if (theform.reservation_phone.value=="" && theform.reservation_mob.value==""){
		alert("Rezervacija negalima. Praðome nurodyti bent vienà savo telefono numerá!");
		theform.reservation_phone.focus();
		return false 
	} 

	
	if (!testTelecomPhone(theform.reservation_phone.value,0,theform,'reservation_phone')) return false
	if (!testMobile(theform.reservation_mob.value,0,theform,'reservation_mob')) return false
	if (!testTelecomPhone(theform.reservation_fax.value,0,theform,'reservation_fax')) return false

	if (theform.reservation_type[1].checked && theform.reservation_email.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti savo el. paðto adresà, nes Jûs paþymëjote, kad norite gauti atsakymà el. paðtu!");
		theform.reservation_email.focus();
		return false 
	}

	if (!testEmail(theform.reservation_email.value,0,theform,'reservation_email')) return false
	return false
}

function makeReservation(theform) {

	var people = parseInt(Persons(theform.reservation_roomtype1.value))+parseInt(Persons(theform.reservation_roomtype2.value));

	if (theform.reservation_persons.value=="") {
		alert("Praðau nurodyti keliaujanèiø asmenø skaièiø.");
		theform.reservation_persons.focus();
		return false 
	}
	else if (!isaPosNum(theform.reservation_persons.value)){
		alert("Praðau nurodyti teisingà keliaujanèiø ascmenø skaièiø.");
		theform.reservation_persons.focus();
		return false 
	}
	else if (parseInt(theform.reservation_persons.value)>20){
		alert("Praðau nurodyti realø keliaujanèiø ascmenø skaièiø.");
		theform.reservation_persons.focus();
		return false 
	}
	else if (parseInt(theform.reservation_persons.value)<people){
		alert("Per maþas keliaujanèiø asmenø skaièius.");
		theform.reservation_persons.focus();
		return false 
	}
	else if (parseInt(theform.reservation_persons.value)-2>people){
		alert("Per didelis keliaujanèiø asmenø skaièius.");
		theform.reservation_persons.focus();
		return false 
	}


	if (theform.reservation_roomtype1.value=="0" && theform.reservation_roomtype2.value=="0") {
		alert("Rezervacija negalima. Nenurodytas kambarys!");
		theform.reservation_roomtype1.focus();
		return false 
	}

	valPDATA(theform);
	if (!testFirstname(theform.reservation_firstname.value,1,theform,'reservation_firstname')) return false
	if (!testLastname(theform.reservation_lastname.value,1,theform,'reservation_lastname')) return false

	if (theform.reservation_phone.value=="" && theform.reservation_mob.value=="" && theform.reservation_fax.value=="" && theform.reservation_email.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti bent vienà savo kontaktà!");
		theform.reservation_phone.focus();
		return false 
	}

	if (theform.reservation_type[0].checked && theform.reservation_fax.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti savo fakso numerá, nes Jûs paþymëjote, kad norite gauti atsakymà faksu!");
		theform.reservation_fax.focus();
		return false 
	}

	if (theform.reservation_type[2].checked && theform.reservation_phone.value=="" && theform.reservation_mob.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti savo telefono arba mobilaus telefono numerá, nes Jûs paþymëjote, kad norite gauti atsakymà telefonu!");
		theform.reservation_fax.focus();
		return false 
	}

	if (theform.reservation_phone.value=="" && theform.reservation_mob.value==""){
		alert("Rezervacija negalima. Praðome nurodyti bent vienà savo telefono numerá!");
		theform.reservation_phone.focus();
		return false 
	} 

	
	if (!testTelecomPhone(theform.reservation_phone.value,0,theform,'reservation_phone')) return false
	if (!testMobile(theform.reservation_mob.value,0,theform,'reservation_mob')) return false
	if (!testTelecomPhone(theform.reservation_fax.value,0,theform,'reservation_fax')) return false

	if (theform.reservation_type[1].checked && theform.reservation_email.value=="") {
		alert("Rezervacija negalima. Praðome nurodyti savo el. paðto adresà, nes Jûs paþymëjote, kad norite gauti atsakymà el. paðtu!");
		theform.reservation_email.focus();
		return false 
	}

	if (!testEmail(theform.reservation_email.value,0,theform,'reservation_email')) return false
	
	theform.submit();
	return true
}

function validateInputs(theform, no) {

	var j = 1;
	for (i=1; i<=no	; i++){
		if (!testFullname(theform.elements[j].value,1,theform,'elements['+j+']')) return false
		j++;
		if (!testPersonalCode(theform.elements[j].value,1,theform,'elements['+j+']')) return false
		j++;
		if (!testAddress(theform.elements[j].value,1,theform,'elements['+j+']')) return false
		j++;
	}
	theform.submit();
	return true
}

function openPIC_skimap( pageToLoad, winName, width, height, left, center) {
xposition=200; yposition=20;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=1,"
    + "scrollbars=1,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}


// -->

