 
$(document).ready(function(){
			//
			$('#navHome').click(function() {
  				window.open("index.html", "_self");
			});
			$('#creditos').click(function() {
  				window.open("http://www.ecgnet.com.mx/", "_blank");
			});
			
			//
			var thisPage= "http://www.didactijuegos.com.mx"+window.location.pathname; 
	
			$('#shareTwitter').click(function() {
				popUp("http://twitter.com/home?status="+thisPage, "Twitter", 800, 420, "yes");
			});
			$('#shareFacebook').click(function() {
				popUp("http://www.facebook.com/share.php?u="+thisPage, "Facebook", 800, 420, "yes");
			});
			
			$('#btnEmpresa').mousedown(function() {
				window.open("Empresa/Quienes-somos.html", "_self");
			});
			$('#btnFranquicias').mousedown(function() {
				window.open("Franquicia/Franquicia.html", "_self");			
			});
			
			$('#contacto').mousedown(function() {
				$(this).colorbox({href:"Contacto.html",
						 opacity: 0.6, 
						 innerWidth: 500,
						 initialWidth: 500,
						 innerHeight: 300,
						 initialHeight: 300,
						 transition: "none"});
			});
			
			//
			$('#videoSlides').click(function() {
				pauseSlideShow();
				showVideo();
			});
			
			//
			activateSlideShow();
			resizeWindow();
			//
			$(window).resize(function() {
				resizeWindow();
  			});
			
			
});

function resizeWindow(){
	var W = $(window).width();
	var H = $(document).height();
	// footer
	var footerH = (H-40<650) ? 650 : H-40;
  	$('#footer').css({'margin-Top' : footerH+'px'});
	
	// share
	var shareX = (W-313<650) ? 650 : W-313;
		shareX = shareX > 1000 ? 1000 : shareX;
  	$('#share').css({'margin-Left' : shareX+'px'});
}

function popUp(page, pageName, width, height, scrollbars) { 
		OpenWin = this.open(page, pageName, "toolbar=no, menubar=no ,location=no, scrollbars=" + scrollbars + ", resizable=no, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
}

function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
var int;
function activateSlideShow(){
   	int = window.setInterval( "slideSwitch()", 8000 );
}
function pauseSlideShow(){
	window.clearInterval(int);
}
function showVideo(){
	$('#videoPres').css({'display' : 'none'});
	$('#hazClick').css({'display' : 'none'});
	//$('#video').css({'display' : 'block'});
	
	$('#video').css({'z-index' : '11'});

}

