/**
 * Name: custom.js
 * Date: December 2011
 * Description: Margon
 * Version: 1.0
 * Coder: Enrique Ramirez
 * Coder URI: http://enrique-ramirez.com
*/

$(document).ready(function(){

/* Print *
-----------------------*/
$("a.print").click(function(event){
    event.preventDefault();
    window.print();
});


/* Colorbox
-----------------------------------------------*/
	$('a.colorbox').colorbox({
		opacity: 0.95,
		close: "x close"
	});

	$("a.view-map").colorbox({ iframe:true, width:"80%", height:"80%" });

/* Slideshow
-----------------------------------------------*/
	$('#slideshow').infiniteCarousel();

/* Automating Carousel
-----------------------------------------------*/
/* Setting a counter to reset timer */
	var counter = 0;

	/* Fake a click on right arrow every 5 seconds */
	$('#slideshow').everyTime(1000,function(i) {

		/* If X seconds have passed */
		if (counter == 5) {
			/* Fake a click on the right arrow... */
			$('#slideshow .forward').click();

			/* ... and reset the counter */
			counter=0;
		} else {
			/* Else, if X seconds have not yet passed, add 1 to the counter */
			counter++;
		}
	});

});
