// hide landing page
function aaa(){
	$('#fullSWF').hide();
};

// jQuery - slideToggle
$(document).ready(function(){
	$(".btn_showMapDestinations").click(function(){
		$("#mapDestinationsPanel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	$(".btn_sitemap").click(function(){
		$("#sitemapPanel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	$("#showGmap").click(function(){
		$("#toggleShowGmap").slideToggle("slow");
		if( !$("#toggleShowComment").is(':hidden') )
		{
			$("#toggleShowComment").slideToggle("slow");
		}
		if( !$("#toggleShowPost").is(':hidden') )
		{
			$("#toggleShowPost").slideToggle("slow");
		}
		$(this).toggleClass("active"); return false;
	});
	$("#showComment").click(function(){
		$("#toggleShowComment").slideToggle("slow");
		if( !$("#toggleShowGmap").is(':hidden') )
		{
			$("#toggleShowGmap").slideToggle("slow");
		}
		if( !$("#toggleShowPost").is(':hidden') )
		{
			$("#toggleShowPost").slideToggle("slow");
		}
		$(this).toggleClass("active"); return false;
	});
	$("#showPost").click(function(){
		$("#toggleShowPost").slideToggle("slow");
		if( !$("#toggleShowGmap").is(':hidden') )
		{
			$("#toggleShowGmap").slideToggle("slow");
		}
		if( !$("#toggleShowComment").is(':hidden') )
		{
			$("#toggleShowComment").slideToggle("slow");
		}
		$(this).toggleClass("active"); return false;
	});
	$("#postComment").click(function(){
		$("#toggleShowComment").slideToggle("slow");
		if( !$("#toggleShowGmap").is(':hidden') )
		{
			$("#toggleShowGmap").slideToggle("slow");
		}
		if( !$("#toggleShowComment").is(':hidden') )
		{
			$("#toggleShowPost").slideToggle("slow");
		}
		$(this).toggleClass("active"); return false;
	});
});
// END jQuery - slideToggle



// jQuery - navigation - superfish
jQuery(function(){
	jQuery('ul#navigation').superfish();
	jQuery('ul#edit').superfish();
});
// END jQuery - navigation



// jQuery - overlay
// What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
$(document).ready(function() {
$("a[rel]").overlay();
$("span[rel]").overlay();
});
// END jQuery - overlay



// jQuery - vtab
$(function() {
	var $items = $('#vtab>ul>li');
	$items.mouseover(function() {
		$items.removeClass('selected');
		$(this).addClass('selected');

		var index = $items.index($(this));
		$('#vtab>div').hide().eq(index).show();
	}).eq(0).mouseover();
});
// END jQuery - vtab



// jQuery - tabs
// perform JavaScript after the document is scriptable.
$(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes
	$("ul.tabs").tabs("div.panes > div");
	$("ul.tabs2").tabs("div.panes2 > div");
	$("ul.tabsindex").tabs("div.panes > div", { initialIndex: 1 });
	$("ul.tabsindex2").tabs("div.panes2 > div", { initialIndex: 1 });
});
// add new effect to the tabs
$.tools.tabs.addEffect("slide", function(i, done) {
 
	// 1. upon hiding, the active pane has a ruby background color
	this.getPanes().slideUp().css({backgroundColor: "#b8128f"});
 
	// 2. after a pane is revealed, its background is set to its original color (transparent)
	this.getPanes().eq(i).slideDown(function()  {
		$(this).css({backgroundColor: 'transparent'});
 
		// the supplied callback must be called after the effect has finished its job
		done.call();
	});
});
// END jQuery - tabs



// jQuery - tabs accordion
$(document).ready(function() { 
 $("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
 $("#accordion2").tabs("#accordion2 div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
 $("#accordion3").tabs("#accordion3 div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
});
// END jQuery - tabs accordion



// jQuery - tooltip
// What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
$(document).ready(function() {
$(".add").tooltip({ effect: 'slide', delay: '200'});
$(".login").tooltip({ effect: 'slide', delay: '200'});
//$(".photoAlbumThumb img[title]").tooltip({ effect: 'slide', delay: '200' });
//$(".photoThumb img[title]").tooltip({ effect: 'slide', delay: '200' });
//$(".videoThumb img[title]").tooltip({ effect: 'slide', delay: '200' });
});
// END jQuery - tooltip



// jQuery - slideDown
$('#clickme').click(function() {
  $('#comments').slideDown('slow', function() {
    // Animation complete.
  });
});
// END jQuery - slideDown



// jQuery - img resize
$(window).load(function(){
  var max_size = 600;
  $('.ar_content').find('img').each(function(){
	if ($(this).width() > max_size) {
      if ($(this).height() > $(this).width()) {
        var h = max_size;
        var w = Math.ceil($(this).width() / $(this).height() * max_size);
      } else {
        var w = max_size;
        var h = Math.ceil($(this).height() / $(this).width() * max_size);
      }
      $(this).css({ height: h, width: w });
    }
  });
});

$(window).load(function(){
  $('.ar_photoGalleryPhoto').find('img').each(function(){
    var imgClass = (this.width/this.height > 1) ? 'width' : 'height';
    $(this).addClass(imgClass);
  })
  $('.photoGalleryMainPhoto').find('img').each(function(){
    var imgClass = (this.width/this.height > 1) ? 'width' : 'height';
    $(this).addClass(imgClass);
  })
  $('.panesStyle02Photo').find('img').each(function(){
    var imgClass = (this.width/this.height > 1) ? 'width' : 'height';
    $(this).addClass(imgClass);
  })
  $('.panesStyle21Photo').find('img').each(function(){
    var imgClass = (this.width/this.height > 1) ? 'width' : 'height';
    $(this).addClass(imgClass);
  })
  $('.overlayPhoto').find('img').each(function(){
    var imgClass = (this.width/this.height > 1) ? 'width' : 'height';
    $(this).addClass(imgClass);
  })
  
  //get the width of the parent  
  var parent_height = $('.centerImg').parent().height();
  //get the width of the image  
  var image_height = $('.centerImg').height();
  //calculate how far from top the image should be  
  var top_margin = (parent_height - image_height)/2;  
  //and change the margin-top css attribute of the image  
  $('.centerImg').css( 'margin-top' , top_margin);
  
  var parent_height = $('.centerImg2').parent().height();
  var image_height = $('.centerImg2').height();
  var top_margin = (parent_height - image_height)/2;  
  $('.centerImg2').css( 'margin-top' , top_margin);
  
  var parent_height = $('.centerImg3').parent().height();
  var image_height = $('.centerImg3').height();
  var top_margin = (parent_height - image_height)/2;  
  $('.centerImg3').css( 'margin-top' , top_margin);
  
  var parent_height = $('.centerImg4').parent().height();
  var image_height = $('.centerImg4').height();
  var top_margin = (parent_height - image_height)/2;  
  $('.centerImg4').css( 'margin-top' , top_margin);
})
// END jQuery - img resize



// jQuery - easyAccordion
//$(function() {
//	$('#accordion-1').easyAccordion({ 
//			autoStart: false, 
//			slideInterval: 3000,
//			slideNum: false
//	}); 
//});
// END jQuery - easyAccordion


// open new window
function openCenterWindow(pageURL, title, w, h) {
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
// END open new window

// load login tooltip if not logged in - for rating bar
function LoadLogin() {
    $(".ratingStarWrapper").tooltip({ effect: 'slide', delay: '200' });
}
// END login tooltip
