//
// Java-Script Quelltext f&uuml;r die WWW-Seiten von www.skat-spiel.de
// Erstellt: Sep 2004, Peter Heinlein, heinlein@skat-spiel.de
//


// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="js/prototype.js"></script>');
document.write('<script type="text/javascript" src="js/scriptaculous.js"></script>');

function switch_to_questions() {
      new Effect.BlindUp(content,  {duration: 0.5});
      new Effect.BlindDown(questions,  {duration: 0.5});
//      new Effect.BlindDown(questions,  {duration: 0.5, queue:'end'});

/*        new Effect.Parallel(
        [
            new Effect.BlindUp(content),
            new Effect.BlindDown(questions)
        ], {
            duration: 1
        })
*/
};

function switch_to_content() {
      new Effect.BlindUp(questions,  {duration: 0.5});
      new Effect.BlindDown(content,  {duration: 0.5});
};

function show_content(the_id) {
      new Effect.toggle(the_id, 'blind', {duration: 0.2});

};

function switch_to_answer(qbulb, answer) {
//      new Effect.Fade(qbulb,  {duration: 0.1});
      new Effect.toggle(answer, 'appear', {duration: 0.5});

};



function Skat()
{
	top.location="index.html"
}

function SKAT_Register()
{
	window.open("register.html", "Register_Window");
}

function Fussleiste()
{

//  var skatlink = '<A HREF=\"index.html\" onClick=\"Skat();\">www.skat-spiel.de</A>. ';
//  var autor    = '&copy; 2007 <A HREF=\"http://www.skat-spiel.de\">Peter Heinlein</A>. ';
  var datum    = '1. Januar 2009';

//  document.write('<P class="DatumUndAutor">'+skatlink+autor+datum+'</P>');
  document.write(datum);
}

function dn(image)
{
}

function up(image) 
{
}

function cl(image) 
{
}

// JavaScript Document

function bmGo(was) {
	doc_url=encodeURIComponent(location.href);
	doc_title=encodeURIComponent(document.title);
	switch(was) {		
		case 'digg':
			window.open('http://digg.com/submit?phase=2&url='+doc_url+'&title='+doc_title);
			break;
		case 'delicious':
			window.open('http://del.icio.us/post?url='+doc_url+'&title='+doc_title);
			break;
		case 'folkd':
			window.open('http://www.folkd.com/submit/page/'+doc_url);
			break;
		case 'furl':
			window.open('http://www.furl.net/storeIt.jsp?u='+doc_url+'&t='+doc_title);
			break;
		case 'google': 		
			window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+doc_url+'&title='+doc_title);
			break;
		case 'linkarena':	
			window.open('http://linkarena.com/bookmarks/addlink/?url='+doc_url+'&title='+doc_title+'&desc=&tags=');
			break;
		case 'oneview':
			window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL='+doc_url+'&title='+doc_title);			
			break;
		case 'wong':
			window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+doc_url+'&bm_description='+doc_title);
			break;
		case 'yahoo':
			window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+doc_url+'&t='+doc_title);
			break;
		case 'yigg':
			window.open('http://yigg.de/neu?exturl='+doc_url+'&exttitle='+doc_title);
			break;	
	}
}

// Popup Fenster

function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-150;//150 is half popup's width
	popUpDiv.style.left = window_width + 'px';
}
function popup(windowname) {
	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);		
}

var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
                || this.searchVersion(navigator.appVersion)
                || "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i=0;i<data.length;i++) {
                var dataString = data[i].string;
                var dataProp = data[i].prop;
                this.versionSearchString = data[i].versionSearch || data[i].identity;
                if (dataString) {
                        if (dataString.indexOf(data[i].subString) != -1)
                                return data[i].identity;
                }
                else if (dataProp)
                        return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
        {
                string: navigator.userAgent,
                subString: "Chrome",
                identity: "Chrome"
        },
        {       string: navigator.userAgent,
                subString: "OmniWeb",
                versionSearch: "OmniWeb/",
                identity: "OmniWeb"
        },
        {
                string: navigator.vendor,
                subString: "Apple",
                identity: "Safari",
                versionSearch: "Version"
        },
        {
                prop: window.opera,
                identity: "Opera"
        },
        {
                string: navigator.vendor,
                subString: "iCab",
                identity: "iCab"
        },
        {
                string: navigator.vendor,
                subString: "KDE",
                identity: "Konqueror"
        },
        {
                string: navigator.userAgent,
                subString: "Firefox",
                identity: "Firefox"
        },
        {
                string: navigator.vendor,
                subString: "Camino",
                identity: "Camino"
        },
        {               // for newer Netscapes (6+)
                string: navigator.userAgent,
                subString: "Netscape",
                identity: "Netscape"
        },
        {
                string: navigator.userAgent,
                subString: "MSIE",
                identity: "Explorer",
                versionSearch: "MSIE"
        },
        {
                string: navigator.userAgent,
                subString: "Gecko",
                identity: "Mozilla",
                versionSearch: "rv"
        },
        {               // for older Netscapes (4-)
                string: navigator.userAgent,
                subString: "Mozilla",
                identity: "Netscape",
                versionSearch: "Mozilla"
        }
    ],
    dataOS : [
        {
                string: navigator.platform,
                subString: "Win",
                identity: "Windows"
        },
        {
                string: navigator.platform,
                subString: "Mac",
                identity: "Mac"
        },
        {
                   string: navigator.userAgent,
                   subString: "iPhone",
                   identity: "iPhone/iPod"
        },
        {
                string: navigator.platform,
                subString: "Linux",
                identity: "Linux"
        }
    ]

};
BrowserDetect.init();

