/*///////////////////////////////////////*/
/*/ add to basket /*/
/*///////////////////////////////////////*/
$(function() {
	$('.add-to-basket').livequery('click',function() {
		$('#basket').empty().load($(this).attr('href'));
		return false;
	});
});
/*///////////////////////////////////////*/
/*/ list view /*/
/*///////////////////////////////////////*/
$(function() {
	$('.list-view li a').click(function() {
		$('.list-view li a').removeClass();
		var
		img =$(this).attr('name');
		$(this).addClass('deactivate');
		$('#act').removeClass().addClass(img);
		return false;
	});
	$('.experiences .thumbnails h3 a').hover(
		// Over
		function() {
		var margin = '125px';
		$('strong', this).show().animate({"marginBottom": margin}, "normal");
		return false;
		},
		// Out
		function(){
		var margin = '-125px'
		$('strong', this).animate({"marginBottom": margin}, "normal");
		return false;
	});
});
/*///////////////////////////////////////*/
/*/ experience title slide up /*/
/*///////////////////////////////////////*/
$(function(){
	$('.experience div').hide(0);
	$('.experience a img').hover(function(){
		var
		parent = $(this).parent();
		node = $(parent).prev();
		$(node).show();
		return false;
	}, function(){
		var
		parent = $(this).parent();
		node = $(parent).prev();
		$(node).hide();
	});
});
/*///////////////////////////////////////*/
/*/ contact us /*/
/*///////////////////////////////////////*/
$(function() {
	// this opens the balloon section
	$('.contact span').hide(0);
	$('.contact a').click(function(){
		var
		href=$(this).attr('rel');
		$('.contact span').fadeIn('slow').load(href);
		$('.contact span').ScrollTo('slow');
		return false;
	});
	
	$('.contact span a').livequery('click',function() {
		$('.contact span').hide();
		return false;
	 });
	
});
/*///////////////////////////////////////*/
/*/ menu /*/
/*///////////////////////////////////////*/
$(function(){
	$('#menu li ul').hide(0);
	$('#menu li .categories').click(function(){

		var
			el = $(this).parent(),
			node = $(this).next();

		$('#menu li').removeClass('selected');

		$('#menu li ul').each(function(){
			if( $(this).is(':visible') && $(this).get(0) != $(node).get(0) )
				$(this).hide();
		});

		$(node).is(':hidden') ?
		$(node).show('', function(){ $(el).addClass('selected') }) :
		$(node).hide('', function(){ $(el).removeClass('selected') }) ;
 return false;
	});
});
/*///////////////////////////////////////*/
/*/ activity / category desc /*/
/*///////////////////////////////////////*/
$(function(){
	$('.header div').hide(0);
	$('.header h2').click(function(){

		var
			el = this,
			node = $(this).next();

		$('.header div').each(function(){
			if( $(this).is(':visible') && $(this).get(0) != $(node).get(0) )
				$(this).hide();
		});

		$(node).is(':hidden') ?
		$(node).show('', function(){ $(el).addClass('selected') }) :
		$(node).hide('', function(){ $(el).removeClass('selected') }) ;
 return false;
	});
});
/*///////////////////////////////////////*/
/*/ buy a balloon /*/
/*///////////////////////////////////////*/
$(function() {
	// this opens the balloon section
	$('#choose-a-balloon').hide(0);
	$('.buy-with-balloon a').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 .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;
	});
});
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//innerfade//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){
$('#gift-experiences #rotate').innerfade({ speed: 'slow', timeout: 4000, type: 'sequence', containerheight: '244px' });
} ); 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//jq-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);
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//expandable menu//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){

$('#summary dd').hide(0);
$('#summary dt').css('cursor', 'pointer');

$('#summary dt').click(function(){

var
el = this,
node = $(this).next();

$(node).is(":hidden") ?
$(node).show(0) && $(el).addClass('expanded') :
$(node).hide(0) && $(el).removeClass('expanded') ;

});

$('#expand-all').click(function(){
	$('#summary dd').show( 0 );return false;
});

$('#close-all').click(function(){
	$('#summary dd').hide( 0 );return false;
});

} ); 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//micro tabs//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){
$('#tabs').tabs();
} );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//clear-form-input
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 