var iberooturl='';
var basecgurl='http://ibe01.merlinx.pl/';
var valurl='action=validate';
var depurl='action=deplist&sp=4';
var valprefixurl='';
document.imgn=new Object();
document.imgn['submit']=new Array(1,'/customgraphics/submit/type5.gif');document.imgn['back']=new Array(2,'/customgraphics/back/type5.gif');document.imgn['listarrow']=new Array(3,'/customgraphics/listarrow/type3.gif');document.imgn['calnavleft']=new Array(4,'/customgraphics/calnavleft/type5.gif');document.imgn['calnavright']=new Array(5,'/customgraphics/calnavright/type5.gif');document.imgn['hotelstar']=new Array(6,'/customgraphics/hotelstar/type5.gif');document.imgn['calendar']=new Array(11,'/customgraphics/calendar/type5.gif');document.imgn['close']=new Array(8,'/customgraphics/close/type1.gif');document.imgn['clear']=new Array(22,'/customgraphics/clear/type5.gif');document.imgn['accept']=new Array(21,'/customgraphics/accept/type5.gif');document.imgn['help']=new Array(12,'/customgraphics/help/type5.gif');document.imgn['book']=new Array(13,'/customgraphics/book/type5.gif');document.imgn['tobook']=new Array(14,'/customgraphics/tobook/type5.gif');document.imgn['sun']=new Array(15,'/customgraphics/sun/type1.gif');document.imgn['water']=new Array(16,'/customgraphics/water/type2.gif');document.imgn['listarrowr']=new Array(17,'/customgraphics/listarrowr/type5.gif');document.imgn['listarrowd']=new Array(18,'/customgraphics/listarrowd/type5.gif');document.imgn['bullet']=new Array(19,'/customgraphics/bullet/type5.gif');document.imgn['info']=new Array(20,'/customgraphics/info/type5.gif');document.imgn['map']=new Array(23,'/customgraphics/map/type1.gif');document.imgn['zoover']=new Array(24,'/customgraphics/zoover/type1.gif');document.imgn['hotelstarp']=new Array(25,'/customgraphics/hotelstarp/type5.gif');function imgsrc(name)
{
return " in='"+name+"' src='"+document.imgn[name][1]+"' ";
}
function setimgonobj(o,name)
{
o.src=''+document.imgn[name][1];
o.setAttribute('in',name);
}
//setup for JS objects:
//calender, in ibe.js
var calHeader = 'Proszę wybrać datę';
var months = new Array('styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec',
                          'sierpień','wrzesień','październik','listopad','grudzień');
var week_days_text = Array('pn','wt','śr','cz','pt','so','nd');
//dest.class
var imagespath = '';
//all steps
var searchtypeSubmit = '';
var searchtypeRadio  = '';
//tooltips, in ibe.js
var directory="img/tooltip/green/";
var tooltip_msg=new Array();
tooltip_msg['calendar_tooltip1']  =new Array('<b>Okres podróży - najwcześniejszy termin wyjazdu.<br></b>Tutaj określa się najwcześniejszy termin wyjazdu, jaki<br>jest możliwy dla Państwa. Można podać każdą datę.',340,'lt',1);
tooltip_msg['calendar_tooltip2']  =new Array('<B>Okres podróży - najpóźniejszy termin powrotu.</B><BR>Tutaj określa się najpóźniejszy termin powrotu, jaki<BR>jest możliwy dla Państwa. Można podać każdą datę.',340,'lt',1);
tooltip_msg['destpanel_tooltip']  =new Array('<b>Miejsce podróży.<br></b> Określ preferowany cel podróży. Jeśli chcesz<br>poszukać we  wszystkich ofertach, wybierz \"dowolny\" albo pozostaw to pole puste.',340,'lt',1);
tooltip_msg['departure_tooltip']  =new Array('Lista wyjazdu/wylotu po zmianie terminu i wyszukaniu może ulec zmianie.',340,'lt',1);
tooltip_msg['flightpanel_tooltip']  =new Array('Port lotniczy<br><hr><b>Tutaj można wybrać do 3 portów lotniczych dla Waszej <br />podróży. Proponowane Wam oferty będą zawierały podróże <br />jedynie z tymi portami lotniczymi.</b>',350,'lt',1);
tooltip_msg['kidsage_tooltip']  =new Array('Proszę podać wiek podróżujących dzieci <br /><b>Dokładny wiek dzieci w chwili wyjazdu <br />jest bardzo ważny dla określenia ceny podróży.</b>',320,'lt',1);
tooltip_msg['trippacket_tooltip']  =new Array('<b>Wasz Pakiet Podróżny</b><br /><span>Tutaj znajdziecie Państwo zarówno wybrany dla Was Pakiet Podróżny<br />jak i dalsze propozycje mieszczące się w podanym terminie. <br />Poniżej, wybierając loty Tam i Powrót można utworzyć wiele <br />kombinacji lotów dla porónania. Po kliknięciu na wybraną <br />kombinację lotów, właśnie ona zostanie wybrana do zarezerwowania!',345,'lt',1);
tooltip_msg['combineitself_tooltip']=new Array('Proszę wybrać alternatywny lot tam i z powrotem.<br />System obliczy nową cenę zgodnie z Waszym wyborem.',345,'lt',1);
tooltip_msg['pricechart_tooltip']=new Array('xxx',345,'lt',1);
tooltip_msg['attr_tooltip']=new Array('<b>Udogodnienia.</b><br /> Określ preferowane udogodnienia. <br />Jeśli chcesz poszukać we  wszystkich ofertach, pozostaw pola wyboru puste.',345,'lt',1);
var AnyText='dowolny';
function onChangeChildage(_el){
var stChild = document.getElementById('child1AgeSel');
var ndChild = document.getElementById('child2AgeSel');
var rdChild = document.getElementById('child3AgeSel');
if(_el.value =='')
{
if(_el.id=='child3AgeSel')
return;
if(_el.id=='child1AgeSel')
stChild.value = ndChild.value;
ndChild.value = rdChild.value;
return rdChild.value = '';
}
if(_el.value =='' ||_el.id=='child1AgeSel')
return;
if(stChild.value == '')
{
stChild.value = _el.value;
return _el.value='';
}
if(ndChild.value == '')
{
ndChild.value = _el.value;
return _el.value='';
}
}
function onClikMoreCriteria(_el){

	var height 	= document.getElementById('search_main').style.height;
	var length	= height.length-2
	var height	= height.substr(0,length);
	var height	= parseFloat(height)+120;
	
	document.getElementById('search_main').style.height = height+'px';
	
	if(document.getElementById('left'))
	{
	var margin 	= document.getElementById('left').style.marginTop;
	
	var length	= margin.length-2
	var margin	= margin.substr(0,length);
	var margin	= parseFloat(margin)-120
	
	document.getElementById('left').style.marginTop	= margin+'px';
	}
	
document.getElementById('moreCriteria').style.display = '';
document.getElementById('lessCriteriaLink').style.display = '';
_el.style.display = 'none';
Cookies.set('ep3_fulsearchform',1,600);
showHideCallPopups();
//document.optlistpopup.hide();
}
function onClikLessCriteria(_el){
	
	var height 	= document.getElementById('search_main').style.height;
	var length	= height.length-2
	var height	= height.substr(0,length);
	var height	= parseFloat(height)-120
	
	document.getElementById('search_main').style.height = height+'px';
	
var margin 	= document.getElementById('left').style.marginTop;
	
	var length	= margin.length-2
	var margin	= margin.substr(0,length);
	var margin	= parseFloat(margin)+120
	
	document.getElementById('left').style.marginTop	= margin+'px';
	
document.getElementById('moreCriteria').style.display = 'none';
document.getElementById('moreCriteriaLink').style.display = '';
_el.style.display = 'none';
Cookies.set('ep3_fulsearchform',0,600);
showHideCallPopups();
//document.optlistpopup.hide();
}
function showHideCallPopups(){
}
function ep3_registerOver(tagName){
tagName = tagName.toUpperCase();
var els = document.getElementsByTagName(tagName);
var atr = null;
for(var i=0; i<els.length; i++)
{
atr = els[i].getAttribute('ep3_mouseover');
if(atr){
atr = atr.split('@');
if(atr.length == 1){
atr[1] = atr[0];
atr[0] = els[i].className;
}
els[i].setAttribute('ep3_mouseout', els[i].className);
els[i].setAttribute('ep3_mouseover', els[i].className.replace(atr[0], atr[1]) );
els[i].onmouseover = function (){
this.className=this.getAttribute('ep3_mouseover');
};
els[i].onmouseout  = function(){
this.className=this.getAttribute('ep3_mouseout');
};
}
}
}
var ep3_fakeElement = document.createElement('div');
function byID(id){
return document.getElementById(id)||ep3_fakeElement;
}
function showVByID(id){
byID(id).style.visibility = '';
}
function hideVByID(id){
byID(id).style.visibility = 'hidden';
}
function showByID(id){
byID(id).style.display = '';
}
function hideByID(id){
byID(id).style.display = 'none';
}
var __ifr;
function calendarShow(_curr_date, _target, _direction, _from_date, _till_date)
{ 
calendarHide();
direction = _direction;
if(direction=='go')
calendar=document.getElementById('calendar_div');
if(direction=='back')
calendar=document.getElementById('calendar_div2');
if(!calendar)
return;
calendar.parentNode.style.position = 'relative';
calendar.style.display = '';
var pos = findPos(calendar.parentNode);
if(getpageWidth()< pos[0]+355)
calendar.style.right="0px";
else 
calendar.style.right = null;
if(_from_date == null)
{ 
var offsetedDate = new Date();
offsetedDate.setDate(offsetedDate.getDate());
_from_date = '0'+offsetedDate.getDate()+'0'+(offsetedDate.getYear()-100)
+'0'+(offsetedDate.getMonth()+1);
}
date_ctrl = document.getElementById(_target);
from_date = _from_date;
till_date = _till_date;
curr_date = parseDate(_curr_date);
if (!curr_date)
curr_date = new Date();
if (curr_date<parseDate(document.getElementById('calInput1').value))
curr_date=parseDate(document.getElementById('calInput1').value);
from_date = parseDate(from_date);
till_date = parseDate(till_date);
setCalendar();
//document.optlistpopup.hide();
}
function setCalendar(year, month)
{ 
var mtable;
if(!calendar)
return;
if (year == null)
year = curr_date.getFullYear();
if (month == null)
month = curr_date.getMonth();
days[1] = (isLeap(year) ? 29 : 28);
draw_date = new Date(year, month, 1);
mtable ='<div class="yui-calcontainer color11bg color1bo" id="ep3_autogencal">';
mtable += '<div class="title">';
if(isFromDeeplink)
{ 
mtable += '<img '+imgsrc('close')+' onclick="if(calendar) class="close-icon" calendar.style.display=\'none\';" alt="[Close]" />';
mtable += calHeader;
}
else
{ 
mtable += calHeader;
if(direction == 'go')
{ 
mtable += '<a href="javascript:void(0)" onclick="return false;"><img '+imgsrc('help')+' class="help-icon" align="absmiddle" style="margin-right:3px;" onmouseover="ep_show(this,'+"'calendar_tooltip1'"+')" onmouseout="ep_hide(this)" /></a>';
mtable += '<img '+imgsrc('close')+' class="close-icon" onClick="calendarHide();" alt="" align="absmiddle" style="cursor:pointer; margin-right:3px;"/>';
}
if(direction == 'back')
{ 
mtable += '<img '+imgsrc('close')+' class="close-icon" onClick="calendarHide();" align="absmiddle" alt="" style="cursor:pointer; margin-right:3px;"/>';
mtable += '<a href="javascript:void(0)" onclick="return false;"><img '+imgsrc('help')+' class="help-icon" style="margin-right:3px;" onmouseover="ep_show(this,'+"'calendar_tooltip2'"+')" onmouseout="ep_hide(this)" align="absmiddle" /></a>';
}
}
mtable += '</div>';
mtable += '<div style="width:325px; position:relative;"><div class="cal2up" style="margin-left:5px;" >'+getMonthHTML('first')+'</div>';
mtable += '<div class="cal2up" style="right:5px;position:absolute;">'+getMonthHTML('second')+'</div></div>';
mtable += '</div>';
calendar.innerHTML = mtable;
var myheight = document.getElementById('ep3_autogencal');
if(myheight && myheight.style.pixelHeight != undefined){
__ifr = document.getElementById(calendar.id + '_ie')
if(__ifr){
__ifr.style.height = Math.max(myheight.offsetHeight*1 - 2, 145)+'px';
__ifr.style.display='';
if(calendar.style.right)
__ifr.style.right="0px";
else 
__ifr.style.right = null;
}
}//is IE
}
function calendarHide(){
if(calendar)
{
calendar.parentNode.style.position = 'static';
calendar.style.display = 'none';
}
if(__ifr){
__ifr.style.display = 'none';
}
}
function insertDate(year, month, day)
{ 
if(day<10)
day = '0'+(day);
if((month+1)<10)
month = '0'+(month+1);
else
month = month+1;
date_ctrl.value = day+'.'+month+'.'+year;
{
if(direction == 'go')
document.getElementById('calInput2').value=incDate2(day+'.'+month+'.'+year,20);
}
calendarHide();
}
function getMonthHTML(number)
{ var year = draw_date.getFullYear();
var month = draw_date.getMonth();
var day = 1;
var d = draw_date.getDay()-1;
if (d == -1)
d = 6;
var active = 0;
var tmp = '';
var bgr = '';
result  = '<table class="yui-calendar" cellpadding="0" cellspacing="0" border="0" width="100%" align="center" style="margin-top:3px;margin-bottom:3px;">';
result += '<thead>';
result += '<tr><th colspan="7" class="calhead"><div class="calheader">';
if(number=='first')
result += '<img '+imgsrc('calnavleft')+' class="calnavleft" style="margin:1px" align="absbottom" onclick="changeMonth(0)" alt="'+prev_mon_text+'"/>';
result += months[month]+'&nbsp;'+year;
if(number=='second')
result += '<img '+imgsrc('calnavright')+' class="calnavright" style="margin:1px" align="absbottom" onclick="changeMonth(1)" alt="'+next_mon_text+'"/>';
result += '</div></th>';
result += '</tr>';
result += '<tr>';
for(var i =0; i<6; i++)
result += '<th class="calweekdaycell">'+week_days_text[i]+'</th>';
result += '<th class="calweekdaycell">'+week_days_text[6]+'</th>';
result += '</tr></thead><tbody>';
for (var i = 0; i < 7 && day <= days[month]; i++)
{ for (var j = 0; j < 7; j++)
{ if ((i == 0 && j < d) || (day > days[month]))
{ tmp += getDayHTML(year, month, 0, 'oom calcell', 0);
}
else
{ active = 1;
if (!week_days[(j == 6) ? 0 : j+1])
{ active = 0;
}
else
{ //if (from_date && draw_date.getTime() < from_date.getTime())
//  active = 0;
//if (till_date && draw_date.getTime() > till_date.getTime())
//  active = 0;
}
if (active)
bgr = (j == 6 ? 'calcell' : 'calcell');
else
bgr = 'oom calcell';
tmp += getDayHTML(year, month, day, bgr, active);
draw_date.setDate(++day);
}
}
result += '<tr align="center">'+tmp+'</tr>';
tmp = '';
}
result += '</tbody></table>';
return result;
}
function ep3_getSearchType(){
return  document.getElementById('searchtype')?document.getElementById('searchtype').value:'PA';
}
