/*** Popups ***/
//Bild
function openBPU() {
	extwin=window.open('','BPU','location=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,width=430,height=600,top=20,left=20');
	extwin.focus();
}
//Fotoline
function openFLN() {
	extwin=window.open('','FLN','location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width=424,height=760,top=0,left=50');
	extwin.focus();
}
//Newsticker
function openNT() {
	extwin=window.open('','ticker','location=no,toolbar=no,status=no,scrollbars=no,resizable=no,width=504,height=580,top=0,left=50');
	extwin.focus();
}
//Artikel mailen
function openAM() {
	extwin=window.open('','art_mailen','location=no,toolbar=no,status=no,scrollbars=no,resizable=no,width=560,height=660,top=0,left=50');
	extwin.focus();
}
//Artikel Druckfassung
function openAD() {
	extwin=window.open('','art_druck','location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width=590,height=650,top=0,left=50');
	extwin.focus();
}
//Umfrage
function openUF() {
	extwin=window.open('','umfrage','location=no,toolbar=no,status=no,scrollbars=no,resizable=no,width=342,height=480,top=0,left=50');
	extwin.focus();
}
//Forum
function openForum() {
	extwin=window.open('','forum','location=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=1000,height=750,top=0,left=50');
	extwin.focus();
}
//Liveticker
function openLT() {
	extwin=window.open('','LT','location=no,toolbar=no,status=no,scrollbars=no,resizable=no,width=504,height=488,top=0,left=50');
	extwin.focus();
}
//E-Prospekt
function openEProspekt(prospektart) {
	extwin=window.open('http://beilage.zgk.de/enlay2/index.php?'+prospektart,'ksta','location=no,toolbar=no,status=no,scrollbars=no,resizable=no,menubar=no,width=800,height=640,top=0,left=50');
	extwin.focus();
}
//Social Bookmark
function openSB() {
	extwin=window.open('','sb','location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width=600,height=500,top=50,left=50');
	extwin.focus();
}
//Stadtplan
function openStadtplan(id) {
	extwin=window.open("http://extra.zgk.de/stadtplan/7224_cologne/index.php3?ref=ksta&id="+id, "such2", "directories=no,menubar=no,scrollbars=yes,resizable=yes,status=no,width=890,height=640");
	extwin.focus();
}
//Anzeige aufgeben
function em_service_fenster(url,sf_weite,sf_hoehe){
	if(window.az_service && !az_service.closed) az_service.close();
	if(self.name == "az_service"){
		self.location.href = url;
	}else{
		if(sf_weite > screen.availWidth)
				sf_weite = screen.availWidth;
		if(sf_hoehe > screen.availHeight)
				sf_hoehe = screen.availHeight;
		var sf_left    = screen.availWidth/2  - sf_weite/2;
		var sf_top     = screen.availHeight/2 - sf_hoehe/2;
		var az_service = open(url,"az_service","width="+sf_weite+",height="+sf_hoehe+",top="+sf_top+",left="+sf_left+",resizable=1,status=1,scrollbars=1,dependent=1,toolbar=0,location=0,directories=0,menubar=0,personalbar=0");
	}
}
//Anzeigenservice
function test_fenster(){
	if(opener && self.name == "az_service"){
		opener.focus();
		window.setTimeout("self.close()",50);
	}
}

/*** Code-Couture ***/
function CODECOUTURE_clearField(fieldID) {
	document.getElementById(fieldID).value = "";
}
function CODECOUTURE_hasContent(node) {
	var nodeName = node.nodeName.toUpperCase();
	if (nodeName=="IMG") {
			 if (node.getAttribute("width")==null && node.getAttribute("height")==null) return true;
			 if (node.getAttribute("width")==0 && node.getAttribute("height")==0) return true;
			 if (node.getAttribute("width")!= null && node.getAttribute("height")!=null) {
				if (node.getAttribute("width")>1  && node.getAttribute("height")>1) return true;
			 }
	}
	if (nodeName=="TABLE" || nodeName=="OBJECT" || nodeName=="EMBED" || nodeName=="APPLET" || nodeName=="LAYER" || nodeName=="ILAYER" || nodeName=="MAP") return true;
	var child_node = node.firstChild;
	while (child_node!=null) {
		if (CODECOUTURE_hasContent(child_node) == true) return true;
		child_node = child_node.nextSibling;
	}
	return false;
}
function CODECOUTURE_checkforad_addlines() {
	var i = 0;
	while (document.getElementById("ad"+i)) {
		var node = document.getElementById("ad"+i);
		if (CODECOUTURE_hasContent(node)) {
			node.style.display="block";
		}
		i++;
	}
}

/*** Icons linke Navi Dienste ***/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
	 if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
		img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
		if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
		nbArr[nbArr.length] = img;
		for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
		  if (!img.MM_up) img.MM_up = img.src;
		  img.src = img.MM_dn = args[i+1];
		  nbArr[nbArr.length] = img;
	 } }
  } else if (event == "over") {
	 document.MM_nbOver = nbArr = new Array();
	 for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
		if (!img.MM_up) img.MM_up = img.src;
		img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
		nbArr[nbArr.length] = img;
	 }
  } else if (event == "out" ) {
	 for (i=0; i < document.MM_nbOver.length; i++) {
		img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
	 nbArr = document[grpName];
	 if (nbArr)
		for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
	 document[grpName] = nbArr = new Array();
	 for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
		if (!img.MM_up) img.MM_up = img.src;
		img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
		nbArr[nbArr.length] = img;
  } }
}

/*** Yahoo-Suche ***/
var sa1 = 'http://www.ksta.de/servlet/OriginalContentServer';
var sa2 = 'http://de.yhs.search.yahoo.com/yhs/search';
var sa = 'sya'
var art_sa = 'sya'

function search_set(n){
	switch (n){
		case 'sks':
			document.getElementById('searchform').action = sa1;
			document.getElementById('zq').style.background = "transparent url(http://www.ksta.de/ks/images/static/spacerwhite.gif) repeat";
			document.getElementById('searchform').target = "_self";
			sa = 'sks';
			break;
		case 'sya':
			document.getElementById('searchform').action = sa2;
			document.getElementById('zq').style.background = "transparent url(http://www.ksta.de/ks/images/kopf/yahoo_suchfeld.gif) 0 0";
			document.getElementById('searchform').target = "_blank";
			sa = 'sya';
			break;
	}
	return true;
}
function submit_search(){
	 switch(sa){
		case 'sks':
			document.getElementById('yp').value = '1';
		case 'sya':
			document.getElementById('yp').value = document.getElementById('zq').value;
	 }
	return true;
}
function click_submit(){
	submit_search();
	document.getElementById('searchform').submit();
}
function art_search_set(n){
	switch (n){
		case 'sks':
			document.getElementById('art_searchform').action = sa1;
			document.getElementById('art_searchform').target = "_self";
			art_sa = 'sks';
			break;
		case 'sya':
			document.getElementById('art_searchform').action = sa2;
			document.getElementById('art_searchform').target = "_blank";
			art_sa = 'sya';
			break;
	}
	return true;
}
function art_submit_search(){
	 switch(art_sa){
		case 'sks':
			document.getElementById('art_yp').value = '1';
		case 'sya':
			document.getElementById('art_yp').value = document.getElementById('art_zq').value;
	 }
	return true;
}

/*** Yahoo-ContentMatch ***/
function YahooShowListings() {
	var i=6;
	while (i < zSr.length) {
		var descr = zSr[i++]; // listing description
		var unused1 = zSr[i++]; // (ignore)
		var clickURL = zSr[i++]; // listing link
		var title = zSr[i++]; // listing title
		var sitehost = zSr[i++]; // advertiser's domain name
		var unused2 = zSr[i++]; // (ignore)
		document.write('<tr><td width="1" background="/ks/images/stat/punkte.gif"><img src="/ks/images/stat/spacer.gif" width="1" height="1" alt=""></td>');
		document.write('<td width="242" class="finderbox2sp" style="padding-left: 8px; line-height: 13px;">');
		document.write('<a target="_new" href="' + clickURL + '" style="color: #6B8CB2;"><b>' + title + '</b></a><br>');
		document.write('<a target="_new" href="' + clickURL + '" style="color: #6B8CB2;">' + descr + '</a><br>');
		document.write('<a target="_new" href="' + clickURL + '" style="font-size: 10px; color: #6B8CB2;">' + sitehost + '</a>');
		document.write('</td>');
		document.write('<td width="1" background="/ks/images/stat/punkte.gif"><img src="/ks/images/stat/spacer.gif" width="1" height="1" alt=""></td></tr>');
		document.write('<tr><td colspan="3" width="246" height="1" background="/ks/images/stat/punkte.gif"></td></tr>');
	}
}

/*** exa-Tracking ***/
var count_server ='http://80.64.176.109/countercollector/count';
var count_referrer_server = 'ksta.de';

function count(){
	var count_img = document.getElementById("count_img");
	var count_scr = count_server;
	var count_param = '';
	var lt = "<";
	if (typeof (count_id) == "undefined" || typeof (count_id) == "unknown") { count_param += "";
	} else {count_param = '?id=' + count_id;}
	if (typeof (count_type) == "undefined" || typeof (count_type) == "unknown") { count_param += "";
	} else { count_param += '&type=' + count_type;}
	if (typeof (count_thema) == "undefined" || typeof (count_thema) == "unknown") { count_param += "";
	} else { count_param += '&thema=' + count_thema;}
	if (typeof (count_category) == "undefined" || typeof (count_category) == "unknown") { count_param += "";
	} else { count_param += '&category=' + count_category;}
	count_param +=getReferrer();
	count_param += '&paramend=end';
	document.write(lt+'img id="count_img" width="0" height="0" src="'+count_scr + count_param+'" />');
}
function getReferrer(){
	var referrer = escape(document.referrer);
	var ureferrer = unescape(referrer);
	if(referrer==null){ return '&referer_id=0&referer_type=0';
	} else {
	if(referrer.indexOf(count_referrer_server)>0){ return '&referer_id=1&referer_type=page';
	} else { return '&referer_id=0&referer_type='+ureferrer.substring(0,ureferrer.indexOf("/",7));}
	}
}

function bookmark(was) {
	switch(was) {
		case 'oneview':
			window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title));
			break;
		case 'linkarena':
			window.open('http://linkarena.com/bookmarks/addlink/?url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title) + '&desc=&tags=');
			break;
		case 'delicious':
			var loc = location.href;
			var apos = loc.indexOf('#');
			loc = ( apos>0 ? loc.substring(0,apos) : loc );
			window.open('http://del.icio.us/post?v=2&amp;url=' + encodeURIComponent(loc) + '&amp;title=' + encodeURIComponent(document.title));
			break;
		case 'webnews':
			window.open('http://www.webnews.de/einstellen?url='+ encodeURIComponent(document.location) + '&title=' + encodeURIComponent(document.title));
			break;
		case 'yigg':
			window.open('http://yigg.de/neu?exturl=' + encodeURIComponent(location.href));
			break;
	} //switch
}

function showYahooHotspots() {
	var url1 = new Array();
	var url2 = new Array();
	var url3 = new Array();
	
	var url1_groesse = 0;
	var temp = 0;
	var i = 0;
	var zufall = 0;
	
	for (i=0; i<mapkey.length; i++)
	{
	  var keywords= mapkey[i].keywords.split(", ");
	  var output = "";
	
	  mapkey[i].title = "Top 5 Yahoo Suche";
	  for (var j=0; j<keywords.length; j++)
	  {
		url = "http://de.yhs.search.yahoo.com/yhs/search?fr=yhs-zgruppeksta-hotspots&&ei=ISO-8859-1&lyt=st&p="+ keywords[j];
		url1[j] = "<a target=\"_blank\" class=\"w"+j+"\" href=\""+url+"\">"+keywords[j]+"</a>";
	  }
	}
	
	url2 = url1;
	url1_groesse = j;
	temp = url1_groesse;
	
	for (i=0; i<url1_groesse; i++)
	{
		zufall = Math.ceil(temp * Math.random());
		url3[i] = url2[(zufall-1)];
		url2[(zufall-1)] = url2[(temp-1)];
	
		document.write(""+url3[i]+"&nbsp;&nbsp;&nbsp;&nbsp; ");
		temp--;
	}
}

/*** Germanwings ***/
function gw_goBook(){
	NewWin = window.open("http://ad.de.doubleclick.net/clk;112168901;17577651;h?http://www.germanwings.com/SkySales/Search.aspx?Origin1=CGN&Destination1=" + vDesti + "&RadioButtonMarketStructure=" + vTrip, "GW" , "");
}
function gw_changeOptions(ziel){
	switch (ziel) {
		case "roundtrip":
			vTrip = "RoundTrip";
			break;
		case "oneway":
			vTrip = "OneWay";
			break;
		default:
			vDesti = ziel;
			break;
	}
}

