var SocialBookmark = {
	placeholderb: { id: 'placeholderb', elem: null },
	placeholdern: { id: 'placeholdern', elem: null },
	create: function(type){
		var u=encodeURIComponent(location.href);
		var t=encodeURIComponent(document.title);
		var data;
		switch(type) {
			case 'b': data = {
					i: 'sbmb',
					h: 'Bookmarken bei ',
					n: ['Mister Wong','Lycos iQ','Del.ici.ous','Yahoo','Facebook','Google','Linkarena','furl','Oneview','blinklist','folkd','Slashdot'],
					p: ['book1','book2','book3','book4','book5','book6','book7','book8','book9','book10','book11','book12'],
					l: ['www.mister-wong.de/index.php?action=addurl&bm_url='+u+'&bm_description='+t,'iq.lycos.de/lili/my/add?url='+u,'del.icio.us/post?url='+u+'&title='+t,'myweb2.search.yahoo.com/myresults/bookmarklet?u='+u+'&t='+t,'www.facebook.com/sharer.php?u='+u+'&t='+t,'www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+u+'&annotation=&labels=&title='+t,'linkarena.com/bookmarks/addlink/?url='+u+'&title='+t+'&desc=&tags=','www.furl.net/storeIt.jsp?u='+u+'&keywords=&t='+t,'www.oneview.de/login/loginBookmarklet.jsf?title='+t+'&URL='+u,'www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Tag=&Url='+u+'&Title='+t,'www.folkd.com/submit/'+u,'slashdot.org/bookmark.pl?url='+u+'&title='+t]
				};
				break;
			case 'n': data = {
					i: 'sbmn',
					h: 'Veröffentlichen bei&nbsp;',
					n: ['Technorati','Digg','Stern','Webnews','Yigg', 'StumbleUpon'],
					p: ['book13','book14','book15','book16','book17','book18'],
					l: ['technorati.com/faves?add='+u+'&tag=','digg.com/submit?phase=2&url='+u+'&bodytext=&tags=&title='+t,'tausendreporter.stern.de/submit.php?url='+u,'www.webnews.de/einstellen?url='+u+'&title='+t,'www.yigg.de/neu?exturl='+u+'&exttitle='+t,'www.stumbleupon.com/submit?url='+u+'&title='+t]
				};
				break;
			default: data={}; break;
		}
		document.write('<div class="sbm"><span style="float:left;" class="bookmark_h" id="'+data.i+'">'+data.h+'</span><br />');
		if(type == 'n') { document.write('<span id="'+this.placeholdern.id+'"></span><br />'); }
		for(var a=0;a<data.n.length;++a){ document.write('<a href="http://'+data.l[a]+'" title="'+data.n[a]+'" onmouseover="SocialBookmark.change(\''+data.n[a]+'\',\''+type+'\');" onmouseout="SocialBookmark.change(\'\',\''+type+'\');" onclick="window.open(\'http://'+data.l[a]+'\');return false;"><div class="bookmark" id='+data.p[a]+'></div></a>'); }
		if(type == 'b') { document.write('<div class="bookmark_f"><span style="float:left;" id="'+this.placeholderb.id+'"></span></div></div>'); }
	},
	change: function(txt, type) {
	    if(type == 'b') {
		if(!this.placeholderb.elem) {	this.placeholderb.elem = document.getElementById(this.placeholderb.id); }
		if(this.placeholderb.elem) { this.placeholderb.elem.innerHTML = txt; }
		}
		
		if(type == 'n'){
		if(!this.placeholdern.elem) {	this.placeholdern.elem = document.getElementById(this.placeholdern.id); }
		if(this.placeholdern.elem) { this.placeholdern.elem.innerHTML = txt; }
		}
	}
};

function follow_goto(whichnum)
{
	var num = new Array();
	num[1] = 'http://www.dsj.de/';
	num[2] = 'http://www.juus.de/';
	num[3] = 'http://www.ic-gruppenreisen.de/';
	num[4] = 'http://www.klassenfahrten.net/';

	window.open(num[whichnum]);
}

function switchLTPage(wPage, aPage)
{
	for ( i = 1; i <= aPage; i++ )
	{
		document.getElementById('ltLink_' + i).className = ( i == wPage ? 'ltLink_active' : 'ltLink' );
		document.getElementById('ltLink_td_' + i).className = ( i == wPage ? 'ltLink_active' : 'ltLink' );

		document.getElementById('langtextpage_' + i).style.display = ( i == wPage ? '' : 'none' );
	}
}

function Toggle (prefix)
{
	if (document.getElementById(prefix).style.display == 'none')
	{
		document.getElementById(prefix).style.display = "";
	}
	else
	{
		document.getElementById(prefix).style.display = "none";
	}
}

function Toggle_Img (prefix, amount, path)
{

	if (document.getElementById(prefix + "_ToggleImg").src == path + 'collapse.gif')
	{

		document.getElementById(prefix + "_ToggleImg").src = path + 'expand.gif';
		document.getElementById(prefix + "_ToggleImg").alt  = "Expand";
		
	}
	else
	{

		document.getElementById(prefix + "_ToggleImg").src = path + 'collapse.gif';
		document.getElementById(prefix + "_ToggleImg").alt  = "Collapse";

	}

	for(var i=1; i <= amount; i++){

		if (document.getElementById(prefix + "_ToggleTr" + i).style.display == 'none')
		{

			document.getElementById(prefix + "_ToggleTr" + i).style.display = "";

		}
		else
		{

			document.getElementById(prefix + "_ToggleTr" + i).style.display = "none";

		}
	}
}

function validatesubmit(handle) {

	var agree = confirm(handle);

	if (agree){
		return true;
	}
	else{
		return false;
	}

}

function CheckKatalogBestellung(i1,i2,i3,i4) {
	if(document.form.id_katalog[i1].value != 1 && document.form.id_katalog[i2].value != 1 && document.form.id_katalog[i3].value != 1 && document.form.id_katalog[i4].value != 1) {
		alert("Bitte wählen Sie einen Katalog aus!");
		return false;
	}
}

function popup(URL,window_width,window_height,from_left,from_top) {

   	day = new Date();
   	id = day.getTime();
   	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + window_width + ",height=" + window_height + ",left = " + from_left + ",top = " + from_top + "');");

}

function popup_admin(URL) {

   	day = new Date();
   	id = day.getTime();
   	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=350,height=400,left = 300,top = 200');");
}

function popup2(URL) {

   	day = new Date();
   	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1024,height=800,left = 50,top = 50');");

}

function popup3(URL) {

   	day = new Date();
   	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=750,left = 50,top = 50');");

}

function popup4(URL,window_width,window_height) {

   	day = new Date();
   	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + window_width + ",height=" + window_height + ",left = 50,top = 50');");

}

function validateKalkulation() {
	if (document.form.schueler_m.value + document.form.schueler_w.value + document.form.lehrer_m.value + document.form.lehrer_w.value == 0) {
         		alert("Bitte geben Sie die Anzahl der Teilnehmer an!\n");
  		return false;
	}
}

function swap(img_name)
{
	if(!document[img_name].osrc)
	{
		document[img_name].osrc = document[img_name].src;
	}
	if(!document[img_name].hsrc)
	{
		document[img_name].hsrc = document[img_name].osrc.substr(0, document[img_name].osrc.search('.gif')) + '_f2.gif';
	}
	document[img_name].src = document[img_name].src == document[img_name].osrc ? document[img_name].hsrc : document[img_name].osrc;
	if(!document[img_name].onmouseout)
	{
		document[img_name].onmouseout = document[img_name].onmouseover;
	}
}

function swapJPG(img_name)
{
	if(!document[img_name].osrc)
	{
		document[img_name].osrc = document[img_name].src;
	}
	if(!document[img_name].hsrc)
	{
		document[img_name].hsrc = document[img_name].osrc.substr(0, document[img_name].osrc.search('.jpg')) + '_f2.jpg';
	}
	document[img_name].src = document[img_name].src == document[img_name].osrc ? document[img_name].hsrc : document[img_name].osrc;
	if(!document[img_name].onmouseout)
	{
		document[img_name].onmouseout = document[img_name].onmouseover;
	}
}

function swapGIF(img_name)
{
	if(!document[img_name].osrc)
	{
		document[img_name].osrc = document[img_name].src;
	}
	if(!document[img_name].hsrc)
	{
		document[img_name].hsrc = document[img_name].osrc.substr(0, document[img_name].osrc.search('.gif')) + '2.gif';
	}
	document[img_name].src = document[img_name].src == document[img_name].osrc ? document[img_name].hsrc : document[img_name].osrc;
	if(!document[img_name].onmouseout)
	{
		document[img_name].onmouseout = document[img_name].onmouseover;
	}
}

function displayimg(img_name, imgurl, show)
{
	if ( show == 'none' )
	{
		document[img_name].style.display='none';
	}
	else
	{
		document[img_name].src=imgurl;
		document[img_name].style.display='';
	}
}

function displayland(img_name, imgurl, show, titlename)
{
	if ( show == 'none' )
	{
		document[img_name].style.display='none';
		document.getElementById(img_name + '_c').innerHTML = '';
	}
	else
	{
		document[img_name].src=imgurl;
		document[img_name].style.display='';
		document.getElementById(img_name + '_c').innerHTML = titlename;
	}
}

function check(phrase)
{
	var agree = confirm(phrase);

	if (agree)
	{
		return true;
	}
	else
	{
		return false;
	}

}

function showimage(basedir, imageid,window_width,window_height,from_left,from_top)
{

   	day = new Date();
   	id = day.getTime();
   	eval("page" + id + " = window.open(basedir + 'image.php?id=' + imageid, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + window_width + ",height=" + window_height + ",left = " + from_left + ",top = " + from_top + "');");

}

function update(url)
{
	document['picturebig'].src=url;
	return false;
}