function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

function checkAll()
{
	for (i=0;i<document.mail.length;i++)
	{
		if (document.mail.elements[i].type=='checkbox'){
			if (document.mail.elements[i].checked==true){
				document.mail.elements[i].checked=false;

			}else{
				document.mail.elements[i].checked=true;
			}
		}
	}
}

function showImageBrowser(){
	if(Element.visible( 'imageBrowser' )){
		Effect.BlindUp('imageBrowser');
	}else{
		Effect.BlindDown('imageBrowser',{duration: 0.4, afterFinish: elementContent('imageBrowser','/?service=gallery&action=imageBrowser')});
	}
}

function elementContent(element,url){
		new Ajax.Updater(element, url, {asynchronous:true, evalScripts:true});
	}
	
	function setInputValue(sFormName, sFieldName, sFieldValue){
		document.forms[sFormName].elements[sFieldName].value = sFieldValue ;
	}
	
	function setImage(sImageUrl, sImageId){
		Element.update('imageContainer', '<img src="' + sImageUrl + '">');
		setInputValue('createDiary', 'galleryImageId', sImageId) ;
		setInputValue('createDiary', 'galleryImageUrl', sImageUrl) ;
	}
	
	function removeImage(sImageUrl, sImageId){
		Element.update('imageContainer', '');
		setInputValue('createDiary', 'galleryImageId', '0') ;
		setInputValue('createDiary', 'galleryImageUrl', '') ;
	}


function showImageOfTheWeek(){
	Effect.BlindUp('imageOfTheWeek',{delay: 3});
}

function hideUploadStatus(){
	Effect.BlindUp('uploadStatusOk',{delay: 3});
}

function skovel() {
open("/media/program/baskovel.html" , "skovel" , 
"toolbar=no,height=390,width=395,resizable=0,menubar=no,location=no,status=no");
}
function stang() {
open("/media/program/bastang.html" , "stang" , 
"toolbar=no,height=390,width=415,resizable=0,menubar=no,location=no,status=no");
}
function radjur() {
open("/media/program/bradjur.html" , "radjur" , 
"toolbar=no,height=470,width=480,resizable=0,menubar=no,location=no,status=no");
}
function radjur2() {
open("/media/program/bradjur2.html" , "radjur2" , 
"toolbar=no,height=470,width=480,resizable=0,menubar=no,location=no,status=no");
}
function omvandlare() {
open("/media/program/omvandlare.html" , "omvandlare" , 
"toolbar=no,height=430,width=360,resizable=0,menubar=no,location=no,status=no");
}
function maxtrim() {
open("/media/program/maxtrim.html" , "maxtrim" , 
"toolbar=no,height=210,width=320,resizable=0,menubar=no,location=no,status=no");
}
function jaktstatistikAll(userId) {
open("/?service=bok&action=showAll&userId="+userId+"" , "skovel" ,
"toolbar=no,height=700,width=730,resizable=0,menubar=no,location=no,status=no,scrollbars=yes");
}
