// JavaScript Document

var IE=document.all?true:false; var tempX=0; var tempY=0;
if(IE)
{
	var AltoPantalla = screen.Height / 2;
	var AnchoPantalla = screen.Width / 2;
}
else
{
	var AltoPantalla=screen.height / 2;	
	var AnchoPantalla=screen.width / 2;
}
//______________________________________________________________________________________________________//
function cargaPagina(url,div,parametros)
{
	img = '/imagenes/fondo_index.jpg';
	switch(url)
	{
		case "index.php":
			img = '/imagenes/fondo_index.jpg';
			break;
		case "mision.php":
			img = '/imagenes/fondo_mision.jpg';
			break;
		case "nuestrarsc.php":
			img = '/imagenes/fondo_nuestrarsc.jpg';
			break;
		case "porque.php":
			img = '/imagenes/fondo_porque.jpg';
			break;
		case "quienessomos.php":
			img = '/imagenes/fondo_quienessomos.jpg';
			break;
		case "stakeholder.php":
			img = '/imagenes/fondo_stakeholder.jpg';
			break;
		//Carpeta RSCinteractiva -------------------------------------------
		case "RSCinteractiva_comunicacion.php":
			img = '/imagenes/fondo_interactiva_comunicacion.jpg';
			break;
		case "RSCinteractiva_desarrollo.php":
			img = '/imagenes/fondo_interactiva_desarrollo.jpg';
			break;
		case "RSCinteractiva_clientes.php":
			img = '/imagenes/fondo_clientes.jpg';
			break;
		case "RSCinteractiva_marketing.php":
			img = '/imagenes/fondo_interactiva_marketing.jpg';
			break;
		case "RSCinteractiva_visorClientes.php":
			img = '/imagenes/fondo_visorClientes.jpg';
			break;
		//Carpeta RSCeventos -------------------------------------------
		case "RSCeventos_metodo.php":
			img = '/imagenes/fondo_eventos_metodo.jpg';
			break;
		case "RSCeventos_servicios.php":
			img = '/imagenes/fondo_eventos_servicios.jpg';
			break;
		case "RSCeventos_clientes.php":
			img = '/imagenes/fondo_clientes.jpg';
			break;
		case "RSCeventos_R4.php":
			img = '/imagenes/fondo_eventos_R4.jpg';
			break;
		case "RSCeventos_visorClientes.php":
			img = '/imagenes/fondo_visorClientes.jpg';
			break;

	}
	parametros += "&ajax=1";
	$('fbody').setStyle("background","URL(" + img + ") no-repeat top left #000000");
	$('fbody').setStyle("margin","0");
	$('fbody').setStyle("padding","0");
	
	//new Ajax(url,{method: 'post', postBody:parametros, update:div}).request();
	new Request(
	{
		method: 'post',
		url: url,
		onSuccess: function(texto){
		$(div).innerHTML = texto;}
	}).send(parametros);
	
	setTimeout("calculaDiv",50);
	
}
//______________________________________________________________________________________________________//
var toggleActual = '';
var mySlideInteractiva;
var mySlideEventos;
var	mySlidePublicidad;

function abreSubMenu(a)
{
	var o={};
	var b=new Fx.Elements($(a),{wait:false,duration:300,transition:Fx.Transitions.Back.easeOut});

		if($(a).getStyle("height").toInt()==27)
		{
			o[0]={height:[27,35]};
			$(a).className="div_caja_menu_over";
		}
		else
		{
			o[0]={height:[35,27]};
			$(a).className="div_caja_menu";
		}
		
		b.start(o);
	
	$("sub"+a).setStyle("display","block");
	
	if(toggleActual!="" && toggleActual!=a)
	{
		ocultaSubMenu();
		toggleActual=a;
	}
	else if(toggleActual==a)
		toggleActual="";
	else
		toggleActual=a;
	eval("mySlide"+a+".toggle();")
}
//______________________________________________________________________________________________________//
function ocultaSubMenu()
{
	var o={};
	var a=new Fx.Elements($(toggleActual),{wait:false,duration:300,transition:Fx.Transitions.Back.easeOut});

		if($(toggleActual).getStyle("height").toInt()==27)
		{
			o[0]={height:[27,35]};
			$(toggleActual).className="div_caja_menu_over";
		}
		else
		{
			o[0]={height:[35,27]};
			$(toggleActual).className="div_caja_menu";
		}

		a.start(o);

	eval("mySlide"+toggleActual+".toggle();")

}
//______________________________________________________________________________________________________//
function inicializa(a)
{
	mySlideInteractiva=new Fx.Slide('subInteractiva');
	mySlideEventos=new Fx.Slide('subEventos');
	mySlidePublicidad=new Fx.Slide('subPublicidad');

	mySlideInteractiva.toggle();
	mySlideEventos.toggle();
	mySlidePublicidad.toggle();
}
//______________________________________________________________________________________________________//
function calculaDiv()
{
	var altoDiv = (AltoPantalla * 2) - $('texto_arriba').offsetHeight - $('cuadro_blanco').offsetHeight - $('enlaces').offsetHeight - $('menu_rapido').offsetHeight - $('flash').offsetHeight;


	//$('div_dinamico_pantalla').innerHeight = altoDiv;


	/*if (window.innerHeight) 
		alto=window.innerHeight - 110;
	else {
		if (document.body.clientHeight)
			alto=document.body.clientHeight - 110;
		else
			alto=478;
	}*/

	//alert(altoDiv + 'as')
}
//______________________________________________________________________________________________________//
function bucleClientes(cod)
{
	if($(cod).value == 15)
		$cod = 1;
	else
		$cod == $(cod + 1);

	if($(cod).value == 0)
		$cod = 14;
	else
		$cod == $(cod - 1);
}
//______________________________________________________________________________________________________//
function ocultaFlash()
{
	if($('div_cajas_login').fx){$('div_cajas_login').fx.stop();}
	if($('div_flash').fx){$('div_flash').fx.stop();}
	$('div_flash').fx = $('div_flash').effect('opacity', {duration: 2000}).start(0);
	$('div_cajas_login').fx = $('div_cajas_login').effect('opacity', {duration: 2000}).start(1);
}
//______________________________________________________________________________________________________//