/*
<script language="JavaScript" src="common.js">
</script>
function $(e) {
	return (typeof e == 'string') ? document.getElementById(e) : e;
}

function toggleVisible (e) {
	var b = $(e).style.display != 'none';
	$(e).style.display = b ? 'none' : '';
	return b;
}
*/
var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}
function assertFrame(url)
{
	// use print() to create top-level frameset
	// commonInit must be called AFTER everything is loaded (setTimeout() or onLoad)
	document.close(); 
	document.open("text/html","replace");
	document.writeln('<HTML><head><title>Wendt´s Homepage</title></head>');
	document.writeln("<!-- auto frame for "+url+" -->");
	document.writeln('<FRAMESET COLS="128,1*" ROWS="*" BORDER="0" FRAMESPACING="0" FRAMEBORDER="NO">');
	document.writeln('  <FRAMESET ROWS="43,1*" COLS="*" FRAMEBORDER="NO" BORDER="0" FRAMESPACING="0">');
	document.writeln('    <FRAME SRC="/fTop.html" NAME="fTop" SCROLLING="NO" NORESIZE MARGINWIDTH="0">');
	document.writeln('    <FRAMESET ROWS="1*,43" COLS="*" FRAMEBORDER="NO" BORDER="0" FRAMESPACING="0">');
	document.writeln('      <FRAMESET ROWS="1*,200" COLS="*" frameborder="NO" border="0" framespacing="0">');
	document.writeln('        <FRAME SRC="/fNav.html" NAME="fNav" SCROLLING="NO" NORESIZE MARGINWIDTH="0">');
	document.writeln('        <FRAME SRC="/fInfo.html" NAME="fInfo" SCROLLING="NO" NORESIZE MARGINWIDTH="0" >');
	document.writeln('      </FRAMESET>');
	document.writeln('      <FRAME SRC="/fBottom.html" NAME="fBottom" SCROLLING="NO" NORESIZE>');
	document.writeln('    </FRAMESET>');
	document.writeln('  </FRAMESET>');
	document.writeln('  <FRAME NAME="fMain" SRC="'+url+'">');
	document.writeln('</FRAMESET>');
	document.writeln('<NOFRAMES><BODY BGCOLOR="#FFFFFF">Ihr Browser unterst&uuml;tzt keine Frames...</BODY></NOFRAMES>');
	document.writeln('</HTML>');
	document.close(); 
	return true; 
}

function commonInit() {
	// Make sure, this page is opened in the wwWendt frameset.
	// Also synchronize the navigation buttons.
	if ( top.frames['fNav'] ) {
		if ( top.fNav.realizeContent )
			parent.fNav.realizeContent();
	} else {
		var url = location.pathname;
		var bOpen = true;
		for (i=0; i<top.frames.length; i++)
			alert (top.frames[i].name);
		if ( parent.frames.length>0 ) {
//			alert ('Diese Seite ('+url+') wurde in einem fremden Frameset geöffnet.\nDas Frameset wird nun gestartet...');
			bOpen = confirm ('Diese Seite ('+url+') wurde in einem fremden Frameset geöffnet.\nMöchten Sie das Frameset nun laden?');
		} else {
			bOpen = true;
//			bOpen = confirm ('Diese Seite ('+url+') wurde ausserhalb des "wwWendt"-Framesets geöffnet.\nMöchten Sie das Frameset nun laden?');
		}
		if ( bOpen ) {
//			url += "?" + Math.random(); // prevent caching
			url += "?rnd=" + Math.random(); // prevent caching (2006-07-07: changed to rnd= for easier filtering)
			assertFrame (url);
		}
	}
    return true;
}

/*****************************************************
 * Social Bookmak Bar
 * 16x16 icons must be stored as '/images/socialize_MODE.gif'
 * 2007 Martin Wendt
 **/

// encoded URL (strip parameters)
var thisUrl   = encodeURIComponent ( location.href.split('?') [0] );
var thisTitle = encodeURIComponent (document.title);

var bmbDefaultHint = 'Boomark "' + document.title + '"'; 

var aUrl = new Array();

aUrl ['blinklist']  = { url:  'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=' + thisUrl + '&Title=' + thisTitle,
		                hint: 'Blink It' };
aUrl ['delicious']  = { url:  'http://del.icio.us/post?v=4&noui&jump=close' + '&url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Save this Page to del.icio.us' };
aUrl ['digg']       = { url:  'http://digg.com/submit?phase=2&topic=software' + '&url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Digg This' };
aUrl ['furl']       = { url:  'http://www.furl.net/storeIt.jsp?u=' + thisUrl + '&t=' + thisTitle + ' ',
		                hint: 'Furl It' };  
aUrl ['google']     = { url:  'http://www.google.com/bookmarks/mark?op=add&bkmk=' + thisUrl + '&title=' + thisTitle + ' ',
//aUrl ['google']     = { url:  'http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=' + thisUrl + '&title=' + thisTitle + ' ',
		                hint: 'Bookmark at Google' };
aUrl ['misterwong'] = { url:  'http://www.mister-wong.de/index.php?action=addurl&bm_url=' + thisUrl + '&bm_description=' + thisTitle,
		                hint: 'Zu Mister Wong hinzuf&uuml;gen' };
aUrl ['newsvine']   = { url:  'http://www.newsvine.com/_tools/seed&save?u=' + thisUrl + '&h=' + thisTitle,
		                hint: 'Add to NewsVine' };
aUrl ['reddit']     = { url:  'http://reddit.com/submit?url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Add to reddit' };
aUrl ['slashdot']   = { url:  'http://slashdot.org/bookmark.pl?url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Slashdot It!' };
aUrl ['technorati'] = { url:  'http://technorati.com/faves?add=' + thisUrl,
		                hint: 'Add to Technorati' };
aUrl ['yahoo']      = { url:  'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + thisUrl + '&t=' + thisTitle,
		                hint: 'Add to Yahoo My Web' };
aUrl ['spurl']      = { url:  'http://www.spurl.net/spurl.php?title=' + thisTitle + '&url=' + thisUrl,
		                hint: 'Add to Spurl' };

function writeBookmarkHtml (mode) {
	document.write ('<a href=' + aUrl[mode].url 
	+ ' title="' + aUrl[mode].hint + '"'
	+ ' onMouseOver="document.getElementById(\'idBmbHint\').innerHTML=this.title"'
	+ ' onMouseOut="document.getElementById(\'idBmbHint\').innerHTML=bmbDefaultHint"'
//	+ ' target="_blank">'
	+ '<img src="/images/socialize_' + mode + '.gif" width="16" height="16" border="0">'
	+ '</a>');
}
function insertSocialBookmarkBar() {
	document.write('<div class="socialBookmarkBar">');
	document.write('<span id="idBmbHint">' + bmbDefaultHint + '</span>');
	document.write('<span class="bmbLinks">');
/* this works, but we loose control about the icon order: 
	for (var u in aUrl) {
		writeBookmarkHtml (u);
	}
*/	
	writeBookmarkHtml ('delicious');
	writeBookmarkHtml ('digg');
	writeBookmarkHtml ('furl');
	writeBookmarkHtml ('google');
	writeBookmarkHtml ('misterwong');
	writeBookmarkHtml ('newsvine');
	writeBookmarkHtml ('reddit');
	writeBookmarkHtml ('slashdot');
	writeBookmarkHtml ('technorati');
	writeBookmarkHtml ('yahoo');
	writeBookmarkHtml ('blinklist');
	writeBookmarkHtml ('spurl');

	document.write('</span>');
	document.write('</div>');
}
