function cal(f)
{
	//alert(document.form1.zivistart3.value);
//	alert(f+"1");
//	alert();
	window.open("cal.php?field="+ f + "&akttag=" +  Math.abs(document.getElementsByName(f+"1")[0].value) + "&aktmonat=" + Math.abs(document.getElementsByName(f+"2")[0].value) + "&aktjahr=" +  Math.abs(document.getElementsByName(f+"3")[0].value),"picdb","width=200,height=170");
	document.getElementsByName(f)[1].checked=true;
}
function foto(f)
{
	
	window.open("pic.php?fotourl=" +  f,"f","width=650,height=500");
	
}
function erklaerung(word)
{
	
	window.open("fwords.php?word=" + word,"erklaerung","width=350,height=200");
	
}
function upload()
{
	//alert(document.form1.zivistart3.value);
//	alert(f+"1");
//	alert();
	window.open("upload.php","upload","width=400,height=400");
}
function addurl()
{
	url = prompt("Gib die URL des Link ein (zB www.ziviblog.at)","http://");
	//alt = prompt("Gib den Titel des Link ein (zB Zivildienst Homepage) Falls leer wird hier die URL angezeigt");
	
	//if(!alt)	alt=url;
	
		if(url.indexOf('http://')==-1)	url = 'http://' + url;
	
	document.form1.text.value = document.form1.text.value + "[url]" + url + "[/url]";
	document.form1.text.focus();
}
function mail(e)
{
	window.open("mail.php" ,"mail","width=370,height=360");
}
function tell(what)
{
	document.all.pic.src = what;
	document.f.picurl.value=what;
	
}

function format(beschr, code)
{
val = prompt("Gib den Text ein der " + beschr + " erscheinen soll!");

if(val) {
	if(code=='url'){	
		if(val.indexOf('http://')==-1)	val = 'http://' + val;
	}
	
	if(code=='[[')		code1=']]';
	else if(code=='[url]')code1='[/url]';
	else			code1=code;
	

	document.form1.text.value = document.form1.text.value + "[" + code + "]" + val + "[/" + code + "]";
	document.form1.text.focus();
}
}

function pic(beschr, code)
{
val = prompt("Gib den Text ein der " + beschr + " erscheinen soll!");
if(val) {
	document.f.text.value = document.f.text.value + code + val + code;
}
}

function checkchar(was, anzeige, maximum)
{
	
	
	if (was.value.length > maximum)
	{
		anzeige.value = "0 Zeichen übrig";
		was.value = was.value.substring(0,maximum);
		return false;
	}
	else
	{
		anzeige.value = (maximum - was.value.length) + " Zeichen übrig";
		if(was.value.length>=(0.9*maximum))
			anzeige.style.color="red";
		else
			anzeige.style.color="black";
			
		return true;
		
	}
}

function ask2()
{
	
	if (confirm("Willst du die markierten Nachrichten wirklich löschen?"))
	{
	
		return true;
		
		
	}
	return false;
	
}

function ask(url)
{
	
	if (confirm("Willst du diesen Eintrag wirklich löschen?"))
	{
	
		location.href=url;
	}
	
}
function navgo()
{
	if(document.nav.navfac.value>-1)
		document.nav.submit();
}

function tb()
{
var vorw = Array();
$vorwahlen = Array("43650","43660","43664","43676","43699");
vorw["43650"] = 0;
vorw["43660"] = 1;
vorw["43664"] = 2;
vorw["43676"] = 3;
vorw["43699"] = 4;
var nummer = document.f.telbuch.options[document.f.telbuch.selectedIndex].value;
document.f.sms_nummer.value = nummer.substring(5,nummer.length);
document.f.sms_vorw.selectedIndex = vorw[nummer.substring(0,5)];



}

function faccheck(what)
{
	
	if(what.value==-1)	{
		document.form1.facname.style.height=20;
		document.form1.facname.style.width=300;
				
	}
	else {
		document.form1.facname.style.height=0;
		document.form1.facname.style.width=0;

				
	}

}
function startanim()
{
document.upload_anim.style.height=50;
document.upload_anim.style.width=300;
}
function stopanim()
{
document.upload_anim.style.height=0;
document.upload_anim.style.width=0;
}

function selall()
{
	f = document.outbox;
	
	for (i=0; i < f.elements.length; i++) {
		if (f.elements[i].type == "checkbox" && f.elements[i].name != "checkall") {
				if (f.elements["checkall"].checked == true) {
					f.elements[i].checked = true;
				}
				else 
					f.elements[i].checked = false;
		}
	}
	
}

function anim_send(){
	freesms = document.getElementById("freesms");
	
	freesms.innerText="";
	freesms.innerHTML="<img src=\"images/anim_send.gif\">";
	document.sms_img.style.height=18;
	document.sms_img.style.width=94;

}