// Java Script con ventana de scroll

var topedge = 417;		// Tope de la ventana
var leftedge = 260;  	// left de la ventana
var boxheight = 70;  	// Alto de la ventana
var boxwidth = 335;  	// Ancho de la ventana
var Velocidad = 40;	// Velocidad de scroll

isNS4 = (document.layers) ? 1 : 0;
isIE4 = (document.all) ? 1 : 0;
isW3C = (document.getElementById && !document.all) ? 1 : 0;

function ObjAdecuado(id) 
{
	var obj;
	
	if (isNS4) {
	    obj = document.layers(id);
	} else if (isIE4) {
	    obj = document.all(id);	
	} else if (isW3C) {
	    obj = document.getElementById(id);	}

	return obj;
}

function findPosition( oLink ) {
  if( oLink.offsetParent ) {
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
      posX += oLink.offsetLeft;
      posY += oLink.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oLink.x, oLink.y ];
  }
}

function scrollnoticias(cliptop) 
{
	var obj, obj1, noticiasDiv;
	
	if ( cliptop == 0 )
		mensajes(0);

	obj = ObjAdecuado("CartelInfoScroll");
	obj1 = ObjAdecuado("divBarSuperior");

	if (isNS4)
	{
		topedge = obj.pageY + obj.document.height + obj1.document.height - 58;
//		leftedge = 10 + obj.pageX + obj.document.width + obj1.document.width;
	}
	else
	if (isIE4)			
	{
		objp = findPosition(obj);
		topedge = objp[1]+30;
		leftedge = objp[0]+5;	
	}
	else
	{
		objp = findPosition(obj);
		topedge = objp[1]+30;
		leftedge = objp[0]+5;	
	}
		
	if (isNS4) 
	{
		noticiasDiv = ObjAdecuado('noticias');
		noticiasDiv.clip.top = cliptop;
		noticiasDiv.clip.bottom = cliptop + boxheight;
		noticiasDiv.clip.left = 0;
		noticiasDiv.clip.right = boxwidth + leftedge;
		noticiasDiv.left = leftedge;
		noticiasDiv.top = topedge - cliptop;
	}
	else 
	if (isIE4) 
	{
		noticiasDiv = ObjAdecuado('noticias').style; 
		noticiasDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
		noticiasDiv.pixelLeft = leftedge;
		noticiasDiv.pixelTop = topedge - cliptop;
	}
	else
	if (isW3C)
	{
		noticiasDiv = ObjAdecuado('noticias').style; 
		noticiasDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
		noticiasDiv.left = leftedge;
		noticiasDiv.top = topedge - cliptop;
	}

	
	cliptop = (cliptop + 1) % (scrollheight + boxheight);

	noticiasDiv.visibility='visible';
	setTimeout("scrollnoticias(" + cliptop + ")", Velocidad);
}
