<!--//--><![CDATA[//><!--

	// Show games
	function Gk_PopTart(mypage, myname, w, h, scroll)
	{
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no';
		win = window.open(mypage, myname, settings);
	}

	// show mediaplazza content
	function me_window(mypage, myname, w, h, scroll)
	{
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=yes';
		win = window.open(mypage, myname, settings);
	}

	
	function show_content(id)
	{
		display_box = (document.getElementById(id).style.display == 'none') ? 'block' : 'none';
		document.getElementById(id).style.display = display_box;
	}

	// Set display of page element
	// s[-1,0,1] = hide,toggle display,show
	function dE(n,s) 
	{
		var e = document.getElementById(n);
		if(!s) s = (e.style.display=='') ? -1:1;
		e.style.display = (s==1) ? '':'none';
	}

	function popup(url, width, height, target)
	{
		window.open(url, target, 'height=' + height + ',resizable=yes,scrollbars=no, width=' + width);
		return false;
	}

	function externalLinks() 
	{
		if (!document.getElementsByTagName)
		{
			return;
		}

		var anchors = document.getElementsByTagName('a');
		
		for (var i = 0; i < anchors.length; i++)
		{
			var anchor = anchors[i];

			if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'external')
			{
				anchor.target = '_blank';
			}

/*			if (anchor.innerHTML.match(/^Anzeige: /))
			{
				anchor.innerHTML = '<span style="color: #B3B5B7;">' + anchor.innerHTML + '</span>';
			}*/
		}
	}

	function roundedCorners() 
	{
		var divs = document.getElementsByTagName('div');
		var rounded_divs = [];
		// First locate all divs with 'rounded' in their class attribute
		for (var i = 0; i < divs.length; i++) 
		{
			if (/\brounded\b/.exec(divs[i].className)) 
			{
				rounded_divs[rounded_divs.length] = divs[i];
			}
		}

		// Now add additional divs to each of the divs we have found
		for (i = 0; i < rounded_divs.length; i++) 
		{
			var original = rounded_divs[i];
			
			// Make it the inner div of the four
			original.className = original.className.replace('rounded', '');
			
			// Now create the outer-most div
			var tr = document.createElement('div');
			tr.className = 'rounded2';
			
			// Swap out the original (we'll put it back later)
			original.parentNode.replaceChild(tr, original);
			
			// Create the two other inner nodes
			var tl = document.createElement('div');
			var br = document.createElement('div');
			
			// Now glue the nodes back in to the document
			tr.appendChild(tl);
			tl.appendChild(br);
			br.appendChild(original);
		}
	}

	// Clipboard copycode based on: 
	// http://www.codebase.nl/index.php/command/viewcode/id/174
	// http://www.xulplanet.com/tutorials/xultu/clipboard.html

	function copyCode(id)
	{
		var copytext;
		var allowed = true;
		var e = document.getElementById(id);

		if (window.clipboardData)
		{
			// IE users
			copytext = e.innerText;
			window.clipboardData.setData("Text", copytext);
		} 
		else if (window.netscape)
		{
			copytext = e.innerHTML;

			// The tight security settings in mozilla mean you have to sign the javascript to make it work
			// You can change your Moz settings by typing: about:config in the address bar
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
			}
			catch (error)
			{
				alert("Dein Browser erlaubt das kopieren in die Zwischenablage nicht.\n\nDu kannst dies ändern, indem du in die Adresszeile deines Browsers 'about:config' eingibst und \n'signed.applets.codebase_principal_support' auf true setzt.");
				allowed = false;
			}
			
			if( !allowed ) return false;
			
			// First, we need to create an XPCOM object to wrap what we want to copy
			var str = new Object();
			var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
			if(!str) return false;
			str.data = copytext;
			
			// Create a transfer object and set the format of the data transfer
			// See: http://www.mozilla.org/xpfe/xptoolkit/introClipDD.html
			var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
			if(!trans) return false;
			trans.addDataFlavor("text/unicode");
			trans.setTransferData("text/unicode",str,copytext.length*2);
			
			// Create a clipboard object that refers to the system clipboard and transfer the content to it
			var clipid=Components.interfaces.nsIClipboard;
			var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
			if(!clip) return false;
			clip.setData(trans,null,clipid.kGlobalClipboard);
		} 
		else 
		{
			return false;
		}

		alert("Der Quelltext wurde in die Zwischenablage kopiert.");
	}

	function markField(id)
	{
		var field = document.getElementById(id);

		field.focus();
		field.select();
	}

	function changeElements()
	{
		externalLinks();
		//determine_empty_ads();
		// roundedCorners();
	}

	// XPI Installation on firefox
	function install( aEvent, extName, iconURL)
	{
		if(window.pkcs11 && window.XML)
		{
			if (aEvent.target.href.match(/^.+\.xpi$/)) {
				var params = new Array();

				params[extName] = {
					URL: aEvent.target.href,
					IconURL: iconURL,
					toString: function () { return this.URL; }
				};

				InstallTrigger.install(params);

				return false;
			}
		}
		else
		{
			alert('Zur Installation mußt du diesen Link aus dem Firefox Browser heraus aufrufen.');
			return false;
		}
	}

	window.onload = changeElements;

//--><!]]>