function daten(str)
{
 //vrati = str.getYear() + '-'+ formatt(str.getMonth()+1) +'-' + formatt(str.getDate()) + ' ' + formatt(str.getHours()) + ":" + formatt(str.getMinutes()) + ":" + formatt(str.getSeconds())
vrati = formatt(str.getDate()) + '.'+ formatt(str.getMonth()+1) +'.' + str.getFullYear() + ' ' + formatt(str.getHours()) + ":" + formatt(str.getMinutes()) + ":" + formatt(str.getSeconds())
return vrati;
}
function TextNews(width,tablealign, header,catID,page)
{
var headerEncode = header.toString() ;

if (page == '') page = 'kategorien';
if (headerEncode != '') headerEncode = headerEncode.replace(/ +/gi, "+");
document.write ('<TABLE cellpadding="0" cellspacing="0" border="0" width="'+ width +'" border="0" align="'+ tablealign +'" >\n');
document.write 	('<tr>\n'); 
document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n');
document.write 		('<td class="TableHeader" width="'+ (width-6) + '" height="16"><a href="../_news/news_'+page+'.asp?ID='+ catID + '&Name='+ headerEncode + '&' + minisiteAdditionalLink + '"><span class="White">'+header+'</span></a></td>\n'); 
document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
document.write 	('</tr>\n'); 
document.write 	('<tr class="BackColorMiddleGrey">\n'); 
document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="5"></td>\n');  
document.write 		('<td width="' + (width-29) + '"><img src="../img/empty.gif" width="219" height="1"></td>\n'); 
document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
document.write 	('</tr>\n'); 
document.write 	('<tr class="BackColorMiddleGrey">\n');
document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n');
document.write 		('<td width=" & width-6 & "><div class="NewsBodyHome">\n'); 
document.write 		(article);
document.write 		('...</div></td>\n');
document.write 		('<td ><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
document.write 	('</tr>\n');
document.write 	('<tr class="BackColorMiddleGrey">\n');
document.write 		('<td colspan="2"><div align="right"><a href="../_news/newsdetail.asp?ID=' + ID + '&subm=' + subMenu +'&'+ minisiteAdditionalLink +'"><img src="../img/'+ lang + 'tablehead_mehr_lesen.gif" border="0" vspace="4"></a></div></td>\n'); 
document.write 		('<td ><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
document.write 	('</tr>\n');
document.write 	('</table>\n');
}
function listNews(header, catID,catName,more,width,tablealign, from, to, headeralign, page)
{
if (page == '') page = 'kategorien';
if (xArray != 'EMPTY')
	{
	if (headeralign== '')headeralign = 'right';
	if (from == '')	from = 0;
	if ( to == '') to = xArray.length
	document.write ('<TABLE cellpadding="0" cellspacing="0" width="'+ width +'" border="0" align="'+ tablealign +'" >\n');
	document.write 	('<tr>\n');
	document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n');
	document.write 		('<td class="TableHeader" width="'+(width - 6) + '" colspan="2" height="16" align="' + headeralign +'">&nbsp;'+header+'</td>\n');
	document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
	document.write 	('</tr>\n'); 
		for(l = from; l < to; l++)
		{	
			document.write 	('<tr class="BackColorMiddleGrey">\n');
			document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="16"></td>\n');
			document.write 		('<td width="23"><img src="../img/arrow.gif" width="23" height="10"></td>\n');
			document.write 		('<td width="'+(width - 26) + '" align="left">\n');
	if (more && l == to-1 ) {	
			document.write 		('<a href="../_news/news_'+page+'.asp?ID='+catID+'&Name='+catName+'&subm=1'+'&'+ minisiteAdditionalLink +'"><img src="../img/'+ lang +'tablehead_mehr.gif" border="0" align="right" align="absbottom"></a>\n');
				}
			document.write 		('<a href="../_news/newsdetail.asp?ID='+xArray[l][xArray.indID]+'&subm=' +subMenu + '&' + minisiteAdditionalLink + '"><b>'+
xArray[l][xArray.indHeadline].substr(0,50) +'...</b></a></td>\n');
			document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="16"></td>\n');
			document.write 	('</tr>\n');
		}
	document.write ('</TABLE>\n');
	}	
}

function listNewsRecommendation(header, catID,catName,more,width,tablealign, from, to, headeralign, page)
{
if (page == '' || page == 'undefined' ) page = 'kategorien';
if (x17Array != 'EMPTY')
	{
	if (headeralign== '')headeralign = 'right';
	if (from == '')	from = 0;
	if ( to == '') to = x17Array.length
	document.write ('<TABLE cellpadding="0" cellspacing="0" width="'+ width +'" border="0" align="'+ tablealign +'" >\n');
	document.write 	('<tr>\n');
	document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n');
	document.write 		('<td class="TableHeader" width="'+(width - 6) + '" bgcolor="001b7a" colspan="2" height="16" align="' + headeralign +'">&nbsp;'+header+'</td>\n');
	document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
	document.write 	('</tr>\n'); 
		for(l = from; l < to; l++)
		{	
			document.write 	('<tr class="BackColorMiddleGrey">\n');
			document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="16"></td>\n');
			document.write 		('<td width="23"><img src="../img/arrow.gif" width="23" height="10"></td>\n');
			document.write 		('<td width="'+(width - 26) + '" align="left">\n');
	if (more && l == to-1 ) {	
			document.write 		('<a href="../_news/news_'+page+'.asp?ID='+catID+ '&' + minisiteAdditionalLink +'&Name='+catName+'&subm=1"><img src="../img/'+ lang +'tablehead_mehr.gif" border="0" align="right" align="absbottom"></a>\n');
				}
			document.write 		('<a href="../_markets/security_detail.asp?recDetail=true&SymbolName=' + x17Array[l][x17Array.indPrimarySymbolName] + '&segm=Recommendation&CompanyID=' + x17Array[l][x17Array.indCompanyID] + '&RatingID='+ x17Array[l][x17Array.indRatingID] + '&FinInstID=' + x17Array[l][x17Array.indFinInstID]+ '&Date='+  daten(x17Array[l][x17Array.indDate]) + '&subm='+ subMenu + '&' + minisiteAdditionalLink + '"><b>'+  x17Array[l][x17Array.indAnalyst] + ' : ' +  x17Array[l][x17Array.indCompanyName] + ' - ' +  x17Array[l][x17Array.indRatingGer] +'</b></a></td>\n');
			document.write 		('<td width="3"><img src="../img/empty.gif" width="3" height="16"></td>\n');
			document.write 	('</tr>\n');
		}
	document.write ('</TABLE>\n');
	}	
}

function drawline(i)
{
x = new Date(xArray[i][xArray.indDate]);
date1 = formatt(x.getDate()) + '.'+ formatt(x.getMonth()+1) +'.' + x.getFullYear();
date2 = formatt(x.getHours()) + ':'+ formatt(x.getMinutes()); 

	if (xArray[i][xArray.indSourceName]=='TeleTrader News Room')  Source = 'TT News Room'
	else Source = xArray[i][xArray.indSourceName];

	document.write('<tr class="BackColorLightGrey"><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="3" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/arrow.gif" width="23" height="10" border="0" alt=""></td><td align="center" valign="middle" class="BackColorLightGrey" width="470" >');
	document.write('<div class="foot" align="left"><a href="newsdetail.asp?ID=' + xArray[i][xArray.indID] + '&subm=' + subMenu + '&' + minisiteAdditionalLink + '">' + xArray[i][xArray.indHeadline] + '</a></div></td><td><div class="quotes" align="center">&nbsp;' + Source + '</div></td><td><div class="quotes" align="center">' + date1 + '</div></td><td><div class="quotes" align="center">' + date2 + '</div></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="3" height="1"></td>');
	document.write('</tr>');

}

function listNewsWithSource(header, catID,catName,more,width,page)
{
if (page == '') page = 'kategorien'
if (xArray != 'EMPTY')
	{
	document.write ('<TABLE cellpadding="0" cellspacing="0" width="'+ width +'" border="0" >\n');
	
	document.write 	('<tr>\n');
	document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n');
	document.write 		('<td class="TableHeader" width="'+(width - 6) + '" bgcolor="001b7a" colspan="3" height="16">');

	if (page != 'wpknr') 
		{
		document.write 		('<a href="../_news/news_'+page+'.asp?ID='+catID+'&Name='+catName+'&subm=' + subMenu + '&' + minisiteAdditionalLink + '"><span class="White">&nbsp;'+header+'</span></a>\n');
		}
	else
		 {
		document.write 		('<span class="White">&nbsp;'+header+'</span>\n');
		}
	
	document.write 		('</td><td class="TableHeader" width="'+(width - 6) + '" bgcolor="001b7a" colspan="2" height="16" align="right">');
if (more){
	document.write 		('<a href="../_news/news_'+page+'.asp?ID='+catID+'&Name='+catName+'&subm=' + subMenu + '&' + minisiteAdditionalLink + '" class="LinkMore">&nbsp;'+ titles_mehr +'&nbsp;>>&nbsp;</a>');
}
	document.write 		('</td><td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
	document.write 	('</tr>\n'); 
	
	document.write('<tr><td class="BackColorLightBlue" colspan="2"><img src="../img/empty.gif" width="23" height="1" alt="" border="0" ></td><td valign="top"  class="FieldsDescriptionHeader">headline</td><td class="FieldsDescriptionHeader" align="center">'+ titles_quelle +'</td><td valign="top" class="FieldsDescriptionHeader" align="center">'+ titles_datum +'</td><td valign="top" class="FieldsDescriptionHeader" align="center" colspan="2">'+ titles_zeit +'</td></tr>');
	
	document.write('<tr><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="3" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="23" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="349" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="110" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="70" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="41" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="3" height="1"></td></tr>');	
	
	for(l = 0; l < xArray.length; l++)	{	drawline(l);}
	
	document.write ('</TABLE>\n');
	}	
}

function horizontal_bar_white(width)
{
	document.write 	('<table width="'+ width +'" border="0" cellspacing="0" cellpadding="0" class="BackColorWhite"><tr><td><img src="../img/empty.gif" width="' + width +'"  height="3" border="0" alt=""></td></tr></table>');
}
function drawOverviewPage()
{	var catName;
	var plus = 5;	

document.write ('<table cellpadding="0" cellspacing="0" width="625" border="0">');

	for(i = 0; i < 5; i++)
	{	
	document.write('<tr><td class="BackColorMiddleGrey" width="300" valign="top">');
	article = xArray[i][xArray.indArticle];
	ID = xArray[i][xArray.indID];
	TextNews('300','right',catArray[xArray[i][xArray.indCategoryList]],xArray[i][xArray.indCategoryList],'kategorien');
		document.write ('</td>');
		document.write ('<td width="3">&nbsp;</td>');
		document.write ('<td width="322"  class="BackColorMiddleGrey" valign="top">');
			if (plus == 5 || plus == 7)
			{	catName = catArray[xArray[i+plus][xArray.indCategoryList]];
				
				if(plus == 5) {
				 header = '<a href="../_news/news_kategorien.asp?ID='+xArray[i+plus][xArray.indCategoryList]+'&Name='+catName[0].replace(/ /gi,"\+") + '&' + minisiteAdditionalLink +'&subm=1"><span class="White">'+catName+'</span></a>'
				 listNews( header, xArray[5][xArray.indCategoryList], catName ,true,mainWidth -304,'',5,9,'left','kategorien');
				 	}
				if(plus == 7)	 {
					 header = '<a href="../_news/news_kategorien.asp?ID=17&Name='+catArray[17]+ '&' + minisiteAdditionalLink +'&subm=1"><span class="White">'+catArray[17]+'</span></a>'
					listNewsRecommendation (header, 17, catArray[17] ,true,mainWidth -304, '','','','left','')
					}	
								
				if (plus == 5 ){ plus = 8;}
				else {plus = 10;}
				
			}
			else
			{
				article = xArray[i+plus][xArray.indArticle];
				ID = xArray[i+plus][xArray.indID];
				TextNews(mainWidth -304,'right',catArray[xArray[i+plus][xArray.indCategoryList]], xArray[i+plus][xArray.indCategoryList],'kategorien');
				if (plus == 8 ) {plus = 7;}
				
			}
	document.write('</td></tr>');

	}
	///document.write ('</table>');
//document.write ('</td></tr>');
document.write ('</table>');
}

function listNewsWithOutID(header, catID,catName,more,width,page, WithOutID)
{
if (page == '') page = 'kategorien'
if (xArray != 'EMPTY')
	{
	document.write ('<TABLE cellpadding="0" cellspacing="0" width="'+ width +'" border="0" >\n');
	
	document.write 	('<tr>\n');
	document.write 		('<td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n');
	document.write 		('<td class="TableHeader" width="'+(width - 6) + '" bgcolor="001b7a" colspan="3" height="16">');

	if (page != 'wpknr') 
		{
		document.write 		('<a href="../_news/news_'+page+'.asp?ID='+catID+'&Name='+catName+'&subm=' + subMenu + '&' + minisiteAdditionalLink + '"><span class="White">&nbsp;'+header+'</span></a>\n');
		}
	else
		 {
		document.write 		('<span class="White">&nbsp;'+header+'</span>\n');
		}
	
	document.write 		('</td><td class="TableHeader" width="'+(width - 6) + '" bgcolor="001b7a" colspan="2" height="16" align="right">');
if (more){
	document.write 		('<a href="../_news/news_'+page+'.asp?ID='+catID+'&Name='+catName+'&subm=' + subMenu + '&' + minisiteAdditionalLink + '" class="LinkMore">&nbsp;'+ titles_mehr +'&nbsp;>>&nbsp;</a>');
}
	document.write 		('</td><td class="TableHeader" width="3"><img src="../img/empty.gif" width="3" height="1"></td>\n'); 
	document.write 	('</tr>\n'); 
	
	document.write('<tr><td class="BackColorLightBlue" colspan="2"><img src="../img/empty.gif" width="23" height="1" alt="" border="0" ></td><td valign="top"  class="FieldsDescriptionHeader">headline</td><td class="FieldsDescriptionHeader" align="center">'+ titles_quelle +'</td><td valign="top" class="FieldsDescriptionHeader" align="center">'+ titles_datum +'</td><td valign="top" class="FieldsDescriptionHeader" align="center" colspan="2">'+ titles_zeit +'</td></tr>');
	
	document.write('<tr><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="3" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="23" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="349" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="110" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="70" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="41" height="1"></td><td align="left" valign="top" class="BackColorLightGrey" ><img src="../img/empty.gif" width="3" height="1"></td></tr>');	
	
	for(l = 0; l < xArray.length; l++)	{if(xArray[l][xArray.indID] != WithOutID)	drawline(l);}
	
	document.write ('</TABLE>\n');
	}	
}
