/* DHTML Library
   the original DHTML Library can be found at:
   http://www.netzwelt.com/selfhtml/dhtml/beispiele/dhtml_bibliothek.htm
*/
var DHTML = 0, DHTML_DOM = 0, DHTML_MS = 0, DHTML_NS = 0, DHTML_OP = 0;

function DHTML_init() {
	if (window && window.opera) { DHTML_OP = 1; }
	if(document.getElementById) { DHTML = 1; DHTML_DOM = 1; }
	if(document.all && !DHTML_OP) { DHTML = 1; DHTML_MS = 1; }
	if (window && window.netscape && window.screen && !DHTML_DOM && !DHTML_OP){ DHTML = 1; DHTML_NS = 1; }
}

function DHTML_getElem(p1,p2,p3) {
	var Elem;
	if(DHTML_DOM) {
		if(p1.toLowerCase()=="id") { if (typeof document.getElementById(p2) == "object") Elem = document.getElementById(p2); else Elem = void(0); return(Elem); }
		else if(p1.toLowerCase()=="name") { if (typeof document.getElementsByName(p2) == "object") Elem = document.getElementsByName(p2)[p3]; else Elem = void(0); return(Elem); }
		else if(p1.toLowerCase()=="tagname") { if (typeof document.getElementsByTagName(p2) == "object" || (DHTML_OP && typeof document.getElementsByTagName(p2) == "function")) Elem = document.getElementsByTagName(p2)[p3]; else Elem = void(0); return(Elem); }
		else return void(0);
	} else if(DHTML_MS) {
		if(p1.toLowerCase()=="id") { if (typeof document.all[p2] == "object") Elem = document.all[p2]; else Elem = void(0); return(Elem); }
		else if(p1.toLowerCase()=="tagname") { if (typeof document.all.tags(p2) == "object") Elem = document.all.tags(p2)[p3]; else Elem = void(0); return(Elem); }
		else if(p1.toLowerCase()=="name") { if (typeof document[p2] == "object") Elem = document[p2]; else Elem = void(0); return(Elem); }
		else return void(0);
	} else if(DHTML_NS) {
		if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") { if (typeof document[p2] == "object") Elem = document[p2]; else Elem = void(0); return(Elem); }
		else if(p1.toLowerCase()=="index") { if (typeof document.layers[p2] == "object") Elem = document.layers[p2]; else Elem = void(0); return(Elem); }
		else return void(0);
	}
}

DHTML_init();
/* END - DHTML Library */

function SCM_fixturesInit() {
	if(typeof(SCN_HEADLINES_LOCATION) == "undefined") {
		SCN_HEADLINES_LOCATION = '';
	}

	++SCM_INIT_COUNT;
	if(SCM_INITIALIZED) {
//		window.status = "FX reinit rejected " + SCM_INIT_COUNT;
		return;
	}
//	window.status = "Fixtures Status: " + SCM_INITIALIZED;
	if(SCM_FX_ARRAY.length < 1) {
		return;
	}

	var SCM_FIXTURES_FIXTURE_COUNT = 0;
	var SCM_ROWCLASS		= 1;
	var SCM_FIXTURE_LINE	= '';
	var SCM_FIXTURES_TMP	= '<table width="' + SCM_FIXTURE_WIDTH + '" cellspacing="0" cellpadding="2" border="0">' + "\n";
	
	var nameteam = 'Team';
	if(SCM_FX_LEAGUE == 'fahrer2006') {
		nameteam = 'Name';
	}
	
	SCM_FX_LEAGUE = 'Formel 1 GP-Punktestand 2007';
	
	SCM_FIXTURES_TMP		+= '<tr>' + "\n";
	
	SMM_url	= location.href;
	SCM_FIXTURES_TMP		+= '<td class="SCM_TABLE_HEAD" colspan="3" width="' + SCM_FIXTURE_WIDTH + '" align="right"><a href="http://www.sportal.at/" target="_blank"><img src="http://www.sportal.at/content/images/at/logo_konfig1.gif" align="left" border="0"></a> ' + SCM_FX_LEAGUE + '&nbsp;&nbsp;&nbsp;</td>' + "\n";
	
	SCM_FIXTURES_TMP		+= '</tr>' +  "\n";
	SCM_FIXTURES_TMP		+= '<tr>' + "\n";
	SCM_FIXTURES_TMP		+= '<td class="SCM_TABLE_HEAD" width="15%" align="left">Rang</td><td class="SCM_TABLE_HEAD" width="65%" align="left">' + nameteam + '</td><td class="SCM_TABLE_HEAD" width="20%" align="left">Punkte</td>' + "\n";
	SCM_FIXTURES_TMP		+= '</tr>' +  "\n";	
	SCM_FIXTURES_FIXTURE_COUNT = SCM_FX_ARRAY.length;
	
	SCM_URL		= 'sportal';	
	SCM_LINK2	= '</a>'
	SCM_LINK1	= '<a href="http://www.' + SCM_URL + '.at/at/generated/profile/formel1/profile.html" CLASS="SCM_FIXTURES_LINK_1" target="_blank">'

	for(var i=0;i<SCM_FIXTURES_FIXTURE_COUNT;i++) {
		var SCM_ARRAY_BUFFER = SCM_FX_ARRAY[i];

		SCM_FIXTURE_LINE = '';
		SCM_FIXTURES_TMP += '<tr>' + "\n";

		SCM_FIXTURE_LINE += '<td class="SCM_FIXTURES_' + SCM_ROWCLASS + '" align="left">';
		SCM_FIXTURE_LINE += SCM_ARRAY_BUFFER[0];
		SCM_FIXTURE_LINE += '&nbsp;</td>' + "\n";

		SCM_FIXTURE_LINE += '<td class="SCM_FIXTURES_' + SCM_ROWCLASS + '" align="left">' + SCM_LINK1;
		SCM_FIXTURE_LINE += SCM_ARRAY_BUFFER[1];
		SCM_FIXTURE_LINE += SCM_LINK2 + '&nbsp;</td>' + "\n";

		SCM_FIXTURE_LINE += '<td class="SCM_FIXTURES_' + SCM_ROWCLASS + '" align="left">';
		SCM_FIXTURE_LINE += SCM_ARRAY_BUFFER[2];
		SCM_FIXTURE_LINE += '&nbsp;</td>' + "\n";

		SCM_FIXTURES_TMP += SCM_FIXTURE_LINE;
		SCM_FIXTURES_TMP += '</tr>' + "\n";
		if(SCM_ROWCLASS == 1) {
			SCM_ROWCLASS = 2;
		} else {
			SCM_ROWCLASS = 1;
		}
	}
	SCM_FIXTURES_TMP += '<tr>' + "\n";
	SCM_FIXTURES_TMP += '<td class="SCM_TABLE_HEAD" colspan="3" width="' + SCM_FIXTURE_WIDTH + '">&nbsp;</td>' + "\n";
	SCM_FIXTURES_TMP += '</tr>' + "\n";
	SCM_FIXTURES_TMP += '</table>';

 	if (DHTML_DOM) {
		SCM_FIXTURES_OBJECT = document.getElementById("SCM_OBJ_FIXTURES_TEXT");
		if(!SCM_FIXTURES_OBJECT) {
			window.setTimeout("SCM_fixturesInit()",1000);
		} else {
			// set content of the ticker
			SCM_FIXTURES_OBJECT.innerHTML = SCM_FIXTURES_TMP;
		}
	} else {
		SCM_FIXTURES_OBJECT = document.SCM_FIXTURES_PARENT.document.SCM_OBJ_FIXTURES_TEXT;
		// set content of the ticker
		SCM_FIXTURES_OBJECT.document.open();
		SCM_FIXTURES_OBJECT.document.write(SCM_FIXTURES_TMP);
		SCM_FIXTURES_OBJECT.document.close();
	}
	SCM_INITIALIZED = 1;
//	window.status = "Fixtures Status: " + SCM_INITIALIZED;
}

function SCM_styleSheet () {
	var TABLE_HEAD_CSS	= '.SCM_TABLE_HEAD {' +
						  'font-weight:' 	+ SCM_FIXTURES_HEAD_FONT_BOLD + ';' +
						  'font-size:'		+ SCM_FIXTURES_HEAD_FONT_SIZE + 'px;' +
						  'font-family:'	+ SCM_FIXTURES_FONT + ';' +
						  'color:'			+ SCM_FIXTURES_FONT_COLOR + ';' +
						  'background-color:' + SCM_FIXTURES_BG_COLOR + ';}';
	var FIXTURES_CSS_1	= '.SCM_FIXTURES_1 {' +
						  'font-weight:' 	+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'		+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'	+ SCM_FIXTURES_FONT + ';' +
						  'color:'			+ SCM_FIXTURES_FONT_COLOR_1 + ';';
						if(SCM_FIXTURES_TRANSPARENT == 0) {
						  	FIXTURES_CSS_1	+= 'background-color:' + SCM_FIXTURES_BG_COLOR_1 + ';';
						}
						  FIXTURES_CSS_1 += '}';
	var FIXTURES_CSS_2	= '.SCM_FIXTURES_2 {' +
						  'font-weight:' 	+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'		+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'	+ SCM_FIXTURES_FONT + ';' +
						  'color:'			+ SCM_FIXTURES_FONT_COLOR_2 + ';';
						if(SCM_FIXTURES_TRANSPARENT == 0) {
						  	FIXTURES_CSS_2	+= 'background-color:' + SCM_FIXTURES_BG_COLOR_2 + ';';
						}
						  FIXTURES_CSS_2 += ';}';
	var LINK_CSS_1		= 'A.SCM_FIXTURES_LINK_1 {' + 
						  'font-weight:' 		+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'			+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'		+ SCM_FIXTURES_FONT + ';' +
						  'text-decoration:'	+ SCM_FIXTURES_LINK_UNDERLINE + ';' +
						  'color:'				+ SCM_FIXTURES_LINK_COLOR_1 + ';}';
	var LINK_CSS_2		= 'A.SCM_FIXTURES_LINK_2 {' + 
						  'font-weight:' 		+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'			+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'		+ SCM_FIXTURES_FONT + ';' +
						  'text-decoration:'	+ SCM_FIXTURES_LINK_UNDERLINE + ';' +
						  'color:'				+ SCM_FIXTURES_LINK_COLOR_2 + ';}';
	var VISITED_CSS_1	= 'A.SCM_FIXTURES_LINK_1:visited {' +
						  'font-weight:' 		+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'			+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'		+ SCM_FIXTURES_FONT + ';' + 
						  'text-decoration:'	+ SCM_FIXTURES_LINK_UNDERLINE + ';' +
						  'color:'				+ SCM_FIXTURES_VLINK_COLOR_1 + ';}';
	var VISITED_CSS_2	= 'A.SCM_FIXTURES_LINK_2:visited {' +
						  'font-weight:' 		+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'			+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'		+ SCM_FIXTURES_FONT + ';' + 
						  'text-decoration:'	+ SCM_FIXTURES_LINK_UNDERLINE + ';' +
						  'color:'				+ SCM_FIXTURES_VLINK_COLOR_2 + ';}';
	var HOVER_CSS_1		= 'A.SCM_FIXTURES_LINK_1:hover {' +
						  'font-weight:' 		+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'			+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'		+ SCM_FIXTURES_FONT + ';' +
						  'text-decoration:'	+ SCM_FIXTURES_HOVER_UNDERLINE + ';' +
						  'color:'				+ SCM_FIXTURES_HOVER_COLOR_1 + ';}';
	var HOVER_CSS_2		= 'A.SCM_FIXTURES_LINK_2:hover {' +
						  'font-weight:' 		+ SCM_FIXTURES_FONT_BOLD + ';' +
						  'font-size:'			+ SCM_FIXTURES_FONT_SIZE + 'px;' +
						  'font-family:'		+ SCM_FIXTURES_FONT + ';' +
						  'text-decoration:'	+ SCM_FIXTURES_HOVER_UNDERLINE + ';' +
						  'color:'				+ SCM_FIXTURES_HOVER_COLOR_2 + ';}';

	document.writeln("\n\n<STYLE>");

	document.writeln(TABLE_HEAD_CSS);
	document.writeln(FIXTURES_CSS_1);
	document.writeln(FIXTURES_CSS_2);
	document.writeln(LINK_CSS_1);
	document.writeln(LINK_CSS_2);
	document.writeln(VISITED_CSS_1);
	document.writeln(VISITED_CSS_2);
	document.writeln(HOVER_CSS_1);
	document.writeln(HOVER_CSS_2);

	document.writeln("</STYLE>\n\n");
}

/* Fixtures variables declaration */
/* other variables */
var SCM_HTTP_ROOT			= 'http://www.sportal.de/de/nncs/dlc/';	// prefix string for inclusion of scripts
var SCM_RANDOM				= new String (Math.random());	// random string
var SCM_FX_ARRAY			= new Array();
var SCM_LINK_PREFIX			= 'http://www.sportal.de/';	// prefix string for inclusion of scripts
var SCM_FIXTURES_WRAP		= 'normal';
var SCM_FIXTURES_LI_WRAP	= 'outside';
var SCM_INITIALIZED			= 0;
var SCM_INIT_COUNT		= 0;
/* END - Fixtures variables declaration */

if (typeof SCM_FIXTURES_RESSORT == "undefined") {
	// define default scale factor
	var SCM_FIXTURES_RESSORT = '';
}

if(SCM_FIXTURES_RESSORT == '') {
	document.writeln('<SCRIPT LANGUAGE="Javascript" SRC="' +
				   SCM_HTTP_ROOT +
				   'fixtures.js?' +
				   SCM_RANDOM +
				   '" type="text/javascript"></SCRIPT>');

} else {
	document.writeln('<SCRIPT LANGUAGE="Javascript" SRC="' +
				   SCM_HTTP_ROOT +
				   'f1_' + SCM_FIXTURES_RESSORT + '.js?' +
				   SCM_RANDOM +
				   '" type="text/javascript"></SCRIPT>');
}

SCM_BROWSER_POS = 'relative';
if (DHTML_NS) {
	// Netscape layer workaround. Positioning has to be 'absolute'!
	// Otherwise it will not work properly.
	SCM_BROWSER_POS = 'absolute';
}

var SCM_FIXTURES_OBJECT_STRING	 = '';	// string which will be included for displaying the ticker
// if this browser does not support DOM object model
if (!DHTML_DOM) {
	SCM_FIXTURES_OBJECT_STRING	+= '<ILAYER NAME="SCM_FIXTURES_PARENT">';
	SCM_FIXTURES_OBJECT_STRING	+= '<LAYER NAME="SCM_OBJ_FIXTURES_TEXT" CLASS="SCM_FIXTURES"></LAYER>&nbsp;</ILAYER>';
} else {
	// Ticker Object: initially hidden DIV with no content so far
	// Content will be added in function SCM_tickerInit().
	SCM_FIXTURES_OBJECT_STRING	+= '<DIV ID="SCM_OBJ_FIXTURES_TEXT" CLASS="SCM_FIXTURES"></DIV>';
}

SCM_styleSheet();
// include div which will contain the ticker
document.writeln(SCM_FIXTURES_OBJECT_STRING);

// initialize fixtures after 0.1 seconds
window.setTimeout("SCM_fixturesInit()",100);
// try again after 0.5, 1, 2, 5 and 10 seconds
window.setTimeout("SCM_fixturesInit()",500);
window.setTimeout("SCM_fixturesInit()",1000);
window.setTimeout("SCM_fixturesInit()",2000);
window.setTimeout("SCM_fixturesInit()",5000);
window.setTimeout("SCM_fixturesInit()",10000);
