
var afdelinger = new Array(5);
afd1 = new Image();
afd1.src = afdelinger[0] = 'img/pic_koge_thumb.jpg';
afd2 = new Image();
afd2.src = afdelinger[1] = 'img/pic_hundige_thumb.jpg';
afd3 = new Image();
afd3.src = afdelinger[2] = 'img/pic_roskilde_thumb.jpg';
afd4 = new Image();
afd4.src = afdelinger[3] = 'img/pic_lyngby_thumb.jpg';
afd5 = new Image();
afd5.src = afdelinger[4] = 'img/pic_osterbro_thumb.jpg';

ie = document.all&&navigator.userAgent.indexOf("Opera")==-1;

function fadein(e,picno) {
	if (ie) {
		e.style.background = 'url('+afdelinger[picno-1]+')';
		e.firstChild.childNodes[1].style.display = 'none';
		e.firstChild.childNodes[3].style.display = 'none';
		e.firstChild.childNodes[2].style.display = 'none';
		e.style.cursor = 'pointer';
		e.style.cursor = 'hand';
		e.style.filter = 'alpha(opacity:65)';
		// if picno == 1
		if (picno == 3) e.className = 'BORDER_IMG_V1';
		else e.className = 'BORDER_IMG_V2';
	}
}

function fadeout(e) {
	if (ie) {
		e.style.background = '';
		e.firstChild.childNodes[1].style.display = '';
		e.firstChild.childNodes[3].style.display = '';
		e.firstChild.childNodes[2].style.display = '';
		e.style.filter = 'alpha(opacity:100)';
		e.className = '';	
	}
}

function popupWin(url,w,h) {
	if (!h) {
		h=500;
		w=400;
	}
	winID = window.open(url,"askPopupWin","toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=" + w + ",height=" + h + ",left = 20,top = 20");
	winID.focus();	
}

function resetForm(theForm) {
	for (i=0; i < theForm.elements.length; i++) {
		if (theForm.elements[i].type == 'text' || theForm.elements[i].type == 'textarea')
			theForm.elements[i].value = '';
		if (theForm.elements[i].tagName == 'SELECT')
			theForm.elements[i].selectedIndex = 0;
		if (theForm.elements[i].value == 'Opdater' || theForm.elements[i].value == 'Slet')
			theForm.elements[i].disabled = true;
		if (theForm.elements[i].value == 'Opret')
			theForm.elements[i].disabled = false;
	}
	showAllInput();
}

function hideInput(selIndex) {
	showAllInput();
	// Brugt maskine eller bøger
	if (selIndex == "2" || selIndex == "4") {
		document.getElementById('lev').style.display = 'none';
	} else {
		document.getElementById('lev').style.display = '';
	}
}

function showAllInput() {
	document.getElementById('link').style.display = '';
	document.getElementById('pris').style.display = '';
	document.getElementById('beskrivelse').style.display = '';
} 
