// JavaScript Document
//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use  
function czy(msg, url) { //v1.0
  if(confirm(msg)) location.replace(url);
}

var baseopacity=75

function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",50)
}

function slowlow(which2){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}


	var activ;
	if(! activ) activ=2;
	var act = 0;
	
function getact(){
	var a
	for(a=1; ! act; a++){
		menuid="menu"+a;
		if(document.getElementById(menuid).className == "on") act=a;
	}
}


function nowe(url) {
window.open(url);
}	
function upmenuclick(id) {
 if(activ != id){
 	 
	
	 document.getElementById("upmenu"+id).style.background = "url(/images3/upmenu.jpg)";
	 document.getElementById("upmenu"+activ).style.background = "#556270";
	 document.getElementById("upmenu"+id).style.color = "#556270";
	 document.getElementById("upmenu"+activ).style.color = "#FFFFFF";
	  document.getElementById("add"+activ).style.display = "none";
	 document.getElementById("add"+id).style.display = "block";
	
	  	  activ = id;
 
 }
}

function menuover(id) {
	if(!act) getact();
	if(act != id)
	{    document.getElementById("menu"+id).style.background = "url(/images3/menu2.jpg)";
		 document.getElementById("menu"+act).style.background = "url(/images3/menu0.jpg)";
		 
		 document.getElementById("przer"+act).style.background = "url(/images3/menu0.jpg)";
		 document.getElementById("przer"+(act+1)).style.background = "url(/images3/menu0.jpg)";
		 
		 document.getElementById("przer"+id).style.background = "url(/images3/menu1.jpg)";
		 document.getElementById("przer"+(id+1)).style.background = "url(/images3/menu3.jpg)";
    	 
		 document.getElementById("menu"+id).style.color = "#5177c2";
		 document.getElementById("menu"+act).style.color = "#556270";
	}
}
function menuout(id) {
	if(act != id)
	{    document.getElementById("menu"+id).style.background = "url(/images3/menu0.jpg)";
		 document.getElementById("menu"+act).style.background = "url(/images3/menu2.jpg)";
		 document.getElementById("przer"+id).style.background = "url(/images3/menu0.jpg)";
		 document.getElementById("przer"+(id+1)).style.background = "url(/images3/menu0.jpg)";
		 
		 document.getElementById("przer"+act).style.background = "url(/images3/menu1.jpg)";
		 document.getElementById("przer"+(act+1)).style.background = "url(/images3/menu3.jpg)";
		 
		 document.getElementById("menu"+id).style.color = "#556270";
		 document.getElementById("menu"+act).style.color = "#5177c2";
    }
}
function menuclick(id) {
 if(act != id) act = id;
	  
 }

var newsact;
	if(! newsact) newsact=1;

function newsclick(id) {
 if(newsact != id){
 	 
	
	 document.getElementById("newsmenu"+id).style.background = "url(/images3/newsmenu2.jpg)";
	 document.getElementById("newsmenu"+newsact).style.background = "url(/images3/newsmenu3.jpg)";
	 document.getElementById("newsmenu"+id).style.color = "#5177c2";
	 document.getElementById("newsmenu"+newsact).style.color = "#556270";
	  document.getElementById("news"+newsact).style.display = "none";
	 document.getElementById("news"+id).style.display = "block";
	
	  	  newsact = id;
 
 }
}
function nic() {
}

// speichert den text im message feld
function AddText(addtext) {
	var current = document.post.message.value;
	var newtext = current + addtext;
	document.post.message.value = newtext;
	document.post.message.focus();
}

// fügt den [IMG] tag hinzu
function AddImg() {
	inserttext = prompt("Enter the URL to the Image:" + "\n[IMG]xxx[/IMG]", "http://");
	if ((inserttext != "http://") && (inserttext != "") && (inserttext != null)) addtext = " [IMG]" + inserttext + "[/IMG] ";
	else addtext="";
	
	AddText(addtext);
}

// fügt [URL] oder [EMAIL] ein
function AddLink(thetype) {
	linktext = prompt("Enter a Linkname (optional)", "");
	var prompttext;
	if (thetype == "URL") linkurl = prompt("Enter the URL", "http://");
	else linkurl = prompt("Enter the E-Mail Address", "");
	
	if ((linkurl != "http://") && (linkurl != "") && (linkurl != null)) {
		if ((linktext != null) && (linktext != "")) {
			addtext = " [" + thetype + "=" + linkurl + "]" + linktext + "[/" + thetype + "] ";
		}
		else {
			addtext = " [" + thetype + "]" + linkurl + "[/" + thetype + "] ";
		}
	}
	else addtext = "";
	
	AddText(addtext);
}

// fügt eine HTML-Liste ein
function AddList() {
	type = prompt("enter '1' for a numbered List, 'a' for an alphabetic List or '' for a pointed List", "");
	if ((type == "a") || (type == "1")) {
		list = " [LIST=" + type + "]\n";
		listend = "[/LIST=" + type + "] ";
	}
	else {
		list = " [LIST]\n";
		listend = "[/LIST] ";
	}
	entry = "start";
	while ((entry != "") && (entry != null)) {
		entry = prompt("Enter a List-Point. Enter nothing or click 'Cancel' to finish the list.", "");
		if ((entry != "") && (entry != null))
			list = list + "[*]" + entry + "[/*]\n";
	}
	addtext = list + listend;
	
	AddText(addtext);
}

// fügt code eines andern fensters ein
function AddCodeFromWindow(thecode) { 
	opener.document.post.message.value += thecode + " ";
	opener.post.message.focus();
}

// fügt den [B] tag hinzu
function AddB() {
	inserttext = prompt("\n[B]xxx[/B]");
	if ((inserttext != null)) addtext = " [B]" + inserttext + "[/B] ";
	else addtext="";
	
	AddText(addtext);
}

// fügt den [U] tag hinzu
function AddU() {
	inserttext = prompt("\n[U]xxx[/U]");
	if ((inserttext != null)) addtext = " [U]" + inserttext + "[/U] ";
	else addtext="";
	
	AddText(addtext);
}

// fügt den [I] tag hinzu
function AddI() {
	inserttext = prompt("\n[I]xxx[/I]");
	if ((inserttext != null)) addtext = " [I]" + inserttext + "[/I] ";
	else addtext="";
	
	AddText(addtext);
}

// fügt den [quote] tag hinzu
function AddQuote() {
	inserttext = prompt("\n[QUOTE]xxx[/QUOTE]");
	if ((inserttext != null)) addtext = " [quote]" + inserttext + "[/quote] ";
	else addtext="";
	
	AddText(addtext);
}

// fügt den [quote] tag hinzu
function AddCodetag() {
	inserttext = prompt("\n[CODE]xxx[/CODE]");
	if ((inserttext != null)) addtext = " [code]" + inserttext + "[/code] ";
	else addtext="";
	
	AddText(addtext);
}

// fügt den [Toggle] tag hinzu
function AddToggle() {
	inserttext = prompt("Enter toggle name:" + "\n[toggle=xxx][/toggle]");
		inserttext1 = prompt("Enter text:" + "\nxxxx");
	if ((inserttext != "") && (inserttext1 != "") && (inserttext != null) && (inserttext1 != null)) addtext = " [toggle="+inserttext+"]" + inserttext1 + "[/toggle] ";
	else addtext="";
	
	AddText(addtext);
}

//no comment ;)

function AddCode(thecode) {
	AddText(thecode);
}

// toggle funktion - read more
function Toggle(id) {

  spanid1 = "ToggleRow_"+id;
  spanid2 = "ToggleImg_"+id;
  val = document.getElementById(spanid1).style.display;
  if (val == "none")
  {
    document.getElementById(spanid1).style.display = "block";
    document.getElementById(spanid2).src = "/images/icons/collapse.gif";
    document.getElementById(spanid2).alt = "read more";
  }
  else
  {
    document.getElementById(spanid1).style.display = "none";
    document.getElementById(spanid2).src = "/images/icons/expand.gif"
    document.getElementById(spanid2).alt = "hide";
  }
}





// function addRow() ** this adds a new row to the table, containing mapname, mapresult_home, mapresult_opponent
function addRow(action)
{
	var theAction = action;
  var table = document.getElementById('maplist');
  var theRows = table.rows.length;
  var inkrement = theRows;
  var row = table.insertRow(theRows);
	
	// gibt nen text wie "map #1" aus
	var cell0 = row.insertCell(0);
	var textNode = document.createTextNode('map #' + inkrement);
	if(theAction=='edit') {
		var ele0 = document.createElement('input');
			ele0.setAttribute('type', 'hidden');
			ele0.setAttribute('name', 'map_id[]');
			ele0.setAttribute('value', inkrement);
		cell0.appendChild(ele0);
	}
	cell0.appendChild(textNode);
	// mapname
  var cell1 = row.insertCell(1);
  var ele1 = document.createElement('input');
		ele1.setAttribute('type', 'text');
		ele1.setAttribute('name', 'map_name[]');
		ele1.setAttribute('id', 'map_name_' + inkrement);
		ele1.setAttribute('size', '35');
		ele1.className='form_off';
  cell1.appendChild(ele1);
	// results: home
  var cell2 = row.insertCell(2);
  var ele2 = document.createElement('input');
		ele2.setAttribute('type', 'text');
		ele2.setAttribute('name', 'map_result_home[]');
		ele2.setAttribute('id', 'map_result_home_' + inkrement);
		ele2.setAttribute('size', '3');
		ele2.className='form_off';
	cell2.appendChild(ele2);
	// results: opponent
	var cell3 = row.insertCell(3);
	var ele3 = document.createElement('input');
		ele3.setAttribute('type', 'text');
		ele3.setAttribute('name', 'map_result_opp[]');
		ele3.setAttribute('id', 'map_result_opp_' + inkrement);
		ele3.setAttribute('size', '3');
		ele3.className='form_off';
	cell3.appendChild(ele3);
	// create delete-selection for edit-function
	if(theAction=='edit') {
		var cell4 = row.insertCell(4);
		var ele4 = document.createElement('input');
			ele4.setAttribute('type', 'checkbox');
			ele4.setAttribute('name', 'delete[]');
			ele4.setAttribute('value', inkrement);
			ele4.className='form_off';
		cell4.appendChild(ele4);
	} else {
		var cell4 = row.insertCell(4);
	}
}

// function removeRow() ** removes the last row of a table
function removeRow()
{
  var table = document.getElementById('maplist');
  var theRows = table.rows.length;
  if (theRows != 1) table.deleteRow(theRows - 1);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function MM_confirm(msg, url) { //v1.0
  if(confirm(msg)) location.replace(url);
}

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function SelectAll() {
	for(var x=0;x<document.form.elements.length;x++) {
		var y=document.form.elements[x];
		if(y.name!='ALL') y.checked=document.form.ALL.checked;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function messageconfirm(messages) {
        if(confirm("You have "+messages+" new message(s). Do you want to read them now?"))
          document.location.href="index.php?site=messenger";
}