// Weiterleitung auf Mobile Website:
    function Client() {
    }
 
    Client.prototype.mobileClients = ["240x320","blackberry","netfront","nokia","panasonic","portalmmm","sharp","sie-","sonyericsson","symbian","windows ce","benq","mda","mot-","philips","pocket pc","sagem","samsung","sda","sgh-","vodafone","xda","iphone","android"];
 
    Client.prototype.OperaMini = ["midp","opera mini"]
 
    Client.prototype.isMobileClient = function(userAgent)
    {
        userAgent=userAgent.toLowerCase();
        for (var i in this.mobileClients) {
            if (userAgent.indexOf(this.mobileClients[i]) != -1) {
                return true;
            }
        }
        return false;
    }
 
Client.prototype.isOperaMini = function(userAgent)
    {
        userAgent=userAgent.toLowerCase();
        for (var i in this.OperaMini) {
            if (userAgent.indexOf(this.OperaMini[i]) != -1) {
                return true;
            }
        }
        return false;
    }
 
    if(CookieGet('Mobilversion') != 1) { // Hier den Cookie-Namen anpassen
 
        var client = new Client();
        if (client.isMobileClient(navigator.userAgent)) {
				mredirect();
            }
        else if (screen.width < 641){
                mredirect();
            }
		else if(client.isOperaMini(navigator.userAgent)){
                document.observe('dom:loaded', mredirect);
            } 
        }

function CookieSave(name, value, days)
	{
		if (typeof days != 'undefined') {
			var date = new Date();
			date.setTime(date.getTime() + (days*24*60*60*1000));
			var expires = "; expires=" + date.toGMTString();
		} else {
			var expires = "";
		}
		document.cookie = name + "=" + value + expires + "; path=/";
	}
 
	function CookieGet(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') {
					c = c.substring(1,c.length);
				}
				if (c.indexOf(nameEQ) == 0) {
					return c.substring(nameEQ.length,c.length);
				}
		}
		return null;
	}

/**
* Standard JavaScript library Contwise 2
* Copyright General Solutions Steiner GmbH & F.Falkner
*
/******************************************************************
Original Code from
© 2001 Struppi
Mail: struebig@gmx.net
URL: http://home.arcor.de/struebig/computer/javascript
Modified 2004 by Florian Falkner
*/
var default_bgColor = '#EAEAEA';
var default_width = 400;
var default_height = 200;
var rahmen_w = 20;
var rahmen_h = 100;

//New Version start
function showBild(link, title, descr)
{
    // Das Fenster öffnen
    isLoad = false;

    if(!showFenster || showFenster.closed) showFenster = popUp("", "NEW_WIN", default_width, default_height);
    
  
    showFenster.document.open();
    showFenster.document.write(getHTML(link,title,descr));
    showFenster.document.close();
    showFenster.focus();
    return false;
}

function fitWin(i, win)
{
    if(isLoad == true) return;
    isLoad = true;

    var w = i.width;
    var h = i.height;

    if(w < 100) w = 150;
    if(h < 100) h = 100;

    var size = getWinSize(win);

    win.resizeBy((w - size.w + rahmen_w), (h - size.h + rahmen_h) );
    
    win.focus();
}

function popUp(url, fname, w, h)
{
    var tmp = new Array();
    tmp[tmp.length] = 'resizable=yes';
    tmp[tmp.length] = 'scrollbars=yes';
    if(w) tmp[tmp.length] = 'width=' + w;
    if(h) tmp[tmp.length] = 'height=' + h;
    var string = tmp.join(",");
    return window.open(url, fname, string);
}

function getHTML(src, title, descr) {
    var body = (window.opera || document.layers) ? false : true;
    if(!title) title = 'Bild / Picture';
    var bgcolor = default_bgColor;
    descr = descr || "";
    var text ="";
    text+= '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n'
    + '<HTML>\n<HEAD>\n'
    + '<TITLE>' + title + '</TITLE>\n'
    + '<STYLE type="text/css">\n'
     + 'body{margin:0;padding:0;overflow:hidden;\n' + 'background-color:' + bgcolor + ';}\n'
    + '#img{\nposition:absolute;top:0;left:0;margin:0;padding:0;overflow:hidden;\n}\n'
    + '</STYLE>\n'
    + '</HEAD>\n'
    + '<body onload="var img = new Image();'
    + 'img.onload = function(){opener.fitWin(this, window);};'
    + 'img.src = \'' + src +'\';img.vspace=6;">'
    + '<center><div align="center"><br><a href="javascript:self.close()" title="Zum Schließen ins Bild klicken."><img border=0 src="' + src + '" alt="' + title + '"' + '></a></div>'
    + '<div align=center><font face="Verdana,Arial,Helvetica,sans-serif" size=1>' + descr + '</font></div>'
    + '\n</body>\n</html>\n'
    ;
    return text;
}

function getWinSize(win)
{
    if(!win) win = window;
    var pos = {w:0,h:0};
    if(typeof win.innerWidth != 'undefined')
    {
        pos = { w: win.innerWidth, h: win.innerHeight};
    }
    else
    {
         var obj = checkIE(win);

         pos.w = parseInt(obj.clientWidth);
         pos.h = parseInt(obj.clientHeight);
    }
    return pos;
}

function checkIE(win)
{
    if(!win) win = window;
    return (win.document.compatMode && win.document.compatMode == "CSS1Compat") ?
    win.document.documentElement : win.document.body;
}
var showFenster = null;
//end

/**
------------------------------------------------------------------------------------------------
Start of Standardlibrary copyrighted by G & S GmbH & F.Falkner
------------------------------------------------------------------------------------------------
**/
function oWin(path,name,height,width,posX,posY) {
   var winName = name || "CONTWISE_OUT_WIN";
   var winHeight = height || 487;
   var winWidth = width || 480;
   var left,top;
   if (!posX && !posY) {
    left = (screen.width) ? (screen.width-winHeight)/2 : 20;
    top = (screen.height) ? (screen.height-winWidth)/2 : 20;
   }
   else {
     left = posX;
     top = posY;
   }
   var settings ='height='+winHeight+',width='+winWidth+',top='+top+',left='+left+',scrollbars=yes,resizable=yes'
   win = window.open(path,name,settings)
   win.focus();
   return win;
}

var WARN_CATEGORY_NOT_FOUND = true;
var DEFAULT_PARENT_NAME = "diverses";

function writeParents(val,tree,link,style,sep) {
   if (!tree) tree = catTree;
   var curNode;
   curNode = catTree.getNode(val,"ukatnr");
   if (!curNode) {
      if (WARN_CATEGORY_NOT_FOUND) {
         alert("Node "+val+" not found!");
         return;
      }
      else {
         window.document.write(DEFAULT_PARENT_NAME);
      }
   }

// alert(curNode.userObject.name);
   var catString = "";
   if (!style) style = "cat-link";  
   if (!sep) sep = " / ";
   while (curNode.parent) {
      if (!curNode.userObject) continue;
      var tmp = catString;
      if (link)
         catString="<a href='"+curNode.userObject.script+"?ukatnr="+curNode.userObject.ukatnr+"' class='"+style+"'>"+curNode.userObject.name+"</a>";
      else
         catString=curNode.userObject.name;
      if (tmp) catString = catString+sep+tmp;
         curNode = curNode.parent;
   }
   window.document.write(catString);
}

function replaceForUrl (text) {
	text = text.toLowerCase();
	text=text.replace(/ /g, "_");
	text=text.replace(/,/g, "");
	text=text.replace(/\u00fc/g, "ue");
	text=text.replace(/\u00f6/g, "oe");
	text=text.replace(/\u00e4/g, "ae");
	text=text.replace(/\u00df/g, "ss");
	text=text.replace(/[^a-zA-Z 0-9_]+/g,'');
	return text;
}

function searchFriendlyUrl (name, ukatnr, artnr) {
	return replaceForUrl(name) + "," + ukatnr + (artnr ? "," + artnr : "") + ".html";
}



// JS function for uncrypting spam-protected emails:
// To Crypt, undo the right shift for each character by unicode character
function linkTo_UnCryptMailto(s) {
	var n=0;
	var r="";
	
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		
		if(s.charAt(i) == '^')
			r+= '&';
		else
			r += String.fromCharCode(n-(1));
	}
	
	location.href='mailto:' + r;
}

function writeParents2(val,tree,link,style,sep) {
   if (!tree) tree = catTree;
   var curNode;
   curNode = catTree.getNode(val,"ukatnr");
   if (!curNode) {
      if (WARN_CATEGORY_NOT_FOUND) {
         //alert("Node "+val+" not found!");
         return;
      }
      else {
         window.document.write(DEFAULT_PARENT_NAME);
      }
   }

// alert(curNode.userObject.name);
   var catString = "";
   if (!style) style = "cat-link";  
   if (!sep) sep = " / ";
   while (curNode.parent) {
      if (!curNode.userObject) continue;
      var tmp = catString;
      if (link)
         catString="<a href='" + replaceForUrl(curNode.userObject.name) + "," + curNode.userObject.ukatnr + ".html' class='"+style+"'>"+curNode.userObject.name+"</a>";
      else
         catString=curNode.userObject.name;
      if (tmp) catString = catString+sep+tmp;
         curNode = curNode.parent;
   }
   window.document.write(catString);
}

function newsletterfenster () {
window.document.write ("<a href=\"#zzz\" class=\"white\" onClick=\"window.open('http://www.maennernews.info/php/member_full_news.php', 'NewWindow6','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=600,left=260,top=10')\">Newsletter <img src=\"../pics/mail.gif\" alt=\"Newsletter\" width=\"13\" height=\"9\" border=\"0\" /></a> | <a href=\"http://www.maennernews.info/php/rss_feed.php\" class=\"white\" target=\"_blank\">RSS <img src=\"../pics/rss.gif\" alt=\"RSS Feed\" border=\"0\" height=\"10\" width=\"10\"></a>");
}

function empfehlen()
{
var url = window.document.getElementById("url").value;
var adresse ='https://sslsites.de/www.maennernews.info/php/empfehlung.php?url='+url;
window.open(adresse,'Empfehlung','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=450,height=400,left=290,top=270');
return false;
}

function sf() {
window.document.write("<a href=\"http://www.suchfalke.at\" target=\"_blank\" title=\"gelistet im Suchfalke Qualit&auml;tsverzeichnis\" rel=\"nofollow\"><img src=\"http://www.suchfalke.at/pics/sf.gif\" width=\"81\" height=\"10\" border=\"no\" /></a>");	
}

function flust() {
window.document.write("<div class=\"grau2\"><div class=\"pfad\">sch&ouml;ne Fotos</div></div><h2><a href=\"/fleischeslust/1.php\" class=\"heading2\">Fleischeslust</a></h2><br /><a href=\"/fleischeslust/1.php\" class=\"heading2\"><img width=\"174\" height=\"92\" border=\"0\" src=\"/fleischeslust/fleischeslust.jpg\" alt=\"zur Galerie\" title=\"zur Galerie\" /></a><br /><br /><br />");	
}

function flustfooter() {
window.document.write("<a href=\"/fleischeslust/1.php\" class=\"schwarz\">Fleischeslust</a>");	
}

function flustoben() {
window.document.write("<a href=\"/fleischeslust/1.php\" class=\"cat1\">Fleischeslust</a>");	
}

