function change(currentbox)
{
  var numb = currentbox.id.split("_");
  var currentbox = numb[1];
  var i=parseInt(currentbox)+1;
  // I empty all combo boxes following the current one
  var _t=eval("typeof(document.getElementById('combo_"+i+"'))!='undefined'");
  while (_t && document.getElementById("combo_"+i)!=null)
  {
    var son = document.getElementById("combo_"+i);
    // I empty all options except the first (it isn't allowed)
    for (m=son.options.length-1;m>0;m--)
      son.options[m]=null;
    // I reset the first option
    son.options[0]=new Option(displaywhenempty,valuewhenempty);
    i=i+1;
  }

  // now I create the string with the "base" name ("stringa"), ie. "data_1_0"
  // to which I'll add _0,_1,_2,_3 etc to obtain the name of the combo box to fill
  var stringa='data';
  i=0;
  _t=eval("typeof(document.getElementById('combo_"+i+"'))!='undefined'");
  while (_t && document.getElementById("combo_"+i)!=null)
  {
    eval("stringa=stringa+'_'+document.getElementById(\"combo_"+i+"\").selectedIndex");
    if (i==currentbox)
      break;
    i=i+1;
  }

  // filling the "son" combo (if exists)
  var following=parseInt(currentbox)+1;
  _t=eval("typeof(document.getElementById('combo_"+following+"'))!='undefined'");
  if (_t && document.getElementById("combo_"+following)!=null)
  {
    son=document.getElementById("combo_"+following);
    stringa=stringa+"_";
    i=0;
    while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0))
    {
      // if there are no options, I empty the first option of the "son" combo
      // otherwise I put "-select-" in it
      if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
        if (eval("typeof("+stringa+"1)=='undefined'"))
          eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)");
        else
          eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)");
        else
          eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
      i++;
    }
    //son.focus();
    i=1;
    combostatus='';
    cstatus=stringa.split("_");
    while (cstatus[i]!=null)
    {
      combostatus=combostatus+cstatus[i];
      i=i+1;
    }
    return combostatus;
  }
}



function goSearch()
{
	sLink	= '';
	switch ( document.search.kat.value )
	{
		case '1': sLink	= 'index.php?main=last'; break;
		case '2': sLink	= 'index.php?main=daleka'; break;
		case '3': sLink	= 'index.php?main=europska'; break;
		case '4': sLink	= 'index.php?main=mediteran'; break;
		case '5': sLink	= 'index.php?main=odmor'; break;
	}
	if ( sLink	== '' )
	{
		alert( 'Molimo, odaberite tip ponude!' );
	}
	else
	{
		document.search.action	= sLink;
		document.search.submit();
	}
}

function top() {
  window.scrollTo(0, 0);
}

function back() {
  history.back();
}

function slika(ime,x,y) {
  eval("window.open('slika.php?s=" + ime + "','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+ x +" ,height="+ y +"')");
}
