var page_top, t1, x=0, y=0


function getElementsByClassName(class_name) {
	var all_obj,ret_obj=new Array(),j=0,teststr

	if(document.all)
		all_obj=document.all
	else if(document.getElementsByTagName && !document.all)
		all_obj=document.getElementsByTagName("a")

	for(i=0; i<all_obj.length; i++)	{
		if(all_obj[i].className.indexOf(class_name)!=-1) {
			teststr=","+all_obj[i].className.split(" ").join(",")+","
			if(teststr.indexOf(","+class_name+",")!=-1) {
				ret_obj[j]=all_obj[i]
				j++
			}
		}
	}
	return ret_obj;
}

// START: Google Made Code

var mapdiv, map

function wheelZoom(e) {
	// Verhindern, dass beim Zoomen der Map die Seite gescrollt wird
	if(e.cancelable) { e.preventDefault(); } // DOM-Standard
	else if(window.event) { event.returnValue = false; } // IE

	if (!e) { e = window.event; } // Event-Objekt für IE

	if (e.detail) { // Firefox
		if (e.detail < 0) { map.zoomIn(null, null, true); }
		else { map.zoomOut( null, true); }
	}
	else if (e.wheelDelta) { // IE
		if (e.wheelDelta > 0) { map.zoomIn(null, null, true); }
		else { map.zoomOut( null, true); }
	}
}



function loadMap() {
	if (GBrowserIsCompatible()) {
		mapdiv = document.getElementById("map")
		map = new GMap2(mapdiv)

		map.addControl(new GSmallMapControl())
		map.addControl(new GMapTypeControl())
		map.setCenter(new GLatLng(47.781133, 9.60439), 15)

		var point = new GLatLng(47.781133, 9.60439)
		map.addOverlay(new GMarker(point))

		// Event-Listener registrieren über die Maps-API
		GEvent.addDomListener(mapdiv, "DOMMouseScroll", wheelZoom) // Firefox
		GEvent.addDomListener(mapdiv, "mousewheel", wheelZoom); // IE
		map.enableContinuousZoom()
	}
}


// END: Google Made Code



function init() {
	var url = location.href;

	// Should Google Map be started?
	if (url.lastIndexOf("info.html") != -1)
		loadMap()


	var j=0, class_name="xl", teststr
	var all_obj=document.getElementsByTagName("a")

	for(i=0; i<all_obj.length; i++)	{
		if(all_obj[i].className.indexOf(class_name)!=-1) {
			teststr=","+all_obj[i].className.split(" ").join(",")+","
			if(teststr.indexOf(","+class_name+",")!=-1) {
				all_obj[i].onclick= function() { window.open(this.href); return false; }
				j++
			}
		}
	}


}

function startRoll(style) {
	page_top = document.getElementById('boxtop')
	switch (style) {
		case 'cyan':	if (page_top) t1 = setInterval("rollPic()", 1260); break
		case 'silver':	if (page_top) t1 = setInterval("rollPic()", 1260); break
	}
}

function showWin(url, w, h) {
	var oWin = window.open(url, "myNewWin", "height="+h+",width="+w)
	return false
}

function showImg(pic) {
	var w,h
	if (pic.indexOf('/djz/')!=-1) {
		w=600
		h=355
	} else {
		w=640
		h=480
	}
	var oWin = window.open(pic, 'myNewWin', 'height='+h+',width='+w)
	return false
}

function showPic(pic) {
	var pWin = window.open('', "myNewWin", "height=480,width=640")
	// wrote content to window
	pWin.document.write('<html><head><title>Login</title></head>'+
		'<body style="color:#fff; background-color:#000; margin:0px; padding:0px;">'+
		'<img src="'+pic+'" /></body></html>')
	pWin.document.close()
	return false
}

// -----------  The Background Animation Stuff ----------

function rollPic() {
	if (x < 770) x+=150
	else x = 0
	page_top.style.backgroundPosition = x + "px " + y + "px "

}

// -------------------------  Help Function -----------------------
function xl(url) {
	window.open(url);
	return false;
}

onload=init
