// JScript File
function ClearAndRelocate(destinationpage){
    if (window.confirm('Are you sure to abandon the current booking?') == true){
        Samples.AspNet.SimpleWebService.ClearSession(Relocate, Stay, destinationpage);
    }
}
function Relocate(result, userContext, methodName){
    window.location = userContext;
}
function Stay(error, userContext, methodName){
    alert(error);
}
function ClearPrefix(fld){
    if (fld.value.substring(0,7) == 'Please ') fld.select();
}

// alternative to alert() © Ax :-)
var _alertwindow_maxcnt = 10;
var _alertwindow_timer = 500;
var _alertwindow_msg = '';
var _alertwindow_w = null;
var _alertwindow_cnt = 0;

function alertwindow(msg)
{
    _alertwindow_w = window.open('/common/js/x.html','xx');
    _alertwindow_msg = msg;
    _alertwindowwait(1);
}

function _alertwindowwait(init)
{
    var ok = false;
    if (init == 1) _alertwindow_cnt = 0;
    else {
        if (_alertwindow_w != null) {
            var w = _alertwindow_w;
            if (w.document) {
                    if (w.document.getElementById('blah')) {
                        w.document.getElementById('blah').innerHTML = '<xmp>' + _alertwindow_msg + '</xmp>';
                        w.focus();
                        ok = true;
                    }
            }
        }
    }
    if (ok == false) {
        if (++_alertwindow_cnt == _alertwindow_maxcnt) {
            if (_alertwindow_w != null) _alertwindow_w.close();
        }
        else {
            setTimeout('_alertwindowwait()', _alertwindow_timer);
        }
    }
}

function popitup(url) {
	newwindow=window.open(url,'name','height=600,width=590');
	if (window.focus) {newwindow.focus()}
	return false;
}
/* Carousel */

/*$(document).ready(function(){
	var heightItem = 77,
		nItems = $('.items ul li').length,
		itemsDisplayed = 3,
		showDisplayed = itemsDisplayed * heightItem;	
	
	$('.prev').addClass('btn-prev');
	$('.next').addClass('next-inactive');
	
	function bindClickTop(){
		var topValue = Math.abs( parseFloat($('.items ul').css('top')));	
			$('.next').addClass('btn-next');		  
			if (topValue === (heightItem * nItems) - showDisplayed ){
				$('.prev').removeClass('btn-prev').addClass('prev-inactive');								
			}
	}
	function bindClickBottom(){
		var topValue = Math.abs( parseFloat($('.items ul').css('top')));			 
			if (topValue === 0){	
				$('.next').removeClass('btn-next').addClass('');
				$('.prev').addClass('btn-prev');
			} 
	}	
	$('.btn-prev').live('click', function(e){
		$('.items ul').stop(true, true).animate({'top': '-='+ heightItem +'px'}, 'fast', bindClickTop);	
		$('.next').removeClass('next-inactive');
		e.stopImmediatePropagation();
		return false;
	})

	$('.btn-next').live('click',function(e){		
		$('.items ul').stop(true, true).animate({'top': '+='+ heightItem +'px'}, 'fast', bindClickBottom);
		e.stopImmediatePropagation();
		return false;
	})
	
	$('.items li a').click(function(){
		var rel = $(this).attr('rel');
		$('.main-content li').hide().each(function(){
			if ( rel == $(this).attr('class')){
				$(this).fadeIn();
			}
		});
		
	})
})*/


