
/*******
*
* INIT
*
*******/

/*
// jQuery Timing mod
function now() { return (new Date).getTime(); }
jQuery.fx.prototype.custom = function( from, to, unit ) {
    this.startTime = now();
    this.start = from;
    this.end = to;
    this.unit = unit || this.unit || "px";
    this.now = this.start;
    this.pos = this.state = 0;

    var self = this;
    function t( gotoEnd ) {
        return self.step(gotoEnd);
    }

    t.elem = this.elem;

    if ( t() && jQuery.timers.push(t) && !jQuery.fx.prototype.timerId ) {
        jQuery.fx.prototype.timerId = setInterval(jQuery.fx.tick, 250);
    }
}

// initial layout setting
var bodyHeight = $(window).height();
document.writeln('<style type="text/css">');
document.writeln('	#complete_height { height:'+bodyHeight+'px; }');
document.writeln('</style>');

// later on - resize layout
function windowResize() {
  bodyHeight = $(window).height();
  $('#complete_height').css('height', bodyHeight + 'px' );
}

// register functions
$(window).resize( windowResize );
*/
$(document).ready( function() {
	
	//windowResize();
	
	overlay = jQuery("#web20_overlay_starter");
	if (overlay != null) overlay.hover(
		woBlendIn,
		woDelayBlendOut
	);
	overlay = jQuery("#wOverlay");
	if (overlay != null) overlay.hover(
		woBlendIn,
		woDelayBlendOut
	);
	blend('wOverlay', 0);
	
	overlay = jQuery("#nl_overlay_starter");
	if (overlay != null) overlay.hover(
		nlBlendIn,
		nlDelayBlendOut
	);
	overlay = jQuery("#nlOverlay");
	if (overlay != null) overlay.hover(
		nlBlendIn,
		nlDelayBlendOut
	);
	blend('nlOverlay', 0);
	
});


/*******
*
* RUNTIME
*
*******/

// Hard-blend In/out elements
function showHide(elemID)
{
	var e = jQuery("#"+elemID);
	var s = jQuery(switcher);
	e.slideToggle('slow', function() {
	
		if (e.css("display") != "none") 
		{
			s.removeClass("showhide-hidden");
			s.addClass("showhide-shown");
		}
		else {	
			s.removeClass("showhide-shown");
			s.addClass("showhide-hidden");
		}
	});
}

// Smooth-blend In/out elements
function blend(elemID, to, speed)
{
	if (speed == undefined) speed = 500;
	var e = jQuery("#"+elemID);
	if (to == 0)
		e.fadeTo( speed, to, function() { e.css('display', 'none'); });
	else {
		e.css('display', 'block');
		e.fadeTo( speed, to);
	}
}
var WOtimerID;
function woBlendIn() {
	if (WOtimerID) window.clearTimeout(WOtimerID);
	blend('wOverlay', 1, 200);
}
function woDelayBlendOut() {
	WOtimerID = window.setTimeout(blend, 500, 'wOverlay', 0);
}
var NLtimerID;
function nlBlendIn() {
	if (NLtimerID) window.clearTimeout(NLtimerID);
	if (jQuery("#nlOverlay")!=undefined)
		blend('nlOverlay', 1, 200);
}
function nlDelayBlendOut() {
	NLtimerID = window.setTimeout(blend, 500, 'nlOverlay', 0);
}

// open window
function openWin(url, width, height, top, left) {
	if (width==null) width = 500;
	if (height==null) height = 307;
	if (top==null)  top = 100;
	if (left==null) left = 100;
	win = window.open(url, "booking", "width=500,height=307,left=100,top=100,status=yes,scrollbars=no,resizable=no");
	win.focus();
}

