function XMLHttp() {
    if(window.XMLHttpRequest) {
    	try { req = new XMLHttpRequest(); }
		catch(e) { req = false; }
    }
	else if(window.ActiveXObject) {
       	try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch(e) {
        	try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch(e) { req = false; }
		}
	}
	return req;
}
function CallInProgress(xmlHttp){
	if(xmlHttp) {
		switch (xmlHttp.readyState) {
			case 1:
			case 2:
			case 3: return true;
			default: return false;
		}
	} else { return false; }
}
var httpRank = XMLHttp();
function ranked(){
	if (httpRank && !CallInProgress(httpRank)) {
		//httpUser.abort();
		httpRank.open('GET', '/ranked.php', true);
		httpRank.onreadystatechange = function () {
			if (httpRank.readyState == 4) {
				if (httpRank.status == 200 || httpRank.status == 0){
					document.getElementById("ranked").innerHTML = httpRank.responseText;
				}
			}
		};
		httpRank.send(null);
	}
}

function s(w){
	window.status = w;
	imgtool(w);
	return true;
}
function c(){
	window.status='';
	remove();
}
function popup_radio(){
  screenbreite = screen.width;
  screenhoehe = screen.height;
  width = 370;
  height = 600;
  bildbreite = width + 20;
  bildhoehe = height + 25;
  xoffset = (screenbreite - width);
  yoffset = (0);
  fenster = window.open('http://www.adaio.de/radio',"RADIO","width=" + width +",height=" + height +",toolbar=no,location=no,directories=no,status =no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=" + xoffset + ",top=" + yoffset)
}

var mouseX = 0, mouseY = 0;       // beinhalten später die Position des Mauszeigers
var xMargin = 10, yMargin = 10;   // zusätzlicher Abstand zum Mauszeiger
var ttipDisplayed = false;        // Statusvariable, nicht ändern
var ttipgDisplayed = false;        // Statusvariable, nicht ändern
var elem = document.getElementById ('img_tool');
var h;
// Event-Handler, speichert ständig die aktuelle Position der Mauszeigers
function saveMouseCoords (e){
	if(ttipDisplayed)
		move();
	if(ttipgDisplayed)
		moveg();
	if (window.Event){   // Netscape
		mouseX = e.pageX;
		mouseY = e.pageY;
	}
	else{    // MSIE
		mouseX = window.event.clientX;
		mouseY = window.event.clientY;
	}
}
function imgtool(url){
	path = "http://www.adaio.de/cache/?url=";
	img = '<img src="'+path+url+'" id="image" class="img" />';
	ttipDisplayed = true;
}
function move(){
	elem = document.getElementById('img_tool');
	elem.innerHTML      = img;
	elem.style.left     = (mouseX+15) + "px";
	elem.style.top      = (mouseY-310) + "px";
	elem.style.position = 'absolute';
	elem.style.display  = "block";
	elem.style.zIndex   = 4;
}
function remove(){
	ttipDisplayed = false;
	ttipgDisplayed = false;
	elem.style.display  = "none";
}
//if (document.captureEvents)
//	document.captureEvents(Event.MOUSEMOVE);

//document.onmousemove = saveMouseCoords;


function checkedBoxes(state){
    var checkboxes=document.getElementsByName('id[]');
    for(var n=0;n<checkboxes.length;n++){
        checkboxes[n].checked=state;
    }
		var checkall=document.getElementsByName('checkall[]');
		checkall[0].checked=state;
		checkall[1].checked=state;
}

window.google_analytics_uacct = "UA-7145732-1";



// SLIDER
window.addEvent('domready', function(){
	// First Example
	var el = $('myElement'),trprt = $('trprt'),bgcolor = [0, 0, 0],color = [0, 0, 0];

	var updateColor = function(){
		// Sets the color of the output text and its text to the current color
		trprt.setStyle('background-color', bgcolor).setStyle('color', color);
	};
	// Create the new slider instance
	new Slider(el, el.getElement('.knob'), {
		steps: 127,	// There are 35 steps
		wheel: true,	// Minimum value is 8
		start: 50,
		onChange: function(){
			// Everytime the value changes, we change the font of an element
			trprt.value = this.step;
			bgcolor[0] = this.step*2;
			bgcolor[1] = this.step*2;
			bgcolor[2] = this.step*2;
			color[0]   = 255-this.step*2;
			color[1]   = 255-this.step*2;
			color[2]   = 255-this.step*2;
				// and update the output to the new value
			updateColor();
		}
	}).set(trprt.value);
});