// JavaScript Document
function GetWidth() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	if(myWidth <= 1024){
		return 1024;
	}else{
		return myWidth;
	}
}
function GetHeight() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	if(myHeight <= 600){
		return 600;
	}else{
		return myHeight;
	}
}
var exc = 1;
var pags = new Array('','index.html','radio.html','tv.html','editorial.html','redes.html','outdoors.html','inmuebles.html','','directorio.html','contacto.html');
$(document).ready(function() {
	function Acomoda(){
		$("#Index_Amarillo").css("width", ((GetWidth() * 0.5) - 50)+"px");
		$("#Index_Amarillo").css("height", (GetHeight()+2400)+"px");
		$("#Index_Contenido").css("width", GetWidth()+"px");
		$("#Index_Secc1").css("width", GetWidth()+"px");
		$("#Index_Secc1").css("height", GetHeight()+"px");
		$("#Index_Secc2").css("width", GetWidth()+"px");
		$("#Index_Secc2").css("top", (GetHeight()+1800)+"px");
		$("#Index_Secc3").css("width", GetWidth()+"px");
		$("#Index_Secc3").css("top", (GetHeight()+1200)+"px");
		$("#Index_Secc4").css("width", GetWidth()+"px");
		$("#Index_Secc4").css("top", GetHeight()+"px");
		$("#Index_Secc5").css("width", GetWidth()+"px");
		$("#Index_Secc5").css("top", (GetHeight()+2400)+"px");
		
		$(".Index_Menu_Btn").css("width", GetWidth()+"px");
		$(".Index_Linea").css("width", (GetWidth() - 60)+"px");
		$(".Index_Menu_A").css("width", ((GetWidth() * 0.5) - 50)+"px");
		$(".Index_Menu_B").css("width", ((GetWidth() * 0.5) - 50)+"px");
		$(".Index_Menu_B2").css("width", ((GetWidth() * 0.5) - 50)+"px");
		$(".Index_Menu").css("width", GetWidth()+"px");
		$(".Index_Menu_Izq").css("width", ((GetWidth() * 0.5) - 50)+"px");
		$(".Index_Menu_Texto_Izq").css("width", ((GetWidth() * 0.5) - 50)+"px");
		
		for(i = 1; i <= $(".Index_Menu").length; i++){
			$("#Index_Menu"+i+' .Index_Menu_B').css("width",'0px');
		}
	}
	Acomoda();
	$(window).resize(function(){
		Acomoda();
	});
	
/*MENU***********************************************************************************************/
	$('#m'+exc+' .Menu_back2').css("width", '160px');
	$(".menu").mouseenter(function() {
		if(this.id == 'm0'){
			muestra = 1;
			Muestralos(1);
		}else{
			$('#'+this.id+' .Menu_back2').animate({"width": '160px'}, 150, 'swing');
		}		
	});
	$(".menu").mouseleave(function() {
		if(this.id != 'm'+exc && this.id != 'm0'){
			$('#'+this.id+' .Menu_back2').animate({"width": '0px'}, 150, 'swing');
		}		
	});
	$("#Menu").mouseleave(function() {
		muestra = 0;
		Ocultalos(($(".menu").length-1));
	});
	$(".menu").click(function() {
		var ar = this.id.split('m');
		if(ar[1] != exc && ar[1] != 0){
			if(ar[1] == 8){
				window.open('http://www.multimedios.com/comunicados/', "_parent");
			}else{
				window.location = pags[ar[1]];
			}
		}
	});
	function Muestralos(n){
		if(n < $(".menu").length && muestra == 1){
			$('#m'+n).animate({"margin-left": '0px'}, 30, 'swing', function(){Muestralos((n+1))});
		}
	}
	function Ocultalos(n){
		if(n > 0 && muestra == 0){
			$('#m'+n).animate({"margin-left": '-160px'}, 30, 'swing', function(){Ocultalos((n-1))});
		}
	}
/****************************************************************************************************/
	$(".Index_Menu").mouseenter(function() {
		$('#'+this.id+' .Index_Menu_B').animate({width: (GetWidth() * 0.5)+'px'}, 150, 'swing');
		$('#'+this.id+' .Index_Menu_D1').animate({top: '-200px'}, 150, 'swing');
		$('#'+this.id+' .Index_Menu_D2').animate({top: '0px'}, 150, 'swing');
		switch(this.id){
			case 'Index_Menu1':
				getFlashMovie("microfono").DalePlay('entra');
			break;
			case 'Index_Menu2':
				getFlashMovie("Television").DalePlay('entra');
			break;
			case 'Index_Menu3':
				getFlashMovie("logomilenio").DalePlay('entra');
			break;
			case 'Index_Menu4':
				getFlashMovie("cinta").DalePlay('entra');
			break;
			case 'Index_Menu5':
				getFlashMovie("billboard").DalePlay('entra');
			break;
			case 'Index_Menu6':
				getFlashMovie("cable").DalePlay('entra');
			break;
			case 'Index_Menu7':
				getFlashMovie("compu").DalePlay('entra');
			break;
			case 'Index_Menu8':
				getFlashMovie("iphone").DalePlay('entra');
			break;
		}
	});
	$(".Index_Menu").mouseleave(function() {
		$('#'+this.id+' .Index_Menu_B').animate({width: '0px'}, 150, 'swing');
		$('#'+this.id+' .Index_Menu_D1').animate({top: '0px'}, 150, 'swing');
		$('#'+this.id+' .Index_Menu_D2').animate({top: '400px'}, 150, 'swing');
		switch(this.id){
			case 'Index_Menu1':
				getFlashMovie("microfono").DaleStop('sale');
			break;
			case 'Index_Menu2':
				getFlashMovie("Television").DaleStop('sale');
			break;
			case 'Index_Menu3':
				getFlashMovie("logomilenio").DaleStop('sale');
			break;
			case 'Index_Menu4':
				getFlashMovie("cinta").DaleStop('sale');
			break;
			case 'Index_Menu5':
				getFlashMovie("billboard").DaleStop('sale');
			break;
			case 'Index_Menu6':
				getFlashMovie("cable").DaleStop('sale');
			break;
			case 'Index_Menu7':
				getFlashMovie("compu").DaleStop('sale');
			break;
			case 'Index_Menu8':
				getFlashMovie("iphone").DaleStop('sale');
			break;
		}
	});

	var paginas = new Array('','radio.html','tv.html','editorial.html','inmuebles.html','outdoors.html','redes.html','enlinea.html','movil.html');
	$(".Index_Menu").click(function() {
		var ar = this.id.split('Index_Menu');
		window.location = paginas[ar[1]];
	});	
/****************************************************************************************************/
/*FELCHA SECCIONES***********************************************************************************/	
	$("#LineaT_Bottom_Barra_Negra_Flecha").click(function() {
		$('html, body').animate({scrollTop: GetHeight()}, 800, 'swing');
	});	
/****************************************************************************************************/
/*MISION VISION VALORES***********************************************************************************/	
	$("#Index_Secc2_M_V_V").click(function() {
		window.location = 'mision.html';
	});
/****************************************************************************************************/
});
function getFlashMovie(movieName) {   
 	var isIE = navigator.appName.indexOf("Microsoft") != -1;   
	return (isIE) ? window[movieName] : document[movieName];  
}
