function floating(iX,iY,id){
    var L=dD.getElementById?dD.getElementById(id):dD.all?dD.all[id]:dD.layers[id];              
    this[id+'O']=L;if(dD.layers)L.style=L;L.nX=L.iX=iX;L.nY=L.iY=iY;
    L.P=function(x,y){this.style.left=x+px;this.style.top=y+px;};L.Fm=function(){var pX, pY;    
    pX=(this.iX >=0)?0:nn?innerWidth:nn&&dH.clientWidth?dH.clientWidth:dB.clientWidth;  
    pY=nn?pageYOffset:nn&&dH.scrollTop?dH.scrollTop:dB.scrollTop;       
    if(this.iY<0)pY+=nn?innerHeight:nn&&dH.clientHeight?dH.clientHeight:dB.clientHeight;        
    this.nX+=.1*(pX+this.iX-this.nX);this.nY+=.1*(pY+this.iY-this.nY);this.P(this.nX,this.nY);
    setTimeout(this.id+'O.Fm()',63);};
    return L;
}


/*
    Functions for front - date element changes
*/

/*
*   Get date element part
*/
function getDatePart(form, fieldName, part){
    var field = 'data[form][VALUE_'+fieldName+'_'+part+']';
    return parseInt(document.forms[form][field].value);
}

/*
*   Set date element part
*/
function setDatePart(form, fieldName, part, newValue){
    var field = 'data[form][VALUE_'+fieldName+'_'+part+']';
    document.forms[form][field].value = newValue;
}

/*
*   Copy date fields from one element to other
*/
function cmsSetDateTo(form, fieldTo, fieldFrom){
    setDatePart(form, fieldTo, 'year',  getDatePart(form, fieldFrom, 'year'));
    setDatePart(form, fieldTo, 'month', getDatePart(form, fieldFrom, 'month'));
    setDatePart(form, fieldTo, 'day',   getDatePart(form, fieldFrom, 'day'));
}

/*
*   If date in second arg is less than date in third sets value of the smaller to be equal
*/
function cmsSetDateNoLess(form, fieldTo, fieldFrom){
    var fromYV  = getDatePart(form, fieldFrom, 'year');
    var fromMV  = getDatePart(form, fieldFrom, 'month');
    var fromDV  = getDatePart(form, fieldFrom, 'day');
    var toYV    = getDatePart(form, fieldTo, 'year');
    var toMV    = getDatePart(form, fieldTo, 'month');
    var toDV    = getDatePart(form, fieldTo, 'day');
    var wrong = false;



    if(toYV < fromYV){
        //check year
        wrong = true;
        //alert('year wrong');
    } else {
        //check month if same year
        if(toYV == fromYV && toMV < fromMV){
            wrong = true;
            //alert('day month');
        }else{
            //check day if year and month the same
            if(toYV == fromYV && toMV == fromMV && toDV < fromDV){
                wrong = true;
                //alert('day wrong');
            }
        }
    }

    if( wrong == true ){
        cmsSetDateTo(form, fieldTo, fieldFrom);
    }
}







/*
function bke_update_dropdown(form,dd,mm,yyyy) {
  d1 = new Date (yyyy, mm-1, dd);
  dd++;
  d2 = new Date (yyyy, mm-1, dd);
  form.bke_arrival_day.value = d1.getDate();
  form.bke_departure_day.value = d2.getDate();
  form.bke_arrival_month.value = d1.getMonth() + 1;
  form.bke_departure_month.value = d2.getMonth() + 1;
  form.bke_arrival_year.value = d1.getYear();
  form.bke_departure_year.value = d2.getYear();
}

function bke_selectForm(form) {
        var hotelNumber = document.forms[form].hotelNumber;

        if( hotelNumber == 1 ){
                document.forms[form].action = 'test_hotel1.php';
        }else if( hotelNumber == 2 ){
                document.forms[form].action = 'test_hotel2.php';
        }else if( hotelNumber == 3 ){
                document.forms[form].action = 'test_hotel3.php';
        }else if( hotelNumber == 4 ){
                document.forms[form].action = 'test_hotel4.php';
        }
        alert(document.forms[form].action);
}
*/



function addToBookmarks(title, url){
    if (document.all){
        window.external.AddFavorite(url, title);
    }else{
        if (window.sidebar){
            window.sidebar.addPanel(title, url, "");
        }
    }
}


function showImageDiv(divId, image, className, alt){
    element = document.getElementById(divId);
    element.innerHTML = '<img src="' + image + '" border=0 class="'+className+'" alt="'+alt+'">';
}

function replaceHtml(divId, newHtml){
    element = document.getElementById(divId);
    element.innerHTML = newHtml;
}

//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function replaceDivFromAjax(){
    var myajax=ajaxpack.ajaxobj
    var myfiletype=ajaxpack.filetype
    if (myajax.readyState == 4){
        //if request of file completed
        if (myajax.status==200 || window.location.href.indexOf("http")==-1){
            //if request was successful or running script locally
            if (myfiletype=="txt"){
                replaceHtml("divFromAjax", myajax.responseText);
            }else{
                replaceHtml("divFromAjax", myajax.responseXML);
            }
        }
    }
}


function swapInnerHtml(id,newHtml) {
    var obj = document.getElementById(id);
    obj.innerHTML = newHtml;
}


function closefl(o){
	if (o = document.getElementById(o))
		o.style.display = 'none';
}


function show_popup(what, w, h)
{
        w=window.open(what,"Image","width=" + w + ",height=" + h + ",scrollbars=YES,resizable=YES",1);
}

