/*Sustitucion de imagenes en el menu superior del home*/

function sust_img() {
var i,j=0,x,a=sust_img.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
 
function regresa_normal() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
 
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
/*fin Sustitucion de imagenes en el menu superior del home*/



/****************lights off efecto en el que se apaga la pantalla y se mantienen las ventanas modales *************/
function getPageSize() {
  var xScroll, yScroll;
  if (window.innerHeight && window.scrollMaxY) {	
    xScroll = window.innerWidth + window.scrollMaxX;
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight) {
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
  } else {
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
  }
  var windowWidth, windowHeight;
  if (self.innerHeight) {
    if(document.documentElement.clientWidth) {
      windowWidth = document.documentElement.clientWidth; 
    } else {
      windowWidth = self.innerWidth;
    }
    windowHeight = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if (document.body) {
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }	
  if(yScroll < windowHeight){
    pageHeight = windowHeight;
  } else { 
    pageHeight = yScroll;
  }
  if(xScroll < windowWidth){	
    pageWidth = xScroll;		
  } else {
    pageWidth = windowWidth;
  }
  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
  return arrayPageSize;
}

function lightsoff() {
  $("#lightsoff").click( 
    function() {
      $('#Playerholder, #Player, embed, object')
      .css({ 'visibility' : 'visible' });
      $('body')
      .append('<div id="lightsoff-background"></div>');
      var page_size = getPageSize();
      $('#lightsoff-background')
      .css({
        backgroundColor: "#000",
        opacity: 0.9,
        width: page_size[2],
        height: page_size[1]
    }).show();
    $('#lightsoff-background').click(function() {
      $('#lightsoff-background')
      .fadeOut(function() { 
        $('#lightsoff-background').remove(); 
      });
      return false;
    });
    return false;
  });
}
/******************************************************************/

/************ventana modal****************************************/
function iframe_ventana_modal(url,ancho,alto){
        $().ready( function (){
		/* #saludo disparador de evento anchor , #ventana: elemento oculto con css */
				$.modal('<iframe src="'+url+'" '+ancho+' '+alto+' style="border:0">')
				});
				url="";
				ancho="";
				alto="";
}
/*****************************************************************/


/*************funcion para mostrar ventana modal******************/
function ventanaModal(campo){
		/* se necesita agregar el contenido oculto valor que trae:"campo", a la hoja de estilos con la 
		propiedad display:none; esta ubicado hasta abajo de la hoja de estilos como "elementos ocultos de las ventans modales"
		*/
        $().ready( function (){
                $(campo).modal();
        });
}
/******************************************************************/

/************funcion para agregar un evento onclick a todos los links ******************/
/*
*Marco A. Carrasco 18/Mayo/2011
*cualquier cosa que se desea pinte en los links se coloca en Javascript
*evitando los links que ya traen un evento onclick,
*/
function addClick(){
var x=document.getElementsByName(this)
	for (i=0;i<document.links.length;i++){
		if (!document.links[i].getAttribute("onclick")){
		document.links[i].setAttribute("onclick","recordOutboundLink(this, 'OUT:"+document.links[i]+"', '"+document.links[i]+"'); return false;");
		}

	}
}
/******************************************************************************************/

/************Click tale codigo de seguimiento********************************/
var WRInitTime = (new Date()).getTime();
/****************************************************************************/
