function OpenComments (c) {
    window.open(c,
                    'comments',
                    'width=480,height=480,scrollbars=yes,status=yes');
}

// ----------------------------------------------------------

function OpenTrackback (c) {
    window.open(c,
                    'trackback',
                    'width=480,height=480,scrollbars=yes,status=yes');
}

// ----------------------------------------------------------

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// ----------------------------------------------------------

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// ----------------------------------------------------------

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// ----------------------------------------------------------

var HOST = '<$MTBlogHost$>';

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

// ----------------------------------------------------------

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

// ----------------------------------------------------------

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

// ----------------------------------------------------------

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

// ----------------------------------------------------------

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
    setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
    setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

// ----------------------------------------------------------

function forgetMe (f) {
    deleteCookie('mtcmtmail', '', HOST);
    deleteCookie('mtcmthome', '', HOST);
    deleteCookie('mtcmtauth', '', HOST);
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

// ----------------------------------------------------------

function printminmax() {
  var output = '';
  if (window.name == "maxwin") {
	output = '&nbsp; &nbsp;<a href="javascript:minimize()" title="switch to window mode">minimize</a>&nbsp; &nbsp;|';
  	document.write(output); 
  }
  else {
	output = '&nbsp; &nbsp;<a href="javascript:maximize()" title="switch to fullscreen mode">maximize</a>&nbsp; &nbsp;|';
  	document.write(output); 
  }
}

// ----------------------------------------------------------

function bookmark()	{
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		window.external.AddFavorite(eval(self.location),document.title);
	}else{
		alert('Sorry, this function only works in Internet Explorer.\nTo bookmark this page, choose one of these options:\n1. Right-click this page and choose \"Add Bookmark\"\n2. Press CTRL-D');
		}
	}

// ----------------------------------------------------------

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

// ----------------------------------------------------------

var fullscreenWin = null;
var isMac = navigator.userAgent.toLowerCase().indexOf('mac') != -1;
var isNav = navigator.appName == "Netscape";

// ----------------------------------------------------------

function fullscreenPopup ( url ) {
	// vollbildschirm-fenster öffnen
	
	if ((isNav || isMac) && window.screen) {
		// size popup
		var w = window.screen.availWidth;
		var h = window.screen.availHeight;
		if (isNav) {
			w -= 10;
			h -= 30;
		}
		fullscreenWin = window.open(url,'maxwin','toolbar=0,menubar=0,location=0,directories=0,status=0,resizable=0,scrollbars=1,top=0,left=0,width='+ w +',height=' + h ); 
	}
	else {
		// fullscreenmode für ie unter windows
		fullscreenWin = window.open(url,'maxwin','toolbar=0,menubar=0,location=0,directories=0,scrollbars=1,resizable=1,fullscreen=1'); 
	}
}

// ----------------------------------------------------------

function minimize() {
	// inhalt in browserfenster mit dem namen "minwin" laden
	var url = location.href;
	var w = 900;
	var h = 680;
	
	if (window.screen && window.screen.availWidth < 1000) {
		w=780;
		h=580;
	}
	minWin = window.open(url,"minwin","'toolbar=0,menubar=0,location=0,directories=0,status=1,resizable=1,scrollbars=1,top=50,left=100,width="+w+",height="+h);
	window.close();
}

// ----------------------------------------------------------

function maximize() {
	// page in fullscreen mode öffnen und hintergrundseite im hintergrundfenster laden
	var url = location.href;
	fullscreenPopup(url);
	// aufrufendes fenster schließen
	window.opener = self; // um hinweismeldung zu vermeiden
	window.close();	
}

