// pop-up window
function openwin( url )
{
  attrib='width=500,height=500,scrollbars=yes,menubar=no,toolbar=no,screenX=50,screenY=50,top=50,left=50,resizable=no';
  win=window.open( url, "AlpiCuneesiWin", attrib );
  win.focus();
}	

// prevent displaying the current page inside an external frame
function onTop()
{
	if( top != self ) 
		/* nota self.document.location ritorna l'url corrente */
		top.location.href = self.document.location;
}

// redirect page when outside the frameset
function redir( redirToUrl )
{
	// if not specified, the redirToUrl is assumed to be 'index'+'current file name'
	if( !redirToUrl )
	{
		url = self.location.href;
		pos = url.lastIndexOf( "/" );
		redirToUrl = "index".concat( url.substr( pos+1 ) );
	}
	
	// redirect when outside frameset
	if( self == self.parent )
	{
		redirectTime = "2000";  // 2 sec
		redirectURL = redirToUrl;
		
		text = '<p align="center">Questa pagina è parte del sito AlpiCuneesi.it e va visualizzata all\'interno di un FrameSet<br>';
		text += 'Al termine del caricamento della pagina, sarete rediretti all\'indirizzo corretto.<br>';
		text += 'Se questo non accadesse, cliccate sul link qui a fianco <a href="'+redirToUrl+'" class="lnk">'+redirectURL+'</a><br>';
		text += 'o andate direttamente alla home page del sito <a href="http://www.alpicuneesi.it" class="lnk">www.alpicuneesi.it</a></center><p>';
		document.write( text );

		setTimeout( "location.href = redirectURL;", redirectTime );
	}
}

function mailtoRP()
{
	document.write("<a href=\"&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#114;&#111;&#98;&#101;&#114;&#116;&#111;&#46;&#112;&#111;&#99;&#107;&#97;&#106;&#64;");
	document.write("&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;\" style=\"color:rgb(155,207,110); text-decoration:none;\">");
	document.write("<b>roberto.pockaj&#64;");
	document.write("&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;</b></a><br>");	
}


// no more used: redirect page when outside the frameset (with META tag)
function redir2( url )
{
	if( self == self.parent )
	{
		text = '<p align="center">Questa pagina è parte del sito AlpiCuneesi.it<br>';
		text += 'Al termine del caricamento della pagina, sarete rediretti all\'indirizzo corretto.<br>';
		text += 'Se questo non accadesse, cliccate sul link qui sotto:<br><a href="http://www.alpicuneesi.it" class="lnk">www.alpicuneesi.it</a></center><p>';
		document.write( text );
		text = '<META http-equiv="Refresh" content="2;url='+url+'">';
		document.write( text );
	}
}

