$(document).ready(function() {
	$('h4.toggle').click(function() {
		$(this).toggleClass('h4on')
		$(this).next('div').slideToggle();
		return false;
	});
	var myFile = document.location.toString();
	if (myFile.match('#')) { // the URL contains an anchor
	  // click the navigation item corresponding to the anchor
		var myAnchor = '#' + myFile.split('#')[1];
		// alert(myAnchor);
		$('h4.toggle a[href="' + myAnchor + '"]').click();
	  // $('h4.toogle a[href="' + myAnchor + '"]').parent().click();
	} else {
	  // click the first navigation item
	  $('h4.toggle:first').click();
	}
	$('a').click(function() {
		var ext = $(this).attr('rel');
		if(ext == 'external') {
	    	window.open(this.href);
	    	return false;			
		}
	 });
	$('a.external').click(function() {
    	window.open(this.href);
    	return false;
	 });
	 $('.carousel').carousel({
	 	effect: 'fade',
	 	animSpeed: 'slow',
	 	loop: true,
	 	pagination: true,
	 	paginationPosition: "inside",
	 	autoSlide: true, 
	 	autoSlideInterval: 5000
	 });
	$('.contact-dialog').fancybox({
		'overlayOpacity' :	0.7,
		'overlayColor' : '#fc8b1b'
	});
	$(".lopez-video").fancybox({
		'overlayColor':	'#fc8b1b',
		'frameWidth': 360,
		'frameHeight': 500
	});
});
