function validateSendFriendForm(){
	//alert('2 wysylka dla oferty');
	var valid=true;

	exp=/^([\s,]*[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.]+\.[a-zA-Z]{2,4}[\s,]*)+$/;

	if(!document.getElementById('addressTo').value){
		document.getElementById('contentInformFriendReceiverEmailTR').className='notValidValue';
		valid=false;
	}else{
		if(exp.test(document.getElementById('addressTo').value)){
			document.getElementById('contentInformFriendReceiverEmailTR').className='';
		}else{
			document.getElementById('contentInformFriendReceiverEmailTR').className='notValidValue2';
			valid=false;
		}
	}


	exp=/^[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.]+\.[a-zA-Z]{2,4}$/;


	if(!document.getElementById('addressFrom').value){
		document.getElementById('contentInformFriendSenderEmailTR').className='notValidValue';
		valid=false;
	}else{
		if(exp.test(document.getElementById('addressFrom').value)){
			document.getElementById('contentInformFriendSenderEmailTR').className='';
		}else{
			document.getElementById('contentInformFriendSenderEmailTR').className='notValidValue2';
			valid=false;
		}
	}


	if(valid){

		var ob = {
					success:function(o)
					{
						//alert('success');
		document.getElementById('mailSentInfo').style.visibility = 'visible';
		document.getElementById('addressTo').value = "";
		document.getElementById('fromName').value = "";
		document.getElementById('addressFrom').value = "";

		document.getElementById('wyslijZnajomemyForm').style.display='none';

					},
					failure:function(o)
					{
						//alert('failure');
					}
				}

				var oForm = document.getElementById('mailSend');
				YAHOO.util.Connect.setForm(oForm);

				//var gdzie = document.location.href;

				//var setUrl = 'index.php?page=hotelPrezentacja';
				//var param = "&mailInfo=ok";
				//var param = '&mailInf=sent';

				YAHOO.util.Connect.asyncRequest('GET', '/?page=hotelPrezentacjaMailInfo', ob, null);
				//YAHOO.util.Connect.asyncRequest('POST', '/?page=hotelPrezentacjaMailInfo', ob, param);

	}

		//document.getElementById("mailSend").submit();
	}




function validateAskForm(){
	//alert('2 wysylka dla oferty');
	var valid=true;

	exp=/^[a-z\s_-]+$/i;

	if(exp.test(document.getElementById('imie').value)){
		document.getElementById('contentAskNameTR').className='';
	}else{
		document.getElementById('contentAskNameTR').className='notValidValue';
		valid=false;
	}


	exp=/^[a-z\s_-]+$/i;


	if(exp.test(document.getElementById('nazwisko').value)){
		document.getElementById('contentAskSurnameTR').className='';
	}else{
		document.getElementById('contentAskSurnameTR').className='notValidValue';
		valid=false;
	}

	exp=/^[0-9\s_-]+$/i;


	if(exp.test(document.getElementById('telefon').value)){
		document.getElementById('contentAskPhoneTR').className='';
	}else{
		document.getElementById('contentAskPhoneTR').className='notValidValue';
		valid=false;
	}

	exp=/^[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.]+\.[a-zA-Z]{2,4}$/i;


	if(exp.test(document.getElementById('email').value)){
		document.getElementById('contentAskEmailTR').className='';
	}else{
		document.getElementById('contentAskEmailTR').className='notValidValue';
		valid=false;
	}


	return valid;
}




function showCloud(element){
    var divs=element.getElementsByTagName('div');
    var div=null;
    for(var i=0;i<divs.length;i++){
      div=divs[i];
      if(div.className=="chmura"){
        div.style.display="block";
      }
    }
  }

  function hideCloud(element){
    var divs=element.getElementsByTagName('div');
    var div=null;
    for(var i=0;i<divs.length;i++){
      div=divs[i];
      if(div.className=="chmura"){
        div.style.display="none";
      }
    }
  }

function loadHotelOpinions(id_hotele){
	var callback =
		{
			success: function(o) {
				document.getElementById('hotelOpinions').innerHTML=o.responseText;
			},
			failure: function(o) {}
		};
	if(document.getElementById('hotelOpinions').innerHTML==""){
		document.getElementById('hotelOpinions').innerHTML='<div style="text-align:center;border:1px solid #dcdcdc;border-top:none"><img style="margin-top:15px;margin-bottom:15px" src="http://static.wakacje.pl/wakacje/images/ajax-loader.gif" alt="..." /></div>';
		YAHOO.util.Connect.asyncRequest('GET', '/?page=ajaxOpinieListaCenterOpinionList&flush=buff&id_hotele='+id_hotele, callback, null);
	}
}

function loadCityOpinions(id_panstwa,id_miasta){
	var callback =
		{
			success: function(o) {
				document.getElementById('cityOpinions').innerHTML=o.responseText;
			},
			failure: function(o) {}
		};
	if(document.getElementById('cityOpinions').innerHTML==""){
		document.getElementById('cityOpinions').innerHTML='<div style="text-align:center;border:1px solid #dcdcdc;border-top:none"><img style="margin-top:15px;margin-bottom:15px" src="http://static.wakacje.pl/wakacje/images/ajax-loader.gif" alt="..." /></div>';
		YAHOO.util.Connect.asyncRequest('GET', '/?page=ajaxOpinieListaCenterOpinionList&flush=buff&pokaz=opinieMiejscowosci&id_okol='+id_panstwa+"&id_miasta="+id_miasta, callback, null);
	}
}

function loadOfferMemories(id_panstwa,id_destynacje){
	var callback =
		{
			success: function(o) {
				document.getElementById('offerMemories').innerHTML=o.responseText;
			},
			failure: function(o) {}
		};
	if(document.getElementById('offerMemories').innerHTML==""){
		document.getElementById('offerMemories').innerHTML='<div style="text-align:center;border:1px solid #dcdcdc;border-top:none"><img style="margin-top:15px;margin-bottom:15px" src="http://static.wakacje.pl/wakacje/images/ajax-loader.gif" alt="..." /></div>';
		YAHOO.util.Connect.asyncRequest('GET', '/?page=ajaxWspomnieniaListaCenterMemoList&flush=buff&id_panstwa='+id_panstwa+'&id_destynacje='+id_destynacje, callback, null);
	}
}

function loadCountryGuide(id_panstwa){
	var callback =
		{
			success: function(o) {
				document.getElementById('countryGuide').innerHTML=o.responseText;
				window.przewodnikInfoBookmarks=new BOOKMARKS();
				window.przewodnikInfoBookmarks.getBookmarkElements('przew_content_0','infoBookmark','infoSelectedBookmark','infoContent');
			},
			failure: function(o) {}
		};
	if(document.getElementById('countryGuide').innerHTML==""){
		document.getElementById('countryGuide').innerHTML='<div style="text-align:center;border-left:1px solid #dcdcdc;border-right:1px solid #dcdcdc;"><img style="margin-top:15px;margin-bottom:15px" src="http://static.wakacje.pl/wakacje/images/ajax-loader.gif" alt="..." /></div>';
		YAHOO.util.Connect.asyncRequest('GET', '/?page=ajaxPrzewodnikPrezentacjaCenterCountryInfo&flush=buff&id_okol='+id_panstwa, callback, null);
	}
}


function loadOfferMemories(id_panstwa,id_destynacje){
	var callback =
		{
			success: function(o) {
				document.getElementById('offerMemories').innerHTML=o.responseText;
			},
			failure: function(o) {}
		};
	if(document.getElementById('offerMemories').innerHTML==""){
		document.getElementById('offerMemories').innerHTML='<div style="text-align:center;border:1px solid #dcdcdc;border-top:none"><img style="margin-top:15px;margin-bottom:15px" src="http://static.wakacje.pl/wakacje/images/ajax-loader.gif" alt="..." /></div>';
		YAHOO.util.Connect.asyncRequest('GET', '/?page=ajaxWspomnieniaListaCenterMemoList&flush=buff&id_panstwa='+id_panstwa+'&id_destynacje='+id_destynacje, callback, null);
	}
}

function openGalleryPopup(id){
	window.open('http://www.wakacje.pl/?page=galeria&id_oferty='+id,'gallery','width=775,height=600,left=100,top=20,resizable=1,scrollbars=yes,menubar=no');
}

function urlencode(str){
	str = escape(str);
	str = str.replace(/\+/g, '%2B');
	str = str.replace(/%20/g, '+');
	str = str.replace(/\*/g, '%2A');
	str = str.replace(/\//g, '%2F');
	str = str.replace(/@/g, '%40');
	return str;
}



function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function showOtherTerms(){
	belka=document.getElementById('belka_inne_wyloty');
	belka.className='belka_inne_wyloty_rozwiniete';
	belka.onclick=hideOtherTerms;

	rozwinTabeleWylotow();
}

function hideOtherTerms(){
	belka=document.getElementById('belka_inne_wyloty');
	belka.className='belka_inne_wyloty';
	belka.onclick=showOtherTerms;

	zwinTabeleWylotow();
}


function zwinTabeleWylotow(){
	rollDown('tabela_innych_wylotow',200,1,200);
	setTimeout('document.getElementById("tabela_innych_wylotow").style.display="none"',200);
}
function rozwinTabeleWylotow(){
	document.getElementById("tabela_innych_wylotow").style.display="block";
	rollDown('tabela_innych_wylotow',1,200,200);
}

function setHeight(element_id,height){
	document.getElementById(element_id).style.height=height+'px';
}

function rollDown(element_id,start_height,final_height,time){
	var delay=Math.abs(final_height-start_height)/time;

	if(start_height<final_height){
		for(i=start_height;i<(final_height-10);i+=10)
			setTimeout('setHeight("'+element_id+'",'+i+')',i*delay);
	}else{
		for(i=final_height;i<(start_height-10);i+=10)
			setTimeout('setHeight("'+element_id+'",'+i+')',(start_height-i)*delay);
	}

	setTimeout('setHeight("'+element_id+'",'+final_height+')',(i+10)*delay);
}







		function validateParkingForm()
		{
		 if (document.formularz.imie.value=='') { alert('Podaj imię'); return false;};
		 if (document.formularz.nazwisko.value=='') { alert('Podaj nazwisko'); return false;};
		 if (document.formularz.email.value=='') { alert('Podaj adres e-mail'); return false;};
		 if (document.formularz.telefon_kom.value=='') { alert('Podaj numer telefonu'); return false;};
		 if (document.formularz.nr_rejestracyjny.value=='') { alert('Podaj numer rejestracyjny samochodu'); return false;};

		 if (document.formularz.przyjazdDzien.value==0) { alert('Podaj dzień'); return false;};
		 if (document.formularz.przyjazdMiesiac.value==0) { alert('Podaj miesiąc'); return false;};
		 if (document.formularz.przyjazdRok.value==0) { alert('Podaj rok'); return false;};
		}

var parkingRollmenu=null;

		function initiateParkingRollmenu(){
			if(parkingRollmenu==null){
				parkingRollmenu=new ROLLMENU('parkingRollmenu');
				parkingRollmenu.elementHeights[parkingRollmenu.elementHeights.length]=240;
				parkingRollmenu.elementHeights[parkingRollmenu.elementHeights.length]=277;
				parkingRollmenu.elementHeights[parkingRollmenu.elementHeights.length]=390;
				parkingRollmenu.elementHeights[parkingRollmenu.elementHeights.length]=565;
				parkingRollmenu.rollTime=500;
				parkingRollmenu.fixedHeight=false;
				parkingRollmenu.getBookmarkElements('boxParkingLot','bookmark','selectedBookmark','content');
			}
		}

		function setParkingLotPrice(days){
			switch (days)
			{
			case '1':
			  price="50 zł";
			  break;
			case '2':
			  price="60 zł";
			  break;
			case '3':
			  price="70 zł";
			  break;
			case '4':
			  price="80 zł";
			  break;
			case '5':
			  price="90 zł";
			  break;
			case '6':
			  price="105 zł";
			  break;
			case '7':
			  price="115 zł";
			  break;
			case '8':
			  price="100 zł";
			  break;
			case '9':
			  price="130 zł";
			  break;
			case '10':
			  price="140 zł";
			  break;
			case '11':
			  price="155 zł";
			  break;
			case '12':
			  price="165 zł";
			  break;
			case '13':
			  price="175 zł";
			  break;
			case '14':
			  price="186 zł";
			  break;
			case '15':
			  price="150 zł";
			  break;
			case '16':
			  price="200 zł";
			  break;
			default:
			  price="&nbsp;";
			}

			document.getElementById('cena').innerHTML=price;
			document.getElementById('inputCena').value=price;
		}



function init(){
	przewodnikInfoBookmarks=new BOOKMARKS();
	przewodnikInfoBookmarks.getBookmarkElements('przew_content_0','infoBookmark','infoSelectedBookmark','infoContent');
}
