
$(document).ready(function() {


// External Links
$('a[rel=external]')
		.click(
			function (e) {
			    open(this.href);
			    e.preventDefault();
			}
		)
		.attr('title', 'Opens in a new window')
		.attr({ target: "_blank" });

// Gallery
$("a[rel=gallery_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

$("#upload-form").fancybox({
        'titlePosition': 'inside',
        'transitionIn': 'none',
        'transitionOut': 'none',
        'scrolling': 'no',
        'titleShow': false,
        'height': 490,
        'width': 470,
        'type': 'iframe',
		'autoScale' : false
    });

    $("#message-us-form").fancybox({
        'titlePosition': 'inside',
        'transitionIn': 'none',
        'transitionOut': 'none',
        'scrolling': 'yes',
        'titleShow': false,
        'height': 760,
        'width': 470,
        'type': 'iframe',
		'centerOnScroll' : false,
		'autoDimensions': false
    });

$("a.video").fancybox({
	'titlePosition': 'inside',
	'transitionIn': 'none',
	'transitionOut': 'none',
	'scrolling': 'no',
	'titleShow': false,
	'autoScale' : false,
	'height': 385,
	'width': 640,
	'type': 'iframe'
});


// jcarousellite
$(".carousel").jCarouselLite({
       btnNext: ".nextBtn",
       btnPrev: ".prevBtn",
	   auto: 1800
  });



// Useful Stuff
	$('li:first-child').addClass('first-item');
	$('li:last-child').addClass('last-item');


// Accordion 
if ($( ".accordion" ).length){
	$(".accordion").accordion({autoHeight:false, active: false, collapsible: true });
}


  jQuery(".expandable-content").hide();
  //toggle the componenet with class msg_body
  jQuery(".heading").click(function()
  {
      jQuery(this).next(".expandable-content").slideToggle(500);
  });

  $(".date").datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true,
			changeYear: true,           minDate: '-100Y',
    maxDate: '-16Y', 
    yearRange: '-100'
  });

});



