// MSIE 6 wird mit MSXML3 ausgeliefert und unterstützt XSL komplett
// Opera-Nutzer, die sich als IE6 ausgeben, verstehen kein XSL, deshalb bleiben sie
// bei der Html-Darstellung



if ((document.URL == 'http://www.sql-und-xml.de/') || (document.URL == 'http://www.sql-und-xml.de/index.html'))
	{
		if ((navigator.userAgent.indexOf('MSIE 6') > -1) && (navigator.userAgent.indexOf('Opera') < 0))
			{location.replace('/xml/index.xml')}
	}


var img_normal = new Image();
var img_selected = new Image();
var u = location.pathname;

if ((u == '/server-daten/') || (u == '/server-daten/index.html')
	|| (u == '/xml/server-daten/index.xml'))
	{
	img_normal.src = '/images/server-daten-logo.gif';
	img_selected.src = '/images/server-daten-logo-selected.gif';
	}
// else { alert('nix'); }


/* Warnfenster */

function show_warning() {
	document.write('Achtung: 1&amp;1 hat seit 15.01.2007 massive Mailprobleme. Nutzen Sie bitte im Augenblick keine sql-und-xml.de-Mailadressen. Das Hauptangebot bei HostEurope funktioniert problemlos.');
}


/* Anpassung der Schriftgröße */

var def_value = ((navigator.userAgent.indexOf('MSIE ') > -1) && (navigator.userAgent.indexOf('Opera') < 0)) ? '85%' : '85%';
var size = 0;

function init_sizer() {
	if ( !document.getElementById ) return;
	if ( !document.getElementById('change-greater')) return;
	document.getElementById('change-greater').href='javascript:newSize(1.1);';
	document.getElementById('change-smaller').href='javascript:newSize(0.9);';
	document.getElementById('change-orig').href='javascript:newSize(1);';
	size = get_Cookie("fontSize");
	//alert("Gefunden: " + size);
	size = isNaN(parseInt(size)) ? parseInt(def_value) : parseInt(size);
	// alert(size);
	document.getElementsByTagName("body")[0].style.fontSize = size + '%';
	
}


function get_Cookie(cname) {
	cname = cname + '=';
	if (document.cookie) {
		var c_ar = document.cookie.split(';');
		for (var i=0; i < c_ar.length; i++) {
		    var c = c_ar[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		    if (c.indexOf(cname) == 0) return unescape( c.substring(cname.length, c.length) );
		}
	}
	// alert('Kein Cookie');
	return null;
}

function set_Cookie(cname, cvalue, path) {
	document.cookie = cname + '=' + escape(cvalue) + '; path=' + escape(path) + ';';
	// alert("Neu gesetzt: " + document.cookie);
}


function newSize(v) {
with (document.getElementById('mainBody')) {
	// alert(style.fontSize);
	if (v == 1) { size = def_value; }
	else { size = String(Math.floor(parseInt(style.fontSize)  * v)) + '%'; }

	style.fontSize = size;
	// alert(style.fontSize);
	}
set_Cookie( "fontSize", size, "/" );
}




function write_last_update() {
	/* das muß hier gemacht werden, da oben die Elemente noch fehlen */
	
	
	init_sizer();

	var h = location.href;
	h = h.substring(h.length - 4, h.length);
	if (h != 'html') { return; }
	
	var last = new Date(document.lastModified);
	var y = last.getYear();
	/* Netscape gibt 2000 mit Null aus */
	if (y < 10) { y = "200" + y}
	else {if (y < 100) { y = "20" + y}
		else {if (y < 1000) { y = "20" + (((y % 100) < 10) ? "0" : "") + (y % 100)}
		}
	}

	
	
	
	document.write("Letzte Aktualisierung: " + 
		((last.getDate() < 10) ? "0" : "") + last.getDate() + "." +
		((last.getMonth() < 9) ? "0" : "") + (last.getMonth() + 1) + "." +
		y + ", " +
		((last.getHours() < 10) ? "0" : "") + last.getHours() + ":" + 
		((last.getMinutes() < 10) ? "0" : "") + last.getMinutes());
}


function change_color(obj, current_type) {
	if (current_type == 'over') 
		{ obj.style.color = "#ff0000"; }
	else
		{ obj.style.color = "#ffffff"; }
}

function change_logo(obj, i) {
	// alert(obj.src);
	if (i == 1) 
		{obj.src = img_selected.src; }
	else
		{obj.src = img_normal.src; }
	
}

function color_selector(obj, text) {
// alert(obj.name);
// location=yes

	var _w = -250 + Math.ceil(screen.availWidth / 2);
	var _h = -400 + Math.ceil(screen.availHeight / 2);
	var _p = "height=600px,width=660px,status=yes,resizable=yes,top=" + _h.toString() + "px,left=" + _w.toString() + "px";

	f = window.open("/temp/select-color.html?o=" + obj.name + "&t=" + text, "colorSelector", _p);
	// alert(_p);

	f.focus();
}

/* Zwei Funktionen von server-daten.de/admin/sd.js */

function __write(href, form, _et, _v, _i) {
	var _a = document.getElementById(_et);
	if (_a.hasChildNodes()) { _a.removeChild(_a.firstChild);}
	_a.appendChild(document.createTextNode((_i > 0 ? String.fromCharCode(_i) : _v)));
	_a.href = '#';
}


function __sendIt(formName, eventTarget, href) {
	var theform;
	theform = document.forms[formName];

	theform.__fn.value = formName; // formName.split("$").join(":");
	theform.__et.value = eventTarget; // eventTarget.split("$").join(":");
	theform.submit(); return false;
}


function __insert_twitter() {

new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 4,
  interval: 30000,
  width: 'auto',
  height: 300,
  theme: {
    shell: {
      background: '#333333',
      color: '#ffffff'
    },
    tweets: {
      background: '#000000',
      color: '#ffffff',
      links: '#4aed05'
    }
  },
  features: {
    scrollbar: false,
    loop: false,
    live: true,
    behavior: 'all'
  }
}).render().setUser('JuergenAuer').start();

}
