//MANUEL PADILLA 
//VERSION 1.0.1 17.03.05 
	//nueva funcion, para manejo de iframes
//VERSION 1.0.0 06.09.04 

function AbrirEX(url,nombre,ancho,alto,features,scrollbars,cerrar) 
{ 

	var left,top;
	left= screen.availWidth/2 -ancho/2;
	top= screen.availHeight/2 -alto/2;


	if (scrollbars == true || scrollbars==1)
	{
		scrollbars=1;
	}
	else
	{
		scrollbars=0;
	}
	
	var hWindow
	hWindow =window.open(url,nombre,features + ',width = ' + ancho +',height = ' + alto + ',left = ' + left + ',top =' + top + ',scrollbars =' + scrollbars);
	
	cerrar=cerrar||false; 
	if(cerrar)
	{
		papa = window.self;
		papa.opener = window.self;
		papa.close();
	}
	
}

function AbrirEX2(url,nombre,ancho,alto,features,scrollbars,cerrar) 
{ 

	var left,top;
	left= screen.availWidth/2 -ancho/2;
	top= screen.availHeight/2 -alto/2;


	if (scrollbars == true || scrollbars==1)
	{
		scrollbars=1;
	}
	else
	{
		scrollbars=0;
	}
	
	//features = 'resize =1,'
	var hWindow
	hWindow =window.open(url,nombre,features  );
	//+ 'width = ' + ancho +',height = ' + alto + ',' + 'left = ' + left + ',top =' + top
	//+ ',' + 'scrollbars =' + scrollbars
	
	
	cerrar=cerrar||false; 
	if(cerrar)
	{
		papa = window.self;
		papa.opener = window.self;
		papa.close();
	}
	
}
function Abrir(theURL,winName,features) { //v2.0
  	var hWindow
	hWindow =window.open(theURL,winName,features);
}

function AbrirFullscreen(url,nombre,scrollbars,cerrar) 
{ 

	if (scrollbars == true || scrollbars==1)
	{
		scrollbars='scrolling=yes ';
	}
	else
	{
		scrollbars='scrolling=no ';
	}
	
	tsz=10
	brd=10
	fSO=scrollbars
	tW=nombre
	
	var cFRM='<HTML><HEAD><TITLE>'+tW+'</TITLE>\n'+
	'</HEAD>\n'+
	'<frameset border=0 framespacing=0 frameborder=0 rows="'+tsz+',100%,'+brd+'">\n'+
	'	<frame name=fT src="about:blank" scrolling=no noresize>\n'+
	'	<frameset border=0 framespacing=0 frameborder=0 cols="'+brd+',1,100%,1,'+brd+'">\n'+
	'		<frame name=n0 src="about:blank" scrolling=no noresize>\n'+
	'		<frame name=bL src="about:blank" scrolling=no noresize>\n'+
	'			<frameset border=0 framespacing=0 frameborder=0 rows="1,100%,1">\n'+
	'				<frame name=bT src="about:blank" scrolling=no noresize>\n'+
	'				<frame name=main src="'+url+'" '+fSO+'>\n'+
	'				<frame name=bB src="about:blank" scrolling=no noresize>\n'+
	'			</frameset>\n'+
	'		<frame name=bR src="about:blank" scrolling=no noresize>\n'+
	'		<frame name=n1 src="about:blank" scrolling=no noresize>\n'+
	'	</frameset>\n'+
	'	<frameset border=0 framespacing=0 frameborder=0 cols="'+brd+',100%,'+brd+'">\n'+
	'		<frame name=n3 src="about:blank" scrolling=no noresize>\n'+
	'		<frame name=n2 src="about:blank" scrolling=no noresize>\n'+
	'		<frame name=n4 src="about:blank" scrolling=no noresize>\n'+
	'	</frameset>\n'+
	'</frameset>\n'+
	'</HTML>'
	
	var hWindow
	hWindow = window.open("",nombre,"fullscreen=1");
	hWindow.document.write(cFRM)
	hWindow.document.close()
		
	cerrar=cerrar||false; 
	if(cerrar)
	{
		papa = window.self;
		papa.opener = window.self;
		papa.close();
	}
	
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function tabla_Dysplay_IFRAME(boton ,tabla,fr,url){
	tabla_Dysplay(boton,tabla);
	if(tabla.style.display!='none' && fr.src!=url){
		fr.src=url
	}
	return 0;
}

function tabla_Dysplay(boton , tabla){
	if(tabla.style.display=='none'){
		tabla.style.display='block';
		if(boton!= null){ 
			boton.innerText = '-' ; 
		}
	}else{
		tabla.style.display='none';
		if(boton!= null){ 
			boton.innerText = '+' ; 
		}
	}
	return 1;
}

function selectAll(form,tipo)
{
	with (form)
	{
		var check = false;
		var i=0;

		for (i=0; i< elements.length; i++)
			if (elements[i].type == tipo)
				//if (elements[i].name.substring(0, select.length) == select)
				{
					check = !(elements[i].checked);	break;
				}

		for (i=0; i < elements.length; i++)
		{
			if (elements[i].type == tipo)
				//if (elements[i].name.substring(0, select.length) == select)
					elements[i].checked = check;
		}
	}
}


// Example: obj = findObj("image1");
function buscarObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = buscarObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
//
// Accepts a variable number of arguments, in triplets as follows:
// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: ignored (for backward compatibility)
// arg 3: 'hide' or 'show' or 'change'
// repeat...
//
// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');

function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = buscarObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
		else if ((visStr == 'change') && (obj.visibility=='visible')) visStr = 'hidden';
      	else if ((visStr == 'change') && (obj.visibility=='hidden')) visStr = 'visible';
	  }
      obj.visibility = visStr;
    }
  }
}


