function showSheet(content)
{
	var sheet = document.getElementById('sheet');
	var sheetContent = document.getElementById('sheetContent');
	sheetContent.innerHTML = content;
	sheet.style.visibility = 'visible';
	return false;
}

function toggleVisibility(whichForm, setVisible)
{
	var newstate="none"
	if(setVisible == true) 
		newstate = ""

	//alert("element " + whichForm + " toggled to " + setVisible);
	
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichForm).style;
		style2.display = newstate;
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichForm].style;
		style2.display = newstate;
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichForm].style;
		style2.display = newstate;
	}
}
	

function setInnerHTML(div_id, value)
{
	var dstDiv = document.getElementById(div_id);
	dstDiv.innerHTML = value;
}

function openPopup(url, name, height, width)
{
	newwindow=window.open(url, name,'height='+height+',width='+width);
	if (window.focus) {newwindow.focus()}
	return false;
}




function openDiv (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "block";
	}
}
function closeDiv (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "none";
	}
}

function showInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "inline";
	}
}
function hideInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "none";
	}
}


function blurElement (elName) {
	var theElement = document.getElementById(elName);
	if (theElement) {
		theElement.blur();
	}
}

function selectLink (elName) {
	var theElement = document.getElementById(elName);
	if (theElement) {
		theElement.className = "selectedNavLink";
	}
}
function unSelectLink (elName) {
	var theElement = document.getElementById(elName);
	if (theElement) {
		theElement.className = "unSelectedNavLink";
	}
}


function toggleDisplay(divName){
	var tempDiv = document.getElementById(divName);
	if (!tempDiv) {
		return;
	}  
	 if ((tempDiv.style.display=="block")||(tempDiv.style.display=="" && tempDiv.className.indexOf("hid") == 0)){
	 	tempDiv.style.display="none";
	 }
	 else {	
	 	if ((tempDiv.style.display=="none")||(tempDiv.className.indexOf("hid") != 0)){
			tempDiv.style.display="block";
		}
	 }
}

function hideDiv(divName){
	tempDiv = document.getElementById(divName);
	if (!tempDiv) {
		return;
	}
	if (tempDiv.style.display=="block"){
	     tempDiv.style.display="none";
	}
}

function showDiv(divName){
	tempDiv = document.getElementById(divName);
	if (!tempDiv) {
	  return;
	}
	if (tempDiv.style.display=="none"){
		tempDiv.style.display="block";
	 }
}


//Drop Down Menu Functions


function showDropdown() {
	toggleVisibility('myAccountDropdown',1);
	document.arrowImg.src='/img/icon_menarrwdrpdwn_down_14x14.gif';
}

function hideDropwdown() {
	toggleVisibility('myAccountDropdown',0);
	document.arrowImg.src='/img/icon_menarrwdrpdwn_regular_14x14.gif';
	tempDropdownShow = 0;
	return false;
}


function changeBGcolor(tempDiv, onOrOff) {
	if(onOrOff==1) { tempDiv.style.backgroundColor='#FFFFE1'; tempDiv.style.cursor='pointer';tempDiv.style.cursor='hand';}
	else {tempDiv.style.backgroundColor='#FFFFFF'}

}

function imgRollover(imgIdArr)
{
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var i=0;
	var imgId='';
	var imgEle='';
	var imgArr=new Array;
	for (i=0;i<imgIdArr.length;i++)
	{
		if (document.getElementById(imgIdArr[i]))
		{
			imgArr.push(document.getElementById(imgIdArr[i]));
		}
	}
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgArr.length;i++)
	{
		if (imgArr[i].className.indexOf('rollover')>-1)
		{
// If for some reason images are stored outside of the /img dir, this will break
			imgSrc[i]=imgArr[i].getAttribute('src');
			imgClass[i]=imgArr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/rollover (\S+)/)) 
			{
				imgPreload[i].src = '/img/'+imgClass[i].match(/rollover (\S+)/)[1]
			}
			imgArr[i].setAttribute('rsrc', imgSrc[i]);
			imgArr[i].onmouseover=function() 
			{
				this.setAttribute('src', '/img/'+this.className.match(/rollover (\S+)/)[1])
			}
			imgArr[i].onmouseout=function() 
			{
				this.setAttribute('src',this.getAttribute('rsrc'))
			}
		}
	}
}

function clapMenu(tagID) {
	switchStyle=document.getElementById(tagID);
	switchStyle.style.display=(switchStyle.style.display=='block')?'none':'block'
}

function aleatorio(inferior,superior){
    numPosibilidades = superior - inferior
    aleat = Math.random() * numPosibilidades
    aleat = Math.floor(aleat)
    return parseInt(inferior) + aleat
} 

function clapBG(tagID,BG) {
	switchStyle=document.getElementById(tagID);
	switchStyle.style.background=(switchStyle.style.background=='url()')?'none':'block'
}

function clapBGCOLOR(tagID,tagID2) {
	color=aleatorio(1,5);
	degcolor=color;
	topcolor=color;
	degImg="deg";
	topImg="top";
	degImg+=color;
	topImg+=color;
	extImg=".jpg";
	degImg+=extImg;
	topImg+=extImg;
	switch(color){
		case 1: degcolor="#2E6174"
				topcolor="#000000"
				break
		case 2: degcolor="#9B013D"
				topcolor="#9B013D"
				break
		case 3: degcolor="#BFDEF0"
				topcolor="#BFDEF0"
				break
		case 4: degcolor="#A44708"
				topcolor="#A44708"
				break
		default: degcolor="#FFFFFF"
				 topcolor="#FFFFFF"
	}
	switchStyle=document.getElementById(tagID);
	bg="url("+ topImg +") top center no-repeat "+ topcolor;
	switchStyle.style.background=(switchStyle.style.background==topcolor)?'none': bg;
	
	switchStyle2=document.getElementById(tagID2);
	bg2="url("+ degImg +") top left repeat-x "+ degcolor;
	switchStyle2.style.background=(switchStyle2.style.background==degcolor)?'none': bg2;
}

function showLay (url, id_contenedor)
{
    var pagina_requerida = false;
    if (window.XMLHttpRequest)
    {
        // Si es Mozilla, Safari etc
        pagina_requerida = new XMLHttpRequest ();
    } else if (window.ActiveXObject)
    {
        // pero si es IE
        try 
        {
            pagina_requerida = new ActiveXObject ("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            // en caso que sea una versión antigua
            try
            {
                pagina_requerida = new ActiveXObject ("Microsoft.XMLHTTP");
            }
            catch (e)
            {
            }
        }
    } 
    else
    return false;
    pagina_requerida.onreadystatechange = function ()
    {
        // función de respuesta
        cargarpagina (pagina_requerida, id_contenedor);
    }
    pagina_requerida.open ('GET', url, true); // asignamos los métodos open y send
    pagina_requerida.send (null);
}

function cargarpagina (pagina_requerida, id_contenedor)
{
    if (pagina_requerida.readyState == 4 && (pagina_requerida.status == 200 || window.location.href.indexOf ("http") == - 1))
    document.getElementById (id_contenedor).innerHTML = pagina_requerida.responseText;
}

function cerrarPopup(pid)
   {
      document.getElementById(pid).style.visibility = 'hidden';      
      document.getElementById('estudios').style.visibility = 'visible';      	  
      document.getElementById('actividad').style.visibility = 'visible';      	  
   }
function abrirPopup(pid)
   {
      document.getElementById(pid).style.visibility = 'visible';      
      document.getElementById('estudios').style.visibility = 'hidden';      	  
      document.getElementById('actividad').style.visibility = 'hidden';      	  
   }
function viewLAY(Lid)
	{
      document.getElementById(Lid).style.display = 'block';      
	}
function hideLAY(Lid)
	{
      document.getElementById(Lid).style.display = 'none';      
	}