var firstTime ='true';

function resizeMe(fr,sx,dx)
 {
 	var url=this.frames['centrale'].location.href;

	if((document.getElementById('tab')!=null) && (document.getElementById('horizDiv')!=null) && (( fr.contentWindow.document.getElementById('contenitor')!=null)) && ((sx.contentWindow.document.getElementById('menuSX')!=null)) && ((dx.contentWindow.document.getElementById('menuDX')!=null)))
	{
	   	if(0>url.indexOf('DettaglioFondo'))  //non si vede il frame tab
		{
	
			document.getElementById('tab').style.display='none';
			document.getElementById('horizDiv').style.display='none';
	
		 	var hsx=0;
		 	var hdx=0;
		 	var hhp=0;
		  	if(document.all)	//explorer
			{
					try {
						fr.height = 0;
						fr.height = parseInt(fr.Document.getElementById('contenitor').scrollHeight,10);
					} catch(e) {fr.height = 770;}
				
	
	
				try {
						sx.height = 0;
						sx.height = parseInt(sx.Document.getElementById('menuSX').scrollHeight,10);
				} catch(e) {sx.height = 800;}
			
				try {
								dx.height = 0;
								dx.height = parseInt(dx.Document.getElementById('menuDX').scrollHeight,10);
				} catch(e) {dx.height = 800;}
					

	
	
				hsx=parseInt(sx.Document.getElementById('menuSX').scrollHeight,10);
				hdx=parseInt(dx.Document.getElementById('menuDX').scrollHeight,10);
				hhp=parseInt(fr.height,10);
		
				
			
				if((hsx>=hdx) && (hsx>hhp))  //menu sx pių alto
				{
					if(440>hsx)
					{
						hsx=440;
					}
					sx.height=hsx;
					dx.height=hsx;
					if((hsx-hhp)>30)
					{
					fr.height=hsx-30;
					}
					else
					{
					fr.height=hhp;
					}
				}
				else if((hdx>hsx) && (hdx>=hhp))  //menu dx pių alto
				{
					if(440>hdx)
					{
						hdx=440;
					}
					sx.height=hdx;
					dx.height=hdx;
					if((hsx-hhp)>30)
					{
					fr.height=hdx-30;
					}
					else
					{
					fr.height=hhp;
					}
				
				}
				else if((hhp>=hsx) && (hhp>hdx))  //hp pių alta
				{
					if(410>hhp)
					{
						hhp=410;
					}
					sx.height=hhp+30;
					dx.height=hhp+30;
					fr.height=hhp;
		
				}
	
		
	
					setHeight(document.getElementById('tab'),sx,fr,dx);
			}
			else
			{		
				//mozilla senza frame tab
				 try {
						fr.height = 0;
						fr.height= parseInt(fr.contentWindow.document.getElementById('contenitor').scrollHeight,10);    // contentWindow oppure contentDocument
					} 
					catch(e) 
					{			
						fr.height= 770;
					}
					try {
						sx.height = 0;
						sx.height = parseInt(sx.contentWindow.document.getElementById('menuSX').scrollHeight,10);
					} catch(e) {sx.height = 800;}
		
					try {
						dx.height = 0;
						dx.height = parseInt(dx.contentWindow.document.getElementById('menuDX').scrollHeight,10);
					} catch(e) {dx.height = 800;}
				
				
					hsx=parseInt(sx.contentWindow.document.getElementById('menuSX').scrollHeight,10);
					hdx=parseInt(dx.contentWindow.document.getElementById('menuDX').scrollHeight,10);
					hhp=parseInt(fr.contentWindow.document.body.scrollHeight,10);
				
					
						
					if((hsx>=hdx) && (hsx>hhp))  //menu sx pių alto
					{
						if(440>hsx)
						{
							hsx=440;
						}
						sx.height=hsx;
						dx.height=hsx;
						if((hsx-hhp)>30)
						{
						fr.height=hsx-30;
						}
						else
						{
						fr.height=hhp;
						}
					}
					else if((hdx>hsx) && (hdx>=hhp))  //menu dx pių alto
					{
						if(440>hdx)
						{
							hdx=440;
						}
						sx.height=hdx;
						dx.height=hdx;
						if((hsx-hhp)>30)
						{
						fr.height=hdx-30;
						}
						else
						{
						fr.height=hhp;
						}
					
					}
					else if((hhp>=hsx) && (hhp>hdx))  //hp pių alta
					{
						if(410>hhp)
						{
							hhp=410;
						}	
						sx.height=hhp+30;
						dx.height=hhp+30;
						fr.height=hhp;
			
					}	
						

					
					
					setHeightMoz(document.getElementById('tab'),sx,fr,dx);
		
			}
		}
		else  //c'č il frame tab (siamo nella pagina dettaglio fondo)
		{
			document.getElementById('tab').style.display='block';
			document.getElementById('horizDiv').style.display='block';
			if(document.all)
			{
				setHeight(document.getElementById('tab'),sx,fr,dx);				
			}
			else
			{
				
				setHeightMoz(document.getElementById('tab'),sx,fr,dx);
			}
			window.scroll(0,0);
		}
	}
}



function ridimensiona(fr)
 {
 	if(document.all)
	 {
		try {
				fr.height = 0;
				fr.height = parseInt(fr.Document.getElementById('contenitor').scrollHeight,10)+3;
			} catch(e) 
			{
				fr.height = 30;
			}
	}
	else
	 {

		try {
				fr.height = 0;
				fr.height = parseInt(fr.contentWindow.document.getElementById('contenitor').scrollHeight,10)+5;
			} catch(e) 
			{
				fr.height = 30;
			}
	}

	

}

function setHeight(fr,sx,hp,dx)
{

	if(document.all)
	 {
	 	
		 if(fr.style.display=='block')
		{
			
			try {
					fr.height = 0;
					fr.height = parseInt(fr.Document.getElementById('schede').scrollHeight,10);
				} catch(e) 
				{
					fr.height = 800;
				}
				
				try {
					hp.height = 0;
					hp.height = parseInt(hp.Document.getElementById('contenitor').scrollHeight,10);
				} catch(e) {hp.height = 200;}
		
		
			try {
					sx.height = 0;
					sx.height = parseInt(sx.Document.getElementById('menuSX').scrollHeight,10);
			} catch(e) {sx.height = 800;}
		
			try {
							dx.height = 0;
							dx.height = parseInt(dx.Document.getElementById('menuDX').scrollHeight,10);
			} catch(e) {dx.height = 200;}


			var s=parseInt(sx.height);
			var h=parseInt(hp.height);
			var t=parseInt(fr.height);
			var d=parseInt(dx.height);

			if(d>(h+22))
			{
				hp.height=d-22;
			}
			else
			{
				dx.height=h+22;
			}
			
			
			s=parseInt(hp.height)+t+30;
			
				sx.height=s;
			document.getElementById('tab').height=t;
	
		}
	}
	if((firstTime=='true') && (calcolaPath()!=''))
	{
		self.menu.openAllFromDefault(calcolaPath());
		firstTime='false';

	}
}

function setHeightMoz(fr,sx,hp,dx)
{
 	
 	if(!document.all)
	{
		if(fr.style.display=='block')
		{
			try {
				var i=parseInt(fr.contentWindow.document.getElementById('schede').scrollHeight,10);
				fr.height = 0;
				fr.height =i ;
	
			} catch(e) 
			{
				fr.height = 800;
			}
		
				try {
					hp.height = 0;
					
					hp.height = parseInt(hp.contentWindow.document.getElementById('contenitor').scrollHeight,10);
				} catch(e) {hp.height = 200;}
				
			try {
					sx.height = 0;
					sx.height = parseInt(sx.contentWindow.document.getElementById('menuSX').scrollHeight,10);
			} catch(e) {sx.height = 800;}
		
			try {
							dx.height = 0;
							dx.height = parseInt(dx.contentWindow.document.getElementById('menuDX').scrollHeight,10);
			} catch(e) {dx.height = 200;}

			var s=parseInt(sx.height);
			var h=parseInt(hp.height);
			var t=parseInt(fr.height);
			var d=parseInt(dx.height);
						
			if(d>(h+22))
			{
				hp.height=d-22;
			}
			else
			{
				dx.height=h+22;
			}
			s=parseInt(hp.height)+t+30;
			
			sx.height=s;
		
		}
	}
	if((firstTime=='true') && (calcolaPath()!=''))
	{
		self.menu.openAllFromDefault(calcolaPath());
		firstTime='false';
	}
}


function caricaFrames()
{
	var path =calcolaPath();
	var URLIN = calcolaUrl();
	if(path.length==0)
	{
		document.getElementById('menu').src=server+'/'+'Menu.jsp';
		document.getElementById('footer').src=server+'/'+'Footer.jsp';
		document.getElementById('menu2').src=server+'/'+'InEvidenza.jsp';
		document.getElementById('centrale').src=server+'/'+'HomePage.jsp';
		document.getElementById('Logo').src=server+'/'+'Intestazione.jsp';
		document.getElementById('ticker').src="/ticker.html";
		
	}
	else
	{		
		document.getElementById('menu').src=server+'/'+'Menu.jsp';
		document.getElementById('centrale').src=server+'/'+URLIN;
		document.getElementById('footer').src=server+'/'+'Footer.jsp';
		document.getElementById('Logo').src=server+'/'+'Intestazione.jsp';
		document.getElementById('ticker').src=server+'/Rotta.jsp?id_path='+path;
		var pathidFondo=URLIN.indexOf("id_DU_Fondi=");
		var id_fondi="";
		if (pathidFondo!= -1) 
		{
		  id_fondi=URLIN.substring(pathidFondo);
		  document.getElementById('tab').src=server+'/'+'Tab1.jsp?'+id_fondi;
		}
		var ids = path.split('/');
	}

	
}

function caricaFrames_stdAlone(actPage,actPars,actMenuDx)
{
	var path =calcolaPath();
	var URLIN = calcolaUrl();
	if(path.length==0)
	{
		document.getElementById('menu').src=server+'/'+'Menu.jsp';
		document.getElementById('footer').src=server+'/'+'Footer.jsp';
		if(actMenuDx=="")
		 document.getElementById('menu2').src=server+'/'+'InEvidenza.jsp';
		else
		 document.getElementById('menu2').src=server+'/'+ actMenuDx + '.jsp' + '?id_img1=6';
		document.getElementById('centrale').src=server+'/'+ actPage + '.jsp' + actPars;
		document.getElementById('Logo').src=server+'/'+'Intestazione.jsp';
		document.getElementById('ticker').src="/ticker.html";
		
	}
	else
	{		
		document.getElementById('menu').src=server+'/'+'Menu.jsp';
		document.getElementById('centrale').src=server+'/'+URLIN+ actPars;
		document.getElementById('footer').src=server+'/'+'Footer.jsp';
		document.getElementById('Logo').src=server+'/'+'Intestazione.jsp';
		document.getElementById('ticker').src=server+'/Rotta.jsp?id_path='+path;
		var pathidFondo=URLIN.indexOf("id_DU_Fondi=");
		var id_fondi="";
		if (pathidFondo!= -1) 
		{
		  id_fondi=URLIN.substring(pathidFondo);
		  document.getElementById('tab').src=server+'/'+'Tab1.jsp?'+id_fondi;
		}
		var ids = path.split('/');
	}
}

function calcolaPath()
{
	var location1 = document.location.href;
	var positpath1=location1.indexOf("id_path=");
	var location_conpath1="";
	var path1="";
	if (positpath1!= -1) 
	{
		  location_conpath1=location1.substring(positpath1+8);
		  if(location_conpath1.indexOf("&")>0)
		  {
		  	path1=location_conpath1.substring(0,location_conpath1.indexOf("&"));
		  }
		  else
		  {
		  	path1=location_conpath1;
		  }
	}
	return(path1);
}


function calcolaUrl()
{
	var location1 = document.location.href;
	var positURL1=location1.indexOf("URL=");
	var URLIN1="";
	if (positURL1!= -1) 
	{
	  URLIN1=location1.substring(positURL1+4);
	}
	return(URLIN1);
}


