
//*********************************************
//	dynamically write into a div layer
//*********************************************
function WriteLayer(ID,parentID,sText)
{
	if (document.layers)
	{
		var oLayer;
		if (parentID)
		{
			oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
		}
		else
		{
			oLayer = document.layers[ID].document;
		}
		oLayer.open();
		oLayer.write(sText);
		oLayer.close();
	}
	else if (parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape")
	{
		document.getElementById(ID).innerHTML = sText;
	}
	else if (document.all) document.all[ID].innerHTML = sText
}



//*********************************************
//	ticker status control for the main page
//*********************************************
var tickerStatus = 'opened';
var tickerButton = '';
function toggleButton()
{
	tickerStatus = (tickerStatus=='closed') ? 'opened' : 'closed';
        tickerButton = (tickerStatus=='opened') ? '<img src="../../data/images/cssbg/icon_button_up.gif" alt="zuklappen"/>' : '<img src="../../data/images/cssbg/icon_button_down.gif" alt="aufklappen"/>';
	WriteLayer('content_top_ticker_button','content_top_ticker','<a href="#" onclick="javascript:toggleButton();">'+tickerButton+'</a>');

	if (tickerStatus=='opened')
	{
		document.getElementById('content_top_image').style.visibility = 'hidden';
		document.getElementById('content_top_fullticker').style.visibility = 'visible';
		document.getElementById('content_top_ticker').style.background = 'black';
	}
	else
	{
		document.getElementById('content_top_image').style.visibility = 'visible';
		document.getElementById('content_top_fullticker').style.visibility = 'hidden';
		document.getElementById('content_top_ticker').style.background = 'transparent';
	}
}



//*********************************************
//	FAQ control
//*********************************************
oldFAQ = 0;
function showAnswer(id)
{
	idQuestion = "question" + id;
	idAnswer = "answer" + id;

	document.getElementById(idQuestion).className = 'active';
	document.getElementById(idAnswer).className = 'showAnswer';

	if(oldFAQ != 0 && oldFAQ != id)
	{
		idHideQuestion = "question" + oldFAQ;
		idHideAnswer = "answer" + oldFAQ;
		document.getElementById(idHideAnswer).className = 'hideAnswer';
	}
	oldFAQ = id;
}


//*********************************************
//	Business Card control
//*********************************************
function selectBusinessCard(id,imgurl)
{
	for (i = 0; i < document.bcForm.bcSelector.length; i++)
	{
		if (document.bcForm.bcSelector.options[i].value == id)
		{
			document.getElementById(id).style.display = "block";                        
		}
		if (document.bcForm.bcSelector.options[i].value != id)
		{
			document.getElementById(document.bcForm.bcSelector.options[i].value).style.display = "none";
		}
	}
	if (imgurl != "") {document.getElementById("content_top_right").firstChild.setAttribute('src', imgurl);}
}


// ****************************************
// OBJECT: Easy handling URL key and values
// ****************************************
function makeURLObj(url_string)
{
	this.mGetURL			=	url_string;
	this.mGetSearchPos		=	this.mGetURL.indexOf('?');
	this.mGetURLLength		=	this.mGetURL.length;
	this.mGetSearchString	=	this.mGetURL.substring(this.mGetSearchPos + 1, this.mGetURLLength);
	this.mGetPair			=	uGetPair;
	this.mGetPairsCount		=	uGetPairsCount;
	this.mGetValue			=	uGetValue;
	return this;
}

// get the amount of pairs
function uGetPairsCount()
{
	return this.mGetSearchString.split('&').length;
}

// get a pair (key and value)
function uGetPair(pair_nr)
{
	return this.mGetSearchString.split('&')[pair_nr];
}

// get a value for a certain key
function uGetValue(keyname)
{
	var valuename = '';
	for (i=0;i<this.mGetPairsCount();i++)
	{
		if (keyname == this.mGetPair(i).split('=')[0])
			valuename = this.mGetPair(i).split('=')[1];
	}

	return valuename;
}



//*********************************************
//	Popup Bilder
//*********************************************
var pop = null;

function popdown() {
  if (pop && !pop.closed) pop.close();
}

function popup(obj,w,h) {
  var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
  if (!url) return true;
  w = (w) ? w += 20 : 150;  // 150px*150px is the default size
  h = (h) ? h += 25 : 150;
  var args = 'width='+w+',height='+h+',resizable';
  popdown();
  pop = window.open(url,'',args);
  return (pop) ? false : true;
}

window.onunload = popdown;
window.onfocus = popdown;

