// JavaScript Document


function incrustaFlash(ruta, ancho, alto, transp) {

//	document.write('<div class="flash">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + ancho + '" height="' + alto + '">');
      document.write('<param name="movie" value="' + ruta + '" />');
      document.write('<param name="quality" value="high" />');
	  if(transp) {
	  	document.write('<param name="wmode" value="transparent">');
		document.write('<embed src="' + ruta + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + ancho + '" height="' + alto + '" wmode="transparent"></embed>');
	  }
	  else
     	 document.write('<embed src="' + ruta + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + ancho + '" height="' + alto + '"></embed>');
    document.write('</object>');
//	document.write('</div>');


}

// Windows Media Player
function embedWMP(data, width, height, play) {
    if (play == "stop")
        auto_start = "false";
    else
        auto_start = "true";
//	document.write('<div class="wmp">');
    document.write('<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' + width + '" height="' + height + '">');
    document.write('<param name="URL" value="' + data + '" />');
    document.write('<param name="rate" value="1">');
    document.write('<param name="balance" value="0">');
    document.write('<param name="currentPosition" value="0">');
    document.write('<param name="defaultFrame" value="">');
    document.write('<param name="playCount" value="1">');
    document.write('<param name="AutoStart" value="' + auto_start + '" />');
    document.write('<param name="volume" value="100">');
    document.write('<param name="currentMarker" value="0">');
    document.write('<param name="invokeURLs" value="-1">');
    document.write('<param name="baseURL" value="">');
    document.write('<param name="mute" value="0">');
    document.write('<param name="uiMode" value="none" />');
    document.write('<param name="stretchToFit" value="-1">');
    document.write('<param name="windowlessVideo" value="0">');
    document.write('<param name="enabled" value="-1">');
    document.write('<param name="enableContextMenu" value="-1">');
    document.write('<param name="fullScreen" value="0">');
    document.write('<param name="SAMIStyle" value="">');
    document.write('<param name="SAMILang" value="">');
    document.write('<param name="SAMIFilename" value="">');
    document.write('<param name="captioningID" value="">');
    document.write('<param name="enableErrorDialogs" value="0">');
    document.write('</object>');
//	document.write('</div>');
}


// Precarga de las pestanas
var tabs = new Array('tabEstacion', 'tabBar', 'tabParking', 'tabPicnic', 'tabVistaAerea', 'fndBotIndice');
			
for(var i = 0; i < tabs.length; i++) {
	pestana = new Image();
	pestana.src = 'img/' + tabs[i] + '_act.gif';
}
// Fin de la precarga de las pestanas



function colocaProlongaciones() {
	
//	document.write('<div id="prolongacionPie"></div><div id="prolongacionMenuSup"></div><div id="prolongacionColIzq"></div>');
	
/*	var div1 = document.createElement('div');
 	div1.setAttribute('id','prolongacionPie');
  	document.appendChild(div1);
	var div2 = document.createElement('div');
 	div2.setAttribute('id','prolongacionMenuSup');
  	document.appendChild(div2);
	var div3 = document.createElement('div');
 	div3.setAttribute('id','prolongacionColIzq');
  	document.appendChild(div3);*/

	
	var wrapperGlobal = document.getElementById('wrapperGlobal')
	
	var pie = document.getElementById('pie');
	
	var prolongacionPie = document.getElementById('prolongacionPie');
	
	prolongacionPie.style.top = pie.offsetTop + 'px';
	
//	prolongacionPie.style.left = pie.offsetLeft + 955 + 'px';
	prolongacionPie.style.left = wrapperGlobal.offsetLeft + pie.offsetWidth + 'px';
	
	if(document.body.clientWidth < 955) {
		prolongacionPie.style.width = '0px';
	}
		
	else {
		prolongacionPie.style.width = ((document.body.clientWidth - 955) / 2) + 'px';
	//	alert(document.getElementById('wrapperGlobal').offsetLeft);	
	}
		
		
		
	
	var menuSup = document.getElementById('wrapperMenuSup');
	
	var prolongacionMenuSup = document.getElementById('prolongacionMenuSup');
	
	prolongacionMenuSup.style.top = menuSup.offsetTop + 'px';
	
	prolongacionMenuSup.style.left = '0px';
	
	if(document.body.clientWidth < 955)
		prolongacionMenuSup.style.width = '0px';
		
	else
		prolongacionMenuSup.style.width = ((document.body.clientWidth - 955) / 2) + 'px';
		
		
		
		
	var colIzq = document.getElementById('wrapperColIzq');
	
	var prolongacionColIzq = document.getElementById('prolongacionColIzq');
	
	prolongacionColIzq.style.top = (pie.offsetHeight + pie.offsetTop) + 'px';
	
//	prolongacionColIzq.style.left = colIzq.offsetLeft + 'px';
	prolongacionColIzq.style.left = wrapperGlobal.offsetLeft + 'px';


	var viewportwidth;
 	var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 	if (typeof window.innerWidth != 'undefined')
 	{
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
	 }
 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

	 else if (typeof document.documentElement != 'undefined'
   	 	 && typeof document.documentElement.clientWidth !=
   	 	 'undefined' && document.documentElement.clientWidth != 0)
	 {
      	 viewportwidth = document.documentElement.clientWidth,
      	 viewportheight = document.documentElement.clientHeight
 	}
 
 	// older versions of IE
 
 	else
 	{
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 	}




	if(viewportheight < (pie.offsetTop + pie.offsetHeight)) 
		prolongacionColIzq.style.height = '0px';
		
	else {
		prolongacionColIzq.style.height = (viewportheight - (pie.offsetTop + pie.offsetHeight)) + 'px';
		prolongacionColIzq.style.display = "block";
	//	alert(viewportheight + ' - ' + wrapperGlobal.offsetHeight);
	}
	
/*	prolongacionPie.style.visibility = "visible";
	prolongacionMenuSup.style.visibility = "visible";
	prolongacionColIzq.style.visibility = "visible";*/
	
	prolongacionPie.style.display = "block";
	prolongacionMenuSup.style.display = "block";
//	prolongacionColIzq.style.display = "block";
}



function enlaceExterno(url) {
	window.open(url, 'blank', 'height=400,width=600,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes,scrollbars=yes');
}

function fullScreen(theURL) {
    window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}


var lemas;
var lemaActual = 0;

function animaLemas() {
	lemas = jQuery('#wrapperLemasCabecera div');
	
	if(lemaActual == 0) {
		muestraLema(1);
		lemaActual = 1;
	}
	else if(lemaActual != 0 && lemaActual < lemas.length) {
		muestraLema(lemaActual + 1);
		ocultaLema(lemaActual);
		lemaActual = lemaActual + 1;
	}
	else if(lemaActual == lemas.length) {
		muestraLema(1);
		ocultaLema(lemas.length);
		lemaActual = 1;
	}
	
	var f = function() {animaLemas(); };
	
	t = setTimeout(f, 5000);
}

function muestraLema(numLema) {
	jQuery(lemas[numLema - 1]).animate({
		opacity: 1.0,
		top: "10px",
	}, 1000 );
}

function ocultaLema(numLema) {
	jQuery(lemas[numLema - 1]).animate({
		opacity: 0.0,
		top: "110px",
	}, 1000 );
}



