function changeAllLinksWithClassToTargetBlanks() {
  for (i = 0; i < document.links.length; i++) {
    if (document.links[i].getAttribute('class') == 'newWindow'
      || document.links[i].className == 'newWindow') {
      document.links[i].setAttribute('target', '_blank');
    }
  }
}
window.onload = changeAllLinksWithClassToTargetBlanks;

function goto() {	
	document.location.href = 'http://www.gebrauchtbikes.at/gebrauchtbikes.html';
	}

function gotonew() {	
	document.location.href = 'http://www.gebrauchtbikes.at/motorradverleih.php';
	}


//############# Browser detection and show/hide layer AND  Infomessages
if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";
//Internet Explorer e.g. IE4 upwards :
if (document.all) type="IE";
//For Netscape version 4 :
if (document.layers) type="NN";
//Mozila e.g. Netscape 6 upwards
if (!document.all && document.getElementById) type="MO"; 

function ShowInfo(id, action){
  if (type=="IE") eval("document.all." + id + ".style.visibility='" + action + "'");
  if (type=="NN") eval("document." + id + ".visibility='" + action + "'");
  if (type=="MO" || type=="OP")
    eval("document.getElementById('" + id + "').style.visibility='" + action + "'");
} 


/* ################### RANDOM IMAGES auf der Startseite*/
function ChangeCSSBgImg() {
if (!document.getElementById) return false;

var MyElement = "div-mainbanner-box" //The ID of the element you want to change
var ImgPath = "img/img-changer/" //The file path to your images

if (!document.getElementById(MyElement)) return false;

var random_images = new Array ();
	
	random_images[0] = "9143.jpg";
	random_images[1] = "7191.jpg";
	random_images[2] = "9139.jpg";
	random_images[3] = "9154.jpg";

var $header = document.getElementById(MyElement);
var $backgroundurl = $header.style.backgroundImage;
var ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")";

	if ($backgroundurl != ImgURL) {
		$header.style.backgroundImage = ImgURL;
	}
}

/* random number generator */
	function rand(n) {
		return ( Math.floor ( Math.random ( ) * n ) );
	}

/* Custom onload function */

	function addLoadEvent(func) {
		var oldonload = window.onload;
				if (typeof window.onload != 'function') {
				window.onload = func;
				} else {
				window.onload = function() {
			oldonload();
		func();
		}
	}
}

/* trigger onload */
addLoadEvent(ChangeCSSBgImg); 




