//***********************************************************************//
//						CORE javascript functions
//***********************************************************************//

function ById(id) { return (document.getElementById(id)); }
function isset(v) { return ((typeof (v) == 'undefined' || v.length == 0) ? false : true); }
function empty(v) { return ((v.length == 0) ? false : true); }
function is_obj(v) { return ((typeof (v) == 'object') ? true : false); }
function in_array(array, value) { for (var i in array) if (array[i] == value) return true; }


//************************************************************************************************************
//												ELEMENT EFFECTS
//************************************************************************************************************

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
    document.getElementById(id).style.visibility = 'visible';

    //determine the direction for the blending, if start and end are the same nothing happens
    if (opacStart > opacEnd) {

        var o = ById(id);

        for (i = opacStart; i >= opacEnd; i--) {

            setTimeout("changeOpacDown(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    } else if (opacStart < opacEnd) {
        for (i = opacStart; i <= opacEnd; i++) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function changeOpacDown(opacity, id) {

    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
   
}

function AmenitiesFade() {

    var af = ById("amenSrc");

    af.style.display = 'block';
    opacity("amenSrc", 0, 100, 300);
}

function AmenitiesHide() {
    ById("amenSrc").style.opacity = 0;
    ById("amenSrc").style.filter = "alpha(opacity = 0)";
    ById("amenSrc").style.display = 'none';
}

function ClearTip(o, word) {
    if (o.value == word) {
        o.value = "";
    }
}

function Close() {
   
    //var af = ById("amenSrc");
    //if (af.style.display == 'block')
      //  af.style.display = 'none';
}
    