var testSite = top.baseChiosco + ''


function ritorna(url_rit, meseanno, ncomm) {

	if (testSite != 'undefined') {
		
		myUrl = top.location.href + ''
		posizione = myUrl.substr(myUrl.indexOf("source=") + 7)
		
		posPosition = posizione.indexOf("position")
		
		if (posPosition > 0) {
		} else {
			posPosition = posizione.indexOf("content")
		}			
		

		finale = posizione.substr(0,posPosition - 1)
		window.open(unescape(finale), '_top');
	}


// CERCA LA RIGA CONTENT

   loc_top = parent.location.href;
 
   poscont = 0;
   possource = 0;	
   possource = loc_top.indexOf("source="); 

   if ((possource == 0) || (possource == -1)) {
      possource = 9999
   }
	



// LINK DI RITORNO AL FRONTESPIZIO Chiamata da attivitą deputati

   loc_top = parent.location.href;	
   posbic = 0;	
   posbic = loc_top.indexOf("$sezione"); 	

   if ((posbic != 0) && (posbic != -1)) {
      window.open(url_rit, "bottom");
		return;
	}   


	

  		
// LINK DI RITORNO ALLE BICAMERALI

   loc_top = parent.location.href;	
   posbic = 0;	
   posbic = loc_top.indexOf("bicamerali"); 	

   if (((posbic != 0) && (posbic != -1)) && (posbic < possource)) {
      loc_bot = top.bottom.location.href;
	
      posbot = loc_bot.indexOf("campo=") + 6;
      riturl = loc_bot.substring(posbot);

      window.open(riturl, "bottom");
	return;
   }



// LINK DI RITORNO ALLE INDAGINI CONOSCITIVE

   loc_top = parent.top.location.href;	

   
   posind = 0;	
   posind = loc_top.indexOf("indagini"); 	
  

   if (((posind != 0) && (posind != -1)) && (posind < possource)) {
      loc_bot = top.bottom.location.href;

      posbot = loc_bot.indexOf("campo=") + 6;
      riturl = loc_bot.substring(posbot);

	posint = posbot - 7;

	posrit = 0;	
	posrit = loc_bot.indexOf("posrit=");
      
      if ((posrit != 0) && (posrit != -1)) {
         
         campohref = loc_bot.substring(posint, posrit)
         riturl = riturl + "?" + campohref
      }

	
      window.open(riturl, "bottom");
     
	return;
   }



// LINK DI RITORNO ALLE AUDIZIONI

   loc_top = parent.top.location.href;	
  	
   
   posind = 0;	
   posind = loc_top.indexOf("audizioni"); 	
  
   if (((posind != 0) && (posind != -1)) && (posind < possource)) {
      loc_bot = top.bottom.location.href
     

      posbot = loc_bot.indexOf("campo=") + 6
      riturl = loc_bot.substring(posbot)

	posste = 0	
	posste = loc_bot.indexOf("stencomm/") + 9
	posaud = loc_bot.indexOf("/audiz")
	      
      if ((posste != 0) && (posste != -1)) {
         
         campohref = loc_bot.substring(posaud, posste)
         riturl = riturl + "?posrit=" + campohref
      }

	
      window.open(riturl, "bottom")
     
	return
   }




// LINK DI RITORNO AL FRONTESPIZIO	   
   a = parent.location.href;


   b = 0;
   b = a.indexOf("bollettino");

   if (((b != 0) && (b != -1)) && (b < possource)){
      window.open(url_rit, "bottom");
      return;
   }


// RITORNO AL MESE PER I BOLLETTINI APERTI DINAMICAMENTE DALLE SCHEDE	   
   a = parent.location.href;
 
  
   b = 0;
   b = a.indexOf("frsmcdin.asp");

   if (((b != 0) && (b != -1)) && (b < possource)){
      
      c = 0
      c = a.indexOf("percboll=") + 9
	    
      ritorno = a.substr(c, 34) + "sedute/" 
       	    
      
      d = 0
      d = a.indexOf("commis=") + 7

      ritorno = ritorno + a.substr(d, 2) + "r.htm"
      
           	 	    
	    
      window.open(ritorno, "bottom");
      return;
   }





// LINK DI RITORNO AL MESE DI RICHIAMO	   

   a = top.bottom.location.href;

  
   c = a.indexOf("campo=") + 6;

   ritorno = a.substring(c); 
   window.open(ritorno, "bottom");
   return;
  
   


} 


function nuova_frame(parm_url, parm_target) {


// CERCA LA RIGA CONTENT

   loc_top = parent.location.href;
 
   poscont = 0;
   possource = 0;	
   possource = loc_top.indexOf("source="); 

   if ((possource == 0) || (possource == -1)) {
      possource = 9999
   }


// NUOVA FRAME PER INDAGINI CONOSCITIVE


   loc_top = parent.top.location.href;	
   posind = 0;	
   posind = loc_top.indexOf("indagini"); 	

   a = top.bottom.location.href   

   c = a.substring(5);

	   
   if (((posind != 0) && (posind != -1)) && (posind < possource)) {
       
       posint = 0
       posint = a.indexOf("?")
 
 	 if ((posint != 0) && (posint != -1)) {
          c = a.substring(posint, 5)
       }
   }


// NUOVA FRAME PER AUDIZIONI

   posind = 0;	
   posind = loc_top.indexOf("audizioni"); 	

   if (((posind != 0) && (posind != -1)) && (posind < possource)) {
       
       posint = 0
       posint = a.indexOf("?")
 
 	 if ((posint != 0) && (posint != -1)) {
          c = a.substring(posint, 5)
       }
   }


   window.open (parm_url + "?campo=" + c, parm_target);


}


//function nuova_frame(parm_url, parm_target){
//	nuova_frame3(parm_url, parm_target)
//}

   function nuova_frame3(parm_url, parm_target) {
		pos = parm_url.lastIndexOf("elenco.htm");
		primaurl = parm_url.substr(0,19);
		secondurl = parm_url.substring(28,pos);
		myurl=secondurl+primaurl;
		p_url= ("/chiosco.asp?cp=2&position=Organi%20Parlamentari|barraindietro|Commissioni%20permanenti|barraindietro|Indagini%20Conoscitive&source=" + escape(document.location.href) + "&content=/" + myurl);	
		
		//modifica resasi necessaria per un problema evidenziato dall'ing Paradiso 04/11/03
		if(p_url.indexOf("0925p") > 0) {
			p_url= p_url.split("//_dati").join("/_dati");
			p_url = p_url + "m";
		}
		//fine modifica
		
		parent.document.location.href=p_url;
   }


