//Contentpreload
function WaitBox()
{
  document.writeln("<div class=\"preloader\" id=\"preload\" style=\"left: 45%;position: absolute; top: 50%\" align=\"center\">");
  document.writeln("  <table cellpadding=\"6\">");
  document.writeln("    <tbody>");
  document.writeln("      <tr>");
  document.writeln("        <td align=\"center\"><span class=\"fontBold\">Preloading site</span>");
  document.writeln("<br><img src=\"../inc/images/loading.gif\" alt=\"\">");
  document.writeln("<br clear=\"all\"><span class=\"fontBold\">please wait</span></td>");
  document.writeln("      </tr>");
  document.writeln("    </tbody>");
  document.writeln("  </table>");
  document.writeln("</div>");
}
function preload()
{
  document.getElementById('preload').style.display='none';
}
//Submitbutton disablen
function sendMe(what,myform) {
  document.forms[myform].send.value=what;
  document.forms[myform].send.disabled=true;
}
//IMGcode einfuegen (-> Taktiken
function insertIMG(textfield,selectfield)
{
  var dSel = document.getElementById(selectfield);
  var d = document.getElementById(textfield);
  var taktik = dSel.options[dSel.selectedIndex].value;

  if(taktik != 'lazy')
  {
    d.value = d.value + ' [taktik]' + taktik + '[/taktik] ';
  }
}
// automatisches selectfield
function temp_switch(){
var URL = document.form.tempswitch.options[document.form.tempswitch.selectedIndex].value;
window.location.href = URL}
// automatisches selectfield
function Goto(){
var URL = document.formChange.changeme.options[document.formChange.changeme.selectedIndex].value;
window.location.href = URL}
//Länge bei Texteingaben
function maxlength(field, countfield, max) {
	if (field.value.length > max)
	field.value = field.value.substring(0, max);
	else
	countfield.value = max - field.value.length;
}
//TSViewer
function vMenu( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = selectColor;
				tableCellRef.style.Color = '#000000';
				tableCellRef.style.height = '14';							
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = unselectColor;
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
				}
		}
	}
}

function swindow()
{
window.open("joinus.php","Join Us","toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=360")
}

//Popup
function popup(vars)
    {
      var object="../popup.php?"+vars;
      window.open(object,"PopUp","width=1,height=1,location=0,scrollbars =no,resizable=1,status=no");  
    } 
//Klapptext
function more(id)
{
  if (document.getElementById("more" + id).style.display == 'none')    
  {        
  		document.getElementById("img" + id).src = "../inc/images/collapse.gif";
  		document.getElementById("more" + id).style.display = "";        
  		} else {        
  		document.getElementById("img" + id).src = "../inc/images/expand.gif";        
  		document.getElementById("more" + id).style.display = "none";        
  		}
}
//Klapptext #2
function showme()
{
  if(document.getElementById("showme").style.display == 'none')    
  {        
  	document.getElementById("showme").style.display = "";        
  } else {          
  	document.getElementById("showme").style.display = "none";        
 	}
}
//BBcode einfuegen
function bbcode(fkt, taga, tage, tagm, desc1, desc2, textfield)
{
var value = document.formular[textfield].value;
 if(fkt == 1)
 {  
    var text1 = prompt(desc1);
    if(tagm)
    {
      var text2 = prompt(desc2);
    }
 } else if(fkt == 2)
 {
    var text1 = prompt(desc1);
    if(tagm)
    {
      alert(desc2);
      var text2 = "";
    }
 }
 document.formular[textfield].focus();
 if(tagm)
 {
   document.formular[textfield].value = value + taga + text1 + tagm + text2 + tage;
 } else {
   document.formular[textfield].value = value + taga + text1 + tage;
 }  
 
 if(fkt == 3)
 {
   if(desc1)
   {
     alert(desc1);
   }
  document.formular[textfield].focus();
  document.formular[textfield].value = value += taga + tage;

 }
document.formular[textfield].focus();
} 

//Popupfenster erzeugen
var win = null;
function w(url,name,w,h,scroll)
{
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
  win = window.open(url,name,settings)
  if(win.window.focus)
  {
    win.window.focus();
  }
}
nereidFadeObjects = new Object(); 
nereidFadeTimers = new Object(); 
//Ein-/Ausblenden von textfelder values
function nereidFade(object, destOp, rate, delta) 
{ 
  if (!document.all) 
  return 
  if (object != "[object]") 
  { 
    setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0); 
    return; 
  } 
  
  clearTimeout(nereidFadeTimers[object.sourceIndex]); 
  diff = destOp-object.filters.alpha.opacity; 
  direction = 1; 
  
  if (object.filters.alpha.opacity > destOp) 
  { 
    direction = -1; 
  } 
  delta=Math.min(direction*diff,delta); 
  object.filters.alpha.opacity+=direction*delta; 
  
  if (object.filters.alpha.opacity != destOp) 
  { 
    nereidFadeObjects[object.sourceIndex]=object; 
    nereidFadeTimers[object.sourceIndex] = setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); 
  } 
} 
