/* ***************************************************
 Javascript info : 
 
 author     :	Francesco Izzo	
 
 date  	    :	june 2001
 project    :	AWE_SILG 
 copyright  :	Archilex sa 

 ----------------------------------------
 Archilex sa
 via al molino - c.p. 615
 6916 Lugano - Grancia
 tel. +41 (0)91 980 08 08

 e-mail : 	info@archilex.com
 http:		www.archilex.com
	
	

**************************************************** */



var NS4 = (document.layers);
var IE4 = (document.all);

var myPopUp;

//var win = this;


var n = 0;
var myOldTarget = 1
var myOldStr = " ";

// ------------------------------------------------


function myLinkonLeftFrames(mytoolbar,myindex) 
{ 			
	top.frames[1].frames[0].location =  mytoolbar;
 	top.frames[1].frames[1].location =  myindex;		
		
}

function BandChange(form) 

{ 		
	
	var myindex = form.SelectedBand.selectedIndex;
	var myLocation = form.SelectedBand.options[myindex].value;		
	top.frames[1].frames[1].location = myLocation; 	
}



// ------------------------------------------------

function findInPageII(str, target) 
{
	
if (top.frames[1].length < 1) alert("Veuillez sélectionner une rubrique !");

else
    {	
	//alert(top.frames[1].frames[3].name);
	//alert(top.frames[1].frames[4].frames[1].name);
	
	var NS4 = (document.layers);
	var IE4 = (document.all);
	//









        //
	
	myOldTarget = target
	if (target == 0)
	{
		var win = top.frames[1].frames[1];

	}
	
	
	if (target == 1)
	{
		var win = top.frames[1].frames[2].frames[1];

	
		if (typeof win  == 'object')
		{
		
		}
		else
		{
			var win = top.frames[1].frames[2];
		}
	}



	if ( str != "" )
	{
		


		if ( n == 0 )
		{
			myOldStr = str;
			//alert(myOldStr);
		}

		else		
		{
			//alert("else->" + myOldStr);
			if ( myOldStr != str )
			{
				n = 0;
				myOldStr = str;
				//alert("else II->" + myOldStr);
			}
		}					
				
	
		if  ( (!(NS4)) && (!(IE4)) )
		{
			alert("sélectionner le document et presser les boutons <Ctrl> et <f>");
			return false;
		}	
	
		var txt, i, found;
		if (str == "")
		return false;			
		
		
		if (NS4) 
		{
				
			if (!win.find(str))
			{
				while(win.find(str, false, true))
				n++;
			}
			else
			{
				n++;
				if (n == 0) alert("Aucune occurrence trouvée pour "+str);
			}
		}	
	}
	
	if (IE4) 
	{		
			

		txt = win.document.body.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) 
		{
			txt.moveStart("character", 1);
			txt.moveEnd("textedit");
		}
	
	
		if (found) 
		{
			txt.moveStart("character", -1);
			txt.findText(str);
			txt.select();
			txt.scrollIntoView();
			n++;
		}
		else 
		{
			if (n > 0)
			{
				n = 0;
				
				//alert(str);
				findInPageII(str,myOldTarget);
			}
			else
			{	
				alert("Aucune occurrence trouvée pour "+str);
			}
	
		}
	
	}


   }
}




function MyDocPopUp(myFile) 
{	
			
	if (typeof myPopUp  == 'object')
	{					
	  
            if (myPopUp.closed == false)
            {
			    
                myPopUp.close();

            }
	}			
	
			
			
	if (parent.document.location==window.document.location)
        {		
        document.location.href = myFile;																		
        }
        else
        {		
        myPopUp = window.open(myFile+"?net",'','fullscreen=0,scrollbars=1,resizable=1, toolbar=0,width=500, height=400');																		
        }
       				
                        
 }


function MySearch()
{
     	alert('En cours de construction');
	// per abilitare la ricerca eliminare il commento alle due linee seguenti
	//top.frames[1].frames[0].location =  "mainsearch.html";
 	//top.frames[1].frames[1].location =  "recherche_blank.html";

}
