onload=init;
function init() {
	with ( document ) {
		for ( var i=0; i<images.length; i+=1 ) {
			with ( images[i] ) {
				style.width=(width*0.0626)+"em";
				style.height=(height*0.0626)+"em";
			}
		}
	}
} // init
function SearchFocus(obj, StandardText) {
	if(obj.value==' '+StandardText) obj.value='';
	obj.style.color="White";
} // SearchEnabled
function SearchBlur(obj, StandardText) {
	if(obj.value=='') {
		obj.value=' '+StandardText;
		obj.style.color="";
	}
} // SearchDisabled

var SiteUrl="http://bib.ballerup.dk/admin/";
function SendForm(form) {
	if (form.Name.value=="") {
		alert("Skriv venligst en titel");
		form.Name.focus();
		return false;
	}
	if (form.Author) {
		if (form.Author.value=="") {
			alert("Skriv venligst dit navn");
			form.Author.focus();
			return false;
		}
	}
	if (form.Text) {
		if (form.Text.value=="") {
			alert("Skriv venligst en kommentar");
			form.Text.focus();
			return false;
		}
	}
	if (form.Description) {
		if (form.Description.value=="") {
			alert("Skriv venligst en emnetekst");
			form.Description.focus();
			return false;
		}
	}
	form.GsAction.value='SaveObjectData';
	form.submit();
}

function setFocus(form, id)
{
	if(form[id])
		form[id].focus();
}


//////////////////////////////
// Search service functions //
//////////////////////////////
function ServiceLoad() {
	var imgElement=document.images['ServiceImage'];
	
	if ( !IsServiceEventsSet ) {
		IsServiceEventsSet=true;
		SetServiceOverEvents(imgElement.parentNode);
	}
	/*if ( imgElement.filters ) {
		imgElement.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=40) progid:DXImageTransform.Microsoft.Fade(Duration=2)";
		imgElement.filters[0].Enabled = true;
		imgElement.filters[1].Apply();
		imgElement.filters[0].Enabled = false;
		imgElement.filters[1].Play();
	}*/
} // ServiceLoad
var IsServiceEventsSet = false;
function ServiceOver() {
	if ( document.getElementById ) {
		if ( serviceOutTimer ) clearTimeout(serviceOutTimer);
		var imgElement=document.images['ServiceImage'];
		imgElement.className='ServiceImageHover';

		var element=document.getElementById('bookit_searchcode_dropdown_cont');
		if ( element.style.display=="block" ) {
			element.style.display="none";
			element.style.display="block";
		}
		
		if ( !IsServiceEventsSet ) {
			IsServiceEventsSet=true;
			SetServiceOverEvents(imgElement.parentNode);
		}
	}
} // ServiceOver
var ServiceOverEventCallCount=0;
function SetServiceOverEvents(element) {
	ServiceOverEventCallCount+=1;
	
	element = element.firstChild;
	while ( element ) {
		if ( element.nodeType==1 ) {
			if ( typeof(element.onmouseover)!="function" )
				element.onmouseover=ServiceOver;
			else {
				element.old_onmouseover=element.onmouseover;
				element.onmouseover=function() { this.old_onmouseover(); ServiceOver(); };
			}
				
			if ( typeof(element.onmouseout)!="function" )
				element.onmouseout=ServiceOut;
			else {
				element.old_onmouseout=element.onmouseout;
				element.onmouseout=function() { this.old_onmouseout(); ServiceOut(); };
			}

			SetServiceOverEvents(element);
		}
		element=element.nextSibling;
	}
} // SetServiceOverEvents
var serviceOutTimer=false;
var ServiceOutEventElement=null;
function ServiceOut(HideNow) {
	if ( HideNow ) {
		serviceOutTimer=false;
		var imgElement=document.images['ServiceImage'];
		imgElement.className='';
	} else {
		if ( serviceOutTimer ) clearTimeout(serviceOutTimer);
		serviceOutTimer=setTimeout("ServiceOut(true)", 100);
	}
} // ServiceOut
function ServiceShowDropDown() {
	var element=document.getElementById('bookit_searchcode_dropdown_cont');
	element.style.display="block";
} // ServiceShowDropDown
function ServiceHideDropDown() {
	var element=document.getElementById('bookit_searchcode_dropdown_cont');
	element.style.display="none";
} // ServiceHideDropDown
function ServiceDropDownToggle() {
	var element=document.getElementById('bookit_searchcode_dropdown_cont');
	element.style.display=(element.style.display=="none"?"block":"none");
} // ServiceDropDownToggle
function ServiceSetDropDownValue(selectElement) {
//alert("Type:"+typeof(selectElement.form) );
	selectElement.form['bookit_searchcode'].value=selectElement.options[selectElement.selectedIndex].text;
	selectElement.form['bookit_searchword'].focus();
} // ServiceSetDropDownValue


/////////////////
// Page Footer //
/////////////////
function ShowDay(activeAnchorElement) {
	activeAnchorElement.blur() // Remove fosus from anchor.
	
	var parentElement=activeAnchorElement.parentNode;
	while (parentElement.nodeType!=1) parentElement=parentElement.parentNode;

	// Reset class
	var anchorElements=parentElement.getElementsByTagName("A");
	for (var i=0; i<anchorElements.length; i+=1) {
		var anchorElement=anchorElements[i];
		if (anchorElement.className) anchorElement.className="";
	}
	activeAnchorElement.className="active";
	
	// Show opening hours.
	var activeWeekdayElement=document.getElementById(activeAnchorElement.id.substr(3));
	
	parentElement=activeWeekdayElement.parentNode;
	while (parentElement.nodeType!=1) parentElement=parentElement.parentNode;

	// Reset class
	var weekdayElements=parentElement.getElementsByTagName("DIV");
	for (var i=0; i<weekdayElements.length; i+=1) {
		var weekdayElement=weekdayElements[i];
		if (weekdayElement.className && weekdayElement.className!="weekday") weekdayElement.className="weekday";
	}
	
	activeWeekdayElement.className="weekday visible";
} // ShowDay

function ShowWeekdays() {
	var openingHoursWeekdays=document.getElementById("OpeningHoursWeekdays");
	openingHoursWeekdays.style.visibility="visible";

	var openingHoursWeekdays=document.getElementById("OpeningHours");
	openingHoursWeekdays.className="openinghours active";
} // ShowWeekdays

function HideWeekdays() {
	var openingHoursWeekdays=document.getElementById("OpeningHoursWeekdays");
	openingHoursWeekdays.style.visibility="hidden";

	var openingHoursWeekdays=document.getElementById("OpeningHours");
	openingHoursWeekdays.className="openinghours";
} // HideWeekdays
