/* BASIC JS FUNCTIONS */

function hide(elementID)
{	
   document.getElementById(elementID).style.display = 'none';
}

function show(elementID)
{	
   document.getElementById(elementID).style.display = 'block';
}

function sw(element1,element2)
{
 hide(element1);
 show(element2);
}

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;
		}
}


function switch_img(name)
{
document.all.image.innerHTML="<img src='./userdata/"+name+"'>";	
}

function swap_image(image_ptr,name)
{
image_ptr.src="./userdata/images/"+name;
}

function light_on(obj,color)
{
	obj.style.background=color;
	obj.style.cursor="hand";
}

function light_off(obj,color)
{
	obj.style.background=color;
	obj.style.cursor="";
}

function del_confirm (mylink, otherwise) /* confirm delete{{{*/
{
if(confirm("Do you really want to empty your basket ?"))
   return true;
	
else
   {
   mylink.href=otherwise;
   return false;
   }
}/*}}}*/

function ShowWin(toto)
{
	var win = window.open(toto, "Union", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=300");
	win.focus();
}

function ShowWinW2(toto)
{
	var win = window.open(toto, "Union", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=400");
	win.focus();
}

function TryCallFunction() {
	return;
}

function Today() {
	var dd = new Date();
	return( dd.getDate() + "." + (dd.getMonth()+1) + "." + dd.getFullYear());
}

