var myAgent   = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);
var is_ie   = ((myAgent.indexOf("msie") != -1)  && (myAgent.indexOf("opera") == -1));
var is_nav  = ((myAgent.indexOf('mozilla')!=-1) && (myAgent.indexOf('spoofer')==-1)
                && (myAgent.indexOf('compatible') == -1) && (myAgent.indexOf('opera')==-1)
                && (myAgent.indexOf('webtv') ==-1)       && (myAgent.indexOf('hotjava')==-1));

var is_win   =  ((myAgent.indexOf("win")!=-1) || (myAgent.indexOf("16bit")!=-1));
var is_mac    = (myAgent.indexOf("mac")!=-1);

function delete_content(theURL) {
   if (confirm('Wirklich löschen?')) {
      window.location.href=theURL;
   }
}

function ShowWarsContent(id) {
	if (document.getElementById("Content" + id).style.display == "none") {
		document.getElementById("ContentImg" + id).src = "images/poppei-clan/buttons/wars.gif";
		document.getElementById("Content" + id).style.display = "";
	}else {
		document.getElementById("ContentImg" + id).src = "images/poppei-clan/buttons/wars.gif";
		document.getElementById("Content" + id).style.display = "none";
	}
}

function ShowContent(id) {
	if (document.getElementById("Content" + id).style.display == "none") {
		document.getElementById("Content" + id).style.display = "";
	}else {
		document.getElementById("Content" + id).style.display = "none";
	}
}

function ShowContentMember(id) {
	if (document.getElementById("Content" + id).style.display == "none") {
		document.getElementById("Img" + id).src = "system/images/icons/minus.gif";
		document.getElementById("Content" + id).style.display = "";
	}else {
		document.getElementById("Img" + id).src = "system/images/icons/plus.gif";
		document.getElementById("Content" + id).style.display = "none";
	}
}

function HideContent(id) {
	if (document.getElementById("Content" + id).style.display == "") {
		document.getElementById("Content" + id).style.display = "none";
	}else {
		document.getElementById("Content" + id).style.display = "";
	}
}

function ShowStatsContent(id) {
	if (document.getElementById("Content" + id).style.display == "none") {
		document.getElementById("ContentImg" + id).src = "images/poppei-clan/buttons/statistics.gif";
		document.getElementById("Content" + id).style.display = "";
	}else {
		document.getElementById("ContentImg" + id).src = "images/poppei-clan/buttons/statistics.gif";
		document.getElementById("Content" + id).style.display = "none";
	}
}


function emoticon(theSmilie) {
	doInsert(" " + theSmilie + " ", "", false);
}

function doInsert(ibTag, ibClsTag, isSingle) {
	var isClose = false;
	var obj_ta = document.REPLIER.kommentar;

	if ( (myVersion >= 4) && is_ie && is_win) {
		if(obj_ta.isTextEdit){ 
			obj_ta.focus();
			var sel = document.selection;
			var rng = sel.createRange();
			rng.colapse;
			if((sel.type == "Text" || sel.type == "None") && rng != null){
				if(ibClsTag != "" && rng.text.length > 0)
					ibTag += rng.text + ibClsTag;
				else if(isSingle)
					isClose = true;
	
				rng.text = ibTag;
			}
		}else {
			if(isSingle)
				isClose = true;
	
			obj_ta.value += ibTag;
		}
	}else {
		if(isSingle)
			isClose = true;

		obj_ta.value += ibTag;
	}
	obj_ta.focus();
	return isClose;
}	

var text = 'www.Poppei-Clan.de - deutscher siglegaming Clan - Counter-Strike:Source -';
var zaehler = 0;
var inter = window.setInterval('anzeigen()',100);
var richtung = -1; //alt.: -1

function links_rechts(){ richtung = 1; }
function rechts_links(){ richtung = -1; }

function anzeigen(){
	zaehler = zaehler+richtung;
	if(zaehler < 0){zaehler = text.length+100;}
	if(zaehler > 200+text.length){zaehler = 0}
	
	if(zaehler <= text.length)
	{ res = text.substr(text.length-zaehler,zaehler); }
	else
	{
	res = text;
	for(i=text.length; i<= zaehler; i++){ res = ' '+res; }
	}
	
	res = res.substr(0,100)
	window.status = res;
}
