function popitup(url, name, width, height, scrolling)
{
	newwindow=window.open(url,name,'width='+width+',height='+height+',toolbar=0,scrollbars='+scrolling+',location=0,statusbar=1,menubar=0,resizable=0,top=300,left=300');
	if (window.focus) {newwindow.focus()}
	return false;
}

function FitPic(ancho, alto) {
	var x,y;
	window.resizeTo(ancho, alto);
	if (self.innerHeight)
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) 
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	
	while(ancho > x){
	
		if (self.innerHeight) 
		{
			x = self.innerWidth;
			y = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			
		{
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body)
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		
		window.resizeBy(+(ancho-x),+(alto-y));
		
	}
	posY=(Math.round(screen.height-(alto))/2);
	posX=(Math.round(screen.width-(ancho))/2);
		moveTo(posX,posY);
		focus();
}



function newwindow(url, name, width, height)
{
	newwindow=window.open(url,name,'width='+width+',height='+height+',toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,top=300,left=300');
	if (window.focus) {newwindow.focus()}
	return false;
}

function exists(v)
{
	return ( typeof(v) != "undefined" );
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function hideFlash()
{
	if ( exists(document.getElementById('flashMessage')) )
		document.getElementById('flashMessage').style.display='none';
}

function num_imagenes(numero) {
	if (isNaN(numero))
		num = 0;

	for(x = 1; x <= 30; x++)
	{
		if ((obj = document.getElementById('adj_image_' + x)) != null)
			if(parseInt(numero) >= x)
				obj.style.display = '';
			else
				obj.style.display = 'none';
	}			
}


//fraccion a mostrarse
var ancho=200;
//rutina de mensaje deslizante
function desliza(mensaje){
	document.getElementById('cita').value = mensaje.substring(0, ancho);
	mensaje=mensaje+mensaje.substring(0,1);
	mensaje=mensaje.substring(1,mensaje.length-1);
	setTimeout("desliza('" + mensaje + "')", 150);
}