/*///////////////////////////////////////*/
/*/ tabs /*/
/*///////////////////////////////////////*/
$(function(){
	$('#tabs').tabs();
});
/*///////////////////////////////////////*/
/*/ add to basket /*/
/*///////////////////////////////////////*/
$(function() {
	$('.add-to-basket').livequery('click',function() {
		$('#basket').empty().load($(this).attr('rel'));
		return false;
	});
});
/*///////////////////////////////////////*/
/*/ buy a balloon /*/
/*///////////////////////////////////////*/
$(function() {
	// this opens the balloon section
	$('#choose-a-balloon').hide(0);
	$('.buy-with-balloon').click(function(){
		var
		href=$(this).attr('rel');
		$('#choose-a-balloon').fadeIn('slow').load(href);
		$('#top').ScrollTo('slow');
		return false;
	});
	// this closes the balloon section
	$('.#choose-a-balloon h3 .close').livequery('click',function() {
		$('#choose-a-balloon').hide();
		return false;
	 });
	// this opens the category menus
	$('#balloons li ul').livequery(function(){ $(this).hide(0)});
	$('#balloons li a').livequery('click', function(){
		var
		el = this,
		node = $(this).next();
		
		$('#balloons li ul').each(function(){
			if( $(this).is(':visible') && $(this).get(0) != $(node).get(0) )
				$(this).hide();
		});
			
		$(node).is(":hidden") ?
		$(node).show(0) && $(el).addClass('expanded') :
		$(node).hide(0) && $(el).removeClass('expanded') ;
	});
	// this loads the category images
	$('#balloons li a').livequery('mouseover',function() {
		var
		rel=$(this).attr('rel');
		$('#balloon').empty().load(rel);
		return false;
	});
	// this loads the balloon images
	$('#balloons li ul li a').livequery('mouseover',function() {
		var
		rel=$(this).attr('rel');
		$('#balloon').empty().load(rel);
		return false;
	})
	// this loads the balloon details
	$('#balloons li ul li a').livequery('click',function() {
		var
		href=$(this).attr('href');
		$('#balloon-details').empty().load(href).show();
		
		return false;
	});
	// this closes the balloon details
	$('#balloon-details a.closethis').livequery('click',function() {
		var
		href=$(this).attr('href');
		$('#balloon-details').hide();
		
		return false;
	});
});
/*///////////////////////////////////////////////////*/
/*/ ajax window /*/
/*///////////////////////////////////////////////////*/
$(function() {
	// this displays ajax div
	$('.ajax').click(function(){
		var rel=$(this).attr('rel');
		$('#ajax').empty().load(rel).show();
		//$('body').append('<div id="overlay"></div>');
		return false;
	});
	function close_ajax(){
		$('#ajax').hide();
		$('#overlay').remove();
	}
	// this closes the ajax div
	$('#ajax h2 a').livequery('click',function() {
		close_ajax();
		return false;
	});
	$('#overlay').livequery('click',function() {
		close_ajax();
		return false;
	});
});
/*///////////////////////////////////////////////////*/
/*/ clear-form-input /*/
/*///////////////////////////////////////////////////*/
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
/*///////////////////////////////////////*/
/*/ package details /*/
/*///////////////////////////////////////*/
$(function(){
	
	$('.full').hide(0);
	$('.read-more').click(function(){
		var
		parent = $(this).parent().parent().attr('id');
		full = '#'+parent+' .full';
		readmore = '#'+parent+' .read-more';
		button = '#'+parent+' form button';
		$('.read-more').empty().append(' ...<a href="#">Read More</a>').show();
		$(readmore).hide();
		$('.full').hide();
		$('#column1 form button').removeClass();
		$(button).addClass('selected')
		$(full).show();
		return false;
	});
	
});
/*///////////////////////////////////////*/
/*/ package intro /*/
/*///////////////////////////////////////*/
$(function(){
		   
	$('#package-intro ul li a').mouseover(function(){
		$('#package-intro ul li a').removeClass('current');
		$(this).addClass('current');
		
		var
		package = $(this).attr('rel');
		cls = 'a'+package;
		$('#package-intro div').removeClass().addClass(cls);
	});
	
	$('#package-intro ul li a').click(function(){		   
		$('#book-online').hide();
		$('#venue-list').show().load($(this).attr('href'));
		return false;
	});
	
});
/*///////////////////////////////////////////////////*/
/*/ innerfade /*/
/*///////////////////////////////////////////////////*/
$(function(){
$('#slideshow').innerfade({ speed: 'slow', timeout: 4000, type: 'sequence', containerheight: '177px' });
} ); 
/*///////////////////////////////////////////////////*/
/*/ innerfade /*/
/*///////////////////////////////////////////////////*/
$.fn.innerfade = function(options) {
return this.each(function(){ 
						   
var settings = {
speed: 'normal',
timeout: 2000,
type: 'sequence',
containerheight: 'auto'
}

if(options)
$.extend(settings, options);

var elements = $(this).children().get();

if (elements.length > 1) {

$(this).parent().css('position', 'relative');

$(this).css('height', settings.containerheight);

for ( var i = 0; i < elements.length; i++ ) {
$(elements[i]).css('z-index', elements.length - i).css('position', 'absolute');
$(elements[i]).hide();
}

if ( settings.type == 'sequence' ) {
setTimeout(function(){
$.innerfade.next(elements, settings, 1, 0);
}, settings.timeout);
$(elements[0]).show();
}
else if ( settings.type == 'random' ) {
setTimeout(function(){
do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 )
$.innerfade.next(elements, settings, current, 0);
}, settings.timeout);
$(elements[0]).show();
}
else {
alert('type must either be \'sequence\' or \'random\'');
}

}

});
};

$.innerfade = function() {}
$.innerfade.next = function (elements, settings, current, last) {

$(elements[last]).fadeOut(settings.speed);
$(elements[current]).fadeIn(settings.speed);

if ( settings.type == 'sequence' ) {
if ( ( current + 1 ) < elements.length ) {
current = current + 1;
last = current - 1;
}
else {
current = 0;
last = elements.length - 1;
}
}
else if ( settings.type == 'random' ) {
last = current;
while (current == last ) {
current = Math.floor ( Math.random ( ) * ( elements.length ) );
}
}
else {
alert('type must either be \'sequence\' or \'random\'');
}
setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout);
};