/*	hlcmain.js
	###########################################################################
	### WWW.HOTLAPS.DE - HOTLAP COMPETITIONS
	### Developed by Hansjoerg Beck, 61440 Oberursel, Germany
	### http://www.hotlaps.de
	###########################################################################
*/

//=== BANNER Rotation 1
function initSlideShow() {
	var preLoad = new Array();
	for (var i = 0; i < arrBanner.length; i++) {
		preLoad[i] = new Image();
		preLoad[i].src = arrBanner[i];
	}
	var rndId = Math.floor(Math.random()*arrBanner.length);
	document.write('<a id="SlideLink" name="SlideLink" href="'+arrLinks[rndId]+'" target="_blank"/><img src="'+arrBanner[rndId]+'" name="SlideShow" id="SlideShow" width="468" height="60" border="0"/></a>');
	window.setInterval('runSlideShow()', slideShowSpeed);
}

//=== BANNER Rotation 2
function runSlideShow(){
	rndId = Math.floor(Math.random()*arrBanner.length);
	if (document.all){
		document.images.SlideShow.style.filter = "blendTrans(duration=2)";
		document.images.SlideShow.style.filter = "blendTrans(duration=crossFadeDuration)";
		document.images.SlideShow.filters.blendTrans.Apply() ;
	}
	document.images.SlideShow.src = arrBanner[rndId];
	document.getElementById('SlideLink').href = arrLinks[rndId];
	if (document.all){
		document.images.SlideShow.filters.blendTrans.Play();
	}
}

//=== Forum Resize
function resize() {
	var olNs = (navigator.appName=='Netscape') ? true : false;
	var iframe = document.getElementById("FORUMFRAME")

	if (olNs) {
		iframe.height = document.getElementById("FORUMFRAME").contentDocument.body.scrollHeight;
	} else {
		iframe.height = document.getElementById("FORUMFRAME").document.body.scrollHeight;
	}
	window.scroll(0,0);
}

//=== plus/minus button
b_minus = new Image (12,12);
b_minuson = new Image (12,12);
b_plus = new Image (12,12);
b_pluson = new Image (12,12);
b_minus.src = "/0/pix/menus/navl_minus.gif";
b_minuson.src = "/0/pix/menus/navl_minuson.gif";
b_plus.src = "/0/pix/menus/navl_plus.gif";
b_pluson.src = "/0/pix/menus/navl_pluson.gif";

//=== Lite plus/minus button
function LiteSection (pic,lite) {
	a = 'pm' + pic;
	if (lite == '') {
		if (document.getElementById(a).src == b_minuson.src) {
			document.getElementById(a).src = b_minus.src;
		}
		if (document.getElementById(a).src == b_pluson.src) {
			document.getElementById(a).src = b_plus.src;
		}
	}
	else {
		if (document.getElementById(a).src == b_minus.src) {
			document.getElementById(a).src = b_minuson.src;
		}
		if (document.getElementById(a).src == b_plus.src) {
			document.getElementById(a).src = b_pluson.src;
		}
	}
}

//========== Hides / Unhides defined parts of a table
function HideSection (section,pic) {
	alert (document.getElementById(section).length);
	alert (section);
	var Tabrows = document.getElementById(section);
	for(var ii=0;ii<document.getElementById(section).length;ii++){
		Tabrows[ii].style.display = (Tabrows[ii].style.display == "")?"none":"";
	} 
	if (eval("document['pm" + pic + "'].src == b_minuson.src;")) {
		eval("document['pm" + pic + "'].src=b_pluson.src;");
		eval("document['pm" + pic + "'].alt='Show block [" + section + "]';");
	}
	else {
		eval("document['pm" + pic + "'].src=b_minuson.src;");
		eval("document['pm" + pic + "'].alt='Hide block [" + section + "]';");
	}
}

//=== Switch plus/minus button in portal-blocks
function SwitchPMButton(pic) {
	a = 'pm' + pic;
	if (document.getElementById(a).src == b_minuson.src) {
		document.getElementById(a).src = b_pluson.src;
	}
	else {
		document.getElementById(a).src = b_minuson.src;
	}
}

//=== oInfo - create new window
function oInfo(url,target,h,w,s) {
	var Info_win;
	Info_win=window.open(url,target,"height=" + h + ",width=" + w + ",resizable=no,dependent=yes,scrollbars=no," + s);
	Info_win.focus();
}

//========== SEARCH DRIVERS
function searchon(path) {
	var myindex=document.getElementById('country').value;
	if(myindex.length>1) {
		window.open(path + myindex,target="_self");
	}
}

//========== CHECK ENTER
function checkEnter(e,dest){ //e is event object passed from function invocation
	var characterCode

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		searchon(dest);
		return false
	}
	else{
		return true
	}
}

//========== CATOFF
function catoff(form) {
	document.USRCAT.QUERY1.options.value="0";
	document.USRCAT.QUERY2.options.value="0";
	if(typeof(document.USRCAT.QUERY3)=='object') {
		document.USRCAT.QUERY3.options.value="0";
	}
	document.USRCAT.submit();
}

//========== Switch CB Button
//b_cat1 = new Image (200,200);
//b_cat2 = new Image (200,200);
//b_cat1.src = "$dir_pixall/buttons/B_CAT1A.gif";
//b_cat2.src = "$dir_pixall/buttons/B_CAT1B.gif";

//========== doSwitchCB
function doSwitchCB(form) {
	if (document.catbutton.src == b_cat1.src) {
		document.catbutton.src=b_cat2.src;
	}
	else {
		document.catbutton.src=b_cat1.src;
	}
}
