// JavaScript Document


// POPUP
function openPOPUP(url){
	var nome_finestra="foto";
	var folder='';	
	ventana=window.open(folder+url,nome_finestra,'width=640,height=500,left=300,top=100,statusbar=yes,resizable=yes,scrollbars=yes');  
	//Asigna la ventana que se abre a la variable hola para poder manejarla en otros eventos
	ventana.focus()   //Hace que la ventana que se abre sea la activa (lleva el foco)
}

//over ITEM
function overITEM()
{
	if (document.getElementById && document.createTextNode)
	{
		var divs=document.getElementsByTagName('div');
		for (var i=0;i<divs.length;i++)
		{
			if(divs[i].className=='item')
			{
				divs[i].onmouseover=function(){
						this.className='item-over';
						return false
					}
				divs[i].onmouseout=function(){
						this.className='item';
						return false
					}		
			}
		}
	}
}

//over riga
function overRIGA ()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='grid-01')
			{
				var trs=tables[i].getElementsByTagName('tr');
			
				
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						if(trs[j].className=='')
						{
							trs[j].onmouseover=function(){this.className='riga-over';return false}
							trs[j].onmouseout=function(){this.className='';return false}						
						}
						else 
						{
							trs[j].onmouseover=function(){this.className='riga-over';return false}
							trs[j].onmouseout=function(){this.className='riga-b';return false}		
						}
						
					}
				}
			}
		}
	}
}
function overINPUT()
{
	if (document.getElementById && document.createTextNode)
	{
		var inputs=document.getElementsByTagName('input');
		for (var i=0;i<inputs.length;i++)
		{
			if(inputs[i].className=='campo')
			{
				inputs[i].onfocus=function(){
						this.className='campo-over';
						return false
					}
				inputs[i].onblur=function(){
						this.className='campo';
						return false
					}							
			}
			if(inputs[i].className=='campo02')
			{
				inputs[i].onfocus=function(){
						this.className='campo02-over';
						return false
					}
				inputs[i].onblur=function(){
						this.className='campo02';
						return false
					}		
			}			
		}
	}
}
function overSELECT()
{
	if (document.getElementById && document.createTextNode)
	{
		var selects=document.getElementsByTagName('select');
		for (var i=0;i<selects.length;i++)
		{
			if(selects[i].className=='campo')
			{
				selects[i].onfocus=function(){
						this.className='campo-over';
						return false
					}
				selects[i].onblur=function(){
						this.className='campo';
						return false
					}		
			}
			if(selects[i].className=='campo02')
			{
				selects[i].onfocus=function(){
						this.className='campo02-over';
						return false
					}
				selects[i].onblur=function(){
						this.className='campo02';
						return false
					}		
			}			
		}
	}
}

/*
// HIDE/VISIBLE
function expand (icoarr, id){
	for (i=0; i < icoarr.length; i++) {
	ico = icoarr[i];
		if (window.getComputedStyle) { //read value, only Moz
		   if ( window.getComputedStyle(document.getElementById(id),null).display == 'none' ) {
				document.getElementById(id).style.display = 'block';
				document.getElementById(ico).src = 'images/ico/sidebar_ico_up.gif';
		  } else {
				document.getElementById(id).style.display = 'none';
				document.getElementById(ico).src = 'images/ico/sidebar_ico_down.gif';
		  }
		 } else { //read value, only IE
		   if ( document.getElementById(id).currentStyle.display == 'none' ) {
				document.getElementById(id).style.display = 'block';
				document.getElementById(ico).src = 'images/ico/sidebar_ico_up.gif';
		  } else {
				document.getElementById(id).style.display = 'none';
				document.getElementById(ico).src = 'images/ico/sidebar_ico_down.gif';
		  }
		}
	} 
}
/////
*/

function overEvents ()
{
	overITEM();
	overRIGA();
	overINPUT();	
	overSELECT();
}

window.onload=function()
{
	overEvents();
} 