// google.js - for managing additional content on the right side
// Author: Norbert Kujbus
// Date: 2004.09.01

function _GetElement(id)
{
	var Opera = window.opera ? true : false;
	if (document.layers) {
			fixedElement = document[id];
		}
		else if (document.getElementById && !Opera) {
			fixedElement = document.getElementById(id);
		}
		else if (document.all && !Opera) {
			fixedElement = document.all[id];
		}
		else if (Opera) {
			fixedElement = document.getElementById(id);
		}
	return fixedElement;
}

function HideSourcePane()
{
	source = _GetElement("SpecialNarrowSource");
	isAdmin = document.forms[0].q;
	if (source && isAdmin)
	{
		source.visibility = "hidden";			
		source.display = "none";			
	}
}

function TransferPane()
{
	//move narrow ads to the right position
	source = _GetElement("SpecialNarrowSource");
	target = _GetElement("SpecialNarrowTarget");

	if (source && target)
	{
		target.innerHTML = source.innerHTML;
		source.innerHTML = "";
		source.visibility = "hidden";			
		source.display = "none";			
	}	
}

function DisableFilter()
{
	document.location += "&filter=0";
}

//google javascript solution for clickable table cells 
function ss(w)
{
	window.status=w;return true;
}

function cs()
{
	window.status='';
}

function ga(o,e)
{
	if (document.getElementById)
	{
		a=o.id.substring(1); 
		p = "";
		r = "";
		g = e.target;
		if (g) 
		{ 
			t = g.id;
			f = g.parentNode;
			if (f) 
			{
				p = f.id;
				h = f.parentNode;
				if (h) r = h.id;
			}
		} 
		else
		{
			h = e.srcElement;
			f = h.parentNode;
			if (f) p = f.id;
			t = h.id;
		}
		if (t==a || p==a || r==a) return true;
		lnk = document.getElementById(a);
		if (lnk.target != "")
		{
			window.open(lnk.href, lnk.target);
		}
		else
		{
			location.href=document.getElementById(a).href;
		}
	}
}

function google_ad_request_done(google_ads) {

	// Proceed only if we have ads to display!
	if (google_ads.length < 1 )
	return;

	// Display ads in a table
	document.write("<br><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\">");
	
	// Print "Ads By Google" -- include link to Google feedback page if available
	document.write("<tr><td class=\"Rowheader\">");
	if (google_info.feedback_url) {
	document.write("<a href=\"" + google_info.feedback_url + 
		"\">Ads by Google</a>");
	} else {
	document.write("Google Anzeigen");
	}
	document.write("</td></tr><tr><td>");  
	document.write("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\"><tr><td>");  
	
	// For text ads, display each ad in turn.
	// In this example, each ad goes in a new row in the table.
	if (google_ads[0].type == 'text') {
		for(i = 0; i < google_ads.length; ++i) {
			document.write("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr><td nowrap id=\"tpa"+i+"\" class=\"gglWideAd\" onMouseOut=\"cs()\" onClick=\"ga(this,event)\" onMouseOver=\"ss('"+google_ads[i].visible_url+"')\">" +
			"<br>"+
			"<a class=\"title\" id=\"pa"+i+"\" href=\"" +  google_ads[i].url + "\" target=\"_blank\" onMouseOut=\"cs()\" onMouseOver=\"return ss('"+google_ads[i].visible_url+"')\">" +
			google_ads[i].line1 + "</a><br>" +
			google_ads[i].line2 + " " +
			google_ads[i].line3 + "<br>" + 
			"<span class=\"ResultFooter\">"+
			google_ads[i].visible_url +
			"</span></td></tr></table>"); 
		}
	}

	// For an image ad, display the image; there will be only one .
	if (google_ads[0].type == 'image') {
	document.write("<tr><td align=\"center\">" +
		"<a href=\"" + google_ads[0].url + "\">" +
		"<img src=\"" + google_ads[0].image_url + 
		"\" height=\"" + google_ads[0].height + 
		"\" width=\"" + google_ads[0].width +
		"\" border=\"0\"></a></td></tr>");
	}

	// Finish up anything that needs finishing up
	document.write ("</td></tr></table></td></tr></table>");
}
