/*********************
*Preload und Rollover*
*********************/


function swap(obj,bild){
	obj.firstChild.src = bild;
}

var preloadFlag = false;

function preloadImages() {
	if (document.images) {
		preloadFlag = true;
	}
}



/*********************
*POP-UPS*
*********************/


function racecalendarpopup(){
		fenster=window.open("race_calendar.php?lang="+lang,"racecalendar","width=500,height=450,resizable=no,scrollbars=yes,top="+(screen.width/2 - 535)+",left="+(screen.width/2 - 489));
}

function audiopopup(){
		fenster=window.open('http://www.redbullaudioplayer.com/players/view/e7a782c6621570d1ebd8f8fe39f9ca01a5d4e561','audioplayer','width=541,height=565,scrollbars=no,resizable=0,location=no,menubar=no,toolbar=no,status=no');
}

function gall_popup(id,num){
		fenster=window.open("gallery_popup.php?id="+id+'&num='+num,"gallery_popup","width=530,height=480,resizable=no,scrollbars=no,top="+(screen.Height/2 - 240)+",left="+(screen.width/2 - 265));
}



/**************************************************************************
* REPOSITIONING THE OUTER-CONTAINER *
*
* FOR HORIZONTALLY-AND-VERTICALLY-CENTERED SITES:*
* <body onResize='reposition_main(10,10)' onLoad='reposition_main(10,10)'>*
*
* FOR HORIZONTALLY-CENTERED ONLY SITES:*
* <body onResize='reposition_main(10,'')' onLoad='reposition_main(10,'')'>*
*
* CSS-STYLES FOR OUTER_CONTAINER HAVE TO BE SET WITHIN THE HTML CODE      *
***************************************************************************/

// m = margin  ||  w = width  ||  h = height  ||  hor = horizontal  || vert = vertical

function reposition_main(new_hor_margin, new_vert_margin){
	
	cont = document.getElementById('outer_container').style;
	
	
	cont_w_px = cont.width;
	cont_w = cont_w_px.substr(0, 3);								//3 fuer 3-stellige outer_container_width, 4 fuer 4-stellige outer_container_width.
	
	cont_hor_m_px = cont.marginLeft;
	cont_hor_m = cont_hor_m_px.substr(0, 4);
	
	
	
	cont_h_px = cont.height;
	cont_h = cont_h_px.substr(0, 3);
	
	cont_vert_m_px = cont.marginTop;
	cont_vert_m = cont_vert_m_px.substr(0, 4);
	
	
				
	if (window.innerHeight!=undefined){							//mozilla etc
		avail_win_w = window.innerWidth;
		avail_win_h = window.innerHeight;
	}
	else {
		avail_win_w = document.body.offsetWidth;			//pc ie
		avail_win_h = document.body.offsetHeight;	
	}
		
	
	if (new_hor_margin!=''){
		if (avail_win_w < cont_w){
			new_hor_m = Math.abs(cont_hor_m - new_hor_margin);
			cont.left= new_hor_m;
		}
		else {
			cont.left='50%';
		}
	}
	
	
	if (new_vert_margin!=''){
		if (avail_win_h < cont_h){
			new_vert_m = Math.abs(cont_vert_m - new_vert_margin);
			cont.top= new_vert_m;
		}
		else {
			cont.top='50%';
		}
	}

}


/* START GET BROWSER */

function getBrowser(){
	var agt=navigator.userAgent.toLowerCase();

   if((agt.indexOf("msie") != -1)&&
   	(agt.indexOf("netscape/8") == -1)&&	 //making sure we are not detecting NN8 in IE mode
   	(agt.indexOf("opera") == -1)){       //making sure we are not detecting older opera-versions
   	return "IE";	
   }	
   if(agt.indexOf("firefox") != -1){
   	return "FIREFOX";
   }
    if(agt.indexOf("safari") != -1){
   	return "SAFARI";	
   }
   if((agt.indexOf("netscape/8") != -1)&&(agt.indexOf("msie") != -1)){
   	return "NETSCAPE 8 - IE RENDERING";
   }
   if((agt.indexOf("netscape/8") != -1)&&(agt.indexOf("msie") == -1)){
   	return "NETSCAPE 8 - FF RENDERING";
   }
   if(agt.indexOf("netscape/7") != -1){
   	return "NETSCAPE 7";
   }
   if(agt.indexOf("opera") != -1){
   	return "OPERA";
   }
   if(agt.indexOf("camino") != -1){
   	return "CAMINO";
   }	
}

var br = getBrowser();

/* END GET BROWSER */
