function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}


function getSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var ret = new Array(2);
  ret[0] = myWidth;
  ret[1] = myHeight;
  return ret;
}


function updateSize(what1, what2) {
var shader = document.getElementById(what1);
if (shader.style.display=='block') {
	var bug = document.getElementById(what2);
	var size=getSize();
	shader.style.width = size[0]+'px';
	shader.style.height = size[1]+'px';
	bug.style.width = size[0]+'px';
	bug.style.height = size[1]+'px';
	
	var scroll = getScrollXY();
	shader.style.top = scroll[1]+'px';
	shader.style.left = scroll[0]+'px';
	bug.style.top = scroll[1]+'px';
	bug.style.left = scroll[0]+'px';
}
}

function setUpdating() {
updateSize('shader','bug');
}



	var obr = new Image(150,150);
	obr.src='userdata/acc_gif/progress-bar2.gif';



function on_load(anim_id) {

	document.body.onunload = function() { 
		document.getElementById(anim_id).style.display = 'none';
	document.getElementById('shader').style.display = 'none';
	document.getElementById('bug').style.display = 'none';
	};
	
	
	document.getElementById(anim_id).style.display = 'block';

	
	document.getElementById('shader').style.display = 'block';
	document.getElementById('bug').style.display = 'block';	
	
	updateSize('shader','bug');

	document.getElementById(anim_id).style.left = "-"+((document.getElementById(anim_id).offsetWidth)/2)+"px";
	document.getElementById(anim_id).style.top = "-"+((document.getElementById(anim_id).offsetHeight)/2)+"px";
}

function addWaitAnimation() {
//	document.body.innerHTML += '<div id="shader" class="shader_flight"></div><iframe id="bug" frameBorder="0" scrolling="no"></iframe><div id="center_elements"><div class="search_wait" id="flight_search_wait"><div id="wait_bound"><div id="wait_logo" align="center"><img src="./images/logo.jpg" alt="logo" /></div><div id="wait_please">Best choice, Vaša správna voľba touroperátora do celého sveta</div><div align="center"><div id="progress_bar"></div></div><div id="club_card_text" align="center">Systém pre Vás vyhľadáva najlepšiu ponuku leteniek.<br />Ďakujeme za trpezlivosť...</div></div></div>	<div id="dynamic_content"></div></div>';
	on_load('flight_search_wait');
	//window.onscroll = setUpdating;
}



//AIRPORTS ETC...
function wopen(href, width, height) {
  w = window.open(href, "airports", "resizable=yes,scrollbars=yes,width=" + width + ",height=" + height + ",left="+Math.floor((screen.width-width)/2)+",top="+Math.floor((screen.height-height)/2));
  if(w) w.focus();
}


function InitAirports(value)
{
if(value=='')
	return;
var i;
var select=document.forms['search'].from_place_select;
var ssel=0;
for(i=0;i<select.length-1;i++)
{
	if(select.options[i].value==value)
		{
		select.options[i].selected=true;
		ssel=1;
		break;
		}
}

if(ssel)
	return;

select.options[select.length-1].selected=true;
var input=document.forms['search'].from_place;
var div=document.all.from_place_input;
div.style.display='inline';
input.value=value;
}

function SetAirport(name,source)
{
	var parent = window.opener;
	if(!parent)
        return;
	
	s = parent.document.getElementById(source);
	if(parent && s) {
	    s.value = name;
	}
}

function ChooseAirport()
{
	var select=document.forms['search'].from_place_select;
	var div=document.all.from_place_input;
	var input=document.forms['search'].from_place;
	if(select.value==0)
		{
		div.style.display='inline';
		select.style.display='none';
		input.value='';
		}
	else
		{
		div.style.display='none';
		input.value=select.value;
		}
}



