var a_data_title = new Array();
var a_data_src = new Array();
var xxl_start = function(){
	if(document.getElementById){
if(document.getElementById("but1")){
	var node_bt1 = document.getElementById("but1");
	add_onclick_onmousedown(node_bt1, get_bt_url(node_bt1.src), 'in.php?id=9');
	
}
if(document.getElementById("but2")){
	var node_bt2 = document.getElementById("but2");
	add_onclick_onmousedown(node_bt2, get_bt_url(node_bt2.src), '');
	
}
if(document.getElementById("but3")){
	var node_bt3 = document.getElementById("but3");
	add_onclick_onmousedown(node_bt3, get_bt_url(node_bt3.src)+'telefonsex/', 'in.php?id=17');
	
}
if(document.getElementById("but4")){
	var node_bt4 = document.getElementById("but4");
	add_onclick_onmousedown(node_bt4, get_bt_url(node_bt4.src), 'in.php?id=2');
	
}
if(document.getElementById('toplist')){
	var toplist = document.getElementById('toplist').getElementsByTagName('A');
	for(var i=0; i!=toplist.length; i++)
		add_onclick_onmousedown(toplist[i], '', toplist[i].getAttribute('href')+'in.php?id='+toplist[i].getAttribute('name'));
	
	var toplist = document.getElementById('toplist').getElementsByTagName('LI');
	for(var i=0; i!=toplist.length; i++){
		if(toplist[i].className == 'lnk' && toplist[i].id == 'tvgbiz'){
			add_onclick_onmousedown(toplist[i], 'http://telefonsex.virtuagirl.biz/', 'in.php?id=133');
			
		}else if(toplist[i].className == 'lnk' && toplist[i].id == 'tsnccom'){
			add_onclick_onmousedown(toplist[i], 'http://telefon.sex-nummern.com/', 'in.php?id=5');
			
		}else if(toplist[i].className == 'lnk' && toplist[i].id == 'btwcom'){
			add_onclick_onmousedown(toplist[i], 'http://billiger.telefonsex-welt.com/', 'in.php?id=76');
			
		}else if(toplist[i].className == 'lnk' && toplist[i].id == 'btlorg'){
			add_onclick_onmousedown(toplist[i], 'http://billiger.telefonsex-live.org/', 'in.php?id=19');
		}
	}
}
var node = document.getElementById("s_kontakt");
node.onclick=function(){
	location.href='/contact.htm';
}
var node = document.getElementById("logo");
node.onclick=function(){
	location.href='/';
}
do_wio_add();

if(document.getElementById("xxlprev")) xxl_add_prev();

if(document.getElementById("iframe_xxl_cams"))
	innerHtml_reWrite('iframe_xxl_cams', '<li style="text-align: center;"><iframe frameborder="0" scrolling="No" src="http://www.xxl-livecams.net/xxl-ads.php?refid=24&cols=4&rows=1&bgcolor=transp" width="500" height="135"></iframe></li>');
}	}
window.onload=xxl_start;

function add_onclick_onmousedown(node_li, node_li_url, node_li_uid){
	if(node_li_uid != '')
		node_li.onmousedown=function(){
			return hit(node_li_url+node_li_uid);
		}
	if(node_li_url != '')
		node_li.onclick=function(){
			window.open(node_li_url);
		}
}

function do_wio_add(){
	var navRoot = document.getElementsByTagName("UL");
	for(var a=0; a<navRoot.length; a++){
		if(navRoot[a].className == "col3 prev"){// click + title @ LI wio cam prev
			for(var b=0; b<navRoot[a].childNodes.length; b++){
var node1 = navRoot[a].childNodes[b];
if(node1.nodeName == "LI" && node1.id != '' && node1.id != 'undefined'){
	var node1_1 = node1.getElementsByTagName("IMG");
	for(var c=0; c<node1_1.length; c++){
		a_data_title[node1.id] = node1_1[c].getAttribute("ALT");
		node1.setAttribute("TITLE", a_data_title[node1.id]);
	}
	var node1_2 = node1.getElementsByTagName("A");
	for(var c=0; c<node1_2.length; c++){
		a_data_src[node1.id] = node1_2[c].getAttribute("HREF");
		node1.onclick=function(){
			location.href=a_data_src[this.id];
		}
	}
}
			}
		}else if(navRoot[a].className == "col3 info pageindex"){
			for(var b=0; b<navRoot[a].childNodes.length; b++){
var node1 = navRoot[a].childNodes[b];
if(node1.nodeName == "LI" && node1.id != '' && node1.id != 'undefined'){
	var node1_1 = node1.getElementsByTagName("H3");
	a_data_title[node1.id] = node1_1[0].firstChild.data;
	node1.setAttribute("TITLE", a_data_title[node1.id]);
	
	var node1_2 = node1.getElementsByTagName("A");
	for(var c=0; c<node1_2.length; c++){
		a_data_src[node1.id] = node1_2[c].getAttribute("HREF");
		node1.onclick=function(){
			location.href=a_data_src[this.id];
		}
	}
}
			}
		}
	}
}


function xxl_add_prev(c){
	innerHtml_reWrite('xxlprev', read_file('sbr_prev.php?limit='+sbr_anz_prev));
}

function read_file(fileUrl){
    var req;
    var fileContent;
    if(window.XMLHttpRequest){
        req = new XMLHttpRequest();
        req.open("GET", fileUrl, false);
        req.send(null);
        fileContent = req.responseText;
    }else if (window.ActiveXObject){
        req = new ActiveXObject("Microsoft.XMLHTTP");
        req.open("GET", fileUrl, false);
        req.onreadystatechange=function(){
			if(req.readyState == 4){
				fileContent = req.responseText;
			}
		}
        req.send(null);
    }
	return fileContent;
}

function innerHtml_reWrite(name, content){
	if(document.getElementById){
		document.getElementById(name).innerHTML = content;
	}else if(document.getElementById){
		var over = document.getElementById(''+name);
		var range = self.document.createRange();
		range.setStartBefore(over);
		var domfrag = range.createContextualFragment(content);
		while(over.hasChildNodes()){over.removeChild(over.lastChild);}
		over.appendChild(domfrag);
	}
}

function get_bt_url(url){ return url.substr(0, url.indexOf('/', 7))+'/'; }

function hit(hitlink){
	if(document.images){ (new Image()).src=''+hitlink+''; }
	return true;
}