$(document).ready(function() {
	
// SLIDESHOWS
$("#showcase").cycle({
	timeout: 5000	
});

$('a.fancy').fancybox();
$('a.map').fancybox({
	width: 800,
	height: 650	
});

$('.gallery a').fancybox({
	titlePosition: 'inside'	
});


// FORM VAL
$('#contact-form').validate();

$('.sidebar').append('<img src="/images/sidebar-fade-btm.png" id="sidebar-fade-btm" />');

$('.main-content h2:first').addClass('first');

   // DROPDOWN
$('#nav li').hover(
	function () {
		$(this).children('a:first').addClass("active");	
		$('ul', this).stop(true,true).slideDown(200);
	}, 
	function () {
		$(this).find('a').removeClass("active");
		$('ul', this).stop(true,true).slideUp(100);			
	}
);

// ACCORDIAN
$('.acc-heading').css('cursor','pointer'); 
$('.acc-content').hide(); 
$('.acc-heading:first').addClass('active').next().show(); 
$('.acc-heading').click(function(){
	if( $(this).next().is(':hidden') ) { 
		$('.acc-heading').removeClass('active').next().slideUp(); 
		$(this).toggleClass('active').next().slideDown(); 
	}
	return false;
});

	
// EQUAL COL HEIGHT
var max_height = 0;
$("div.container").each(function(){
if ($(this).height() > max_height) { max_height = $(this).height(); }
});
$("div.container").height(max_height);


// CLICKABLE CONTAINER
$('.container').click(function() {
       var href = $(this).find("a").attr("href");
       if(href) {
           window.location = href;
       }
});
	
// STIPED TABLES
$("table.striped tr:odd").addClass("alt-row");
	
	
// STYLE LINKS
//$("a[href$='.pdf']").addClass("pdf");
//$("a[href$='.zip'], a[href$='.rar']").addClass("zip"); 
$("a[href^='mailto:']").addClass("email");
$('a').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
}).addClass("external").attr("target", "_blank");



});  
