 
$(document).ready(function(){
			
			//
			
			$('#logo').click(function() {
  				window.open("index.html", "_self");
			});
			$('#signature').click(function() {
  				window.open("http://www.ecgnet.com.mx/", "_blank");
			});
			$('#flagMex').click(function() {
  				window.open("http://www.grupomavic.com.mx/", "_self");
			});			
			
			//
			
			
			var thisPage= "http://www.grupomavic.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");
			});
			
			//
			
			//
			 
			$('#bannerLeft').click(function() {
  				window.open("Fabricacion.html", "_self");
			});	
			$('#bannerCenter').click(function() {
  				window.open("Reparacion.html", "_self");
			});
			$('#bannerTopRight').click(function() {
  				window.open("Contacto.html", "_self");
			});
			$('#bannerBottomRight').click(function() {
  				$(this).colorbox({
					href:"#tablaMateriales",
					inline:true,
					opacity:0.3,
					innerWidth: 716,
					initialWidth: 716,
					innerHeight: 392,
					initialHeight: 392,
					scrolling: false,
					transition: "none"});
			});
			//
			
			//
			activateScrollContent();
			resizeWindow();
			//
			$(window).resize(function() {
				resizeWindow();
  			});
			
			
});

function resizeWindow(){
	var W = $(window).width();
	var H = $(window).height();
	//
	//
}

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(ssh) {
	var slideshow = ssh == undefined ? "#slideshow" : ssh;
    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 activateScrollContent(){
   	int = window.setInterval( "scrollContent()", 8000 );
}
function pauseSlideShow(){
	window.clearInterval(int);
}
var cur = 0;
var prev = 0;
var secc = ['#home1','#home2'];
function scrollContent() {
	cur = cur < secc.length-1 ? cur+1 : 0;
	scr = secc[cur];
	$(scr).css({'margin-Top' : '500px'});
	$(secc[prev]).animate({ 
    	marginTop: -500
  	}, 700);
	$(scr).animate({ 
    	marginTop: 0
  	}, 700);
	prev = cur;
}

