function breakFrames () {
	if ( top != self ) {
		top.location = self.location;
	}
}

var winPop;
function popWin ( params ) {	
	// ----	open popup
	winWidth = 966;
	winHeight = 671;
	// ---	center in screen
	winX = ( window.screen.width / 2 ) - ( ( winWidth / 2 ) + 10 );
	winY = ( window.screen.height / 2 ) - ( ( winHeight / 2 ) + 50 );

	winF 	= "width=" + winWidth
			+ ",height=" + winHeight
			+ ",left=" + winX
			+ ",top=" + winY
			+ ",screenX=" + winX
			+ ",screenY=" + winY
			+ ",status=no"
			+ ",scrollbars=no"
			+ ",resize=no"
			;
	
	winURL = "/path/to/file.php?" + params;
	winPop = window.open ( winURL, "newWin", winF );
	setTimeout ( 'winPop.focus();', 150 );
}

function parse_links () {
	// ---	cycle all document links
	for ( i = 0;  i < document.links.length;  i++ ) {
		currHref 	= document.links[ i ].href;
		currText 	= document.links[ i ].innerHTML;
		if ( currHref && currHref.indexOf ( "[[" ) != -1 ) 	document.links[ i ].href 		= parse_eml ( currHref );
		if ( currText && currText.indexOf ( "[[" ) != -1 ) 	document.links[ i ].innerHTML 	= parse_eml ( currText );
	}
}
function parse_eml ( str ) {
	posBegin 	= str.indexOf ( "[[" );
	posEnd 		= str.indexOf ( "]]" );
	strBegin 	= str.substr ( 0, posBegin );
	strEnd 		= str.substr ( posEnd +2 );
	strParse 	= str.substr ( ( posBegin +2 ), ( posEnd - ( posBegin +2 ) ) );
	arrParse 	= strParse.split ( "," );
	strEml 		= strBegin + arrParse[ 2 ] + "@" + arrParse[ 1 ] + "." + arrParse[ 0 ] + strEnd;
	return strEml;
}

function toggleLayer ( divID ) {
	oDiv 	= document.getElementById ( divID );
	if ( oDiv.style.display == "none" || !oDiv.style.display ) {
		oDiv.style.display = "block";
	} else {
		oDiv.style.display = "none";
	}
}

