

/*==========================================================
	DOM Ready and OnLoad Events
==========================================================*/
jQuery(window).bind("load", function() {
	jQuery("div#slider1").codaSlider()
});


/*==========================================================
	Menu
==========================================================*/
var slideMenu = {
	getHashId: function() {
		return(parseInt(location.hash.slice(1)) || 1);
	},
	switchImage: function(hashId, type) {
		document.getElementById('menuimage' + hashId).src = '_cachedir/menu_' + hashId + '_' + type + '.gif';
	},
	resetImages: function() {
		$("#menu-ul a img").each(
			function(intIndex) {
				intIndex++;
				if(slideMenu.getHashId() != intIndex) this.src = '_cachedir/menu_' + intIndex + '_normal.gif';
			}
		);
	},
	action: function(hashId) {
		slideMenu.switchImage(slideMenu.getHashId(), 'normal');
		slideMenu.resetImages();
		slideMenu.switchImage(hashId, 'current');
	},
	enter: function(hashId) {
		slideMenu.resetImages();
		if(slideMenu.getHashId() != hashId) slideMenu.switchImage(hashId, 'hover');
	},
	leave: function(hashId) {
		slideMenu.resetImages();
		if(slideMenu.getHashId() != hashId) slideMenu.switchImage(hashId, 'normal');
	}
}

/*==========================================================
	Module Functions
==========================================================*/
function switchClientLogo() {
	if(arguments.length == 0) {
		document.getElementById('clientLogo').src = 'images/placeHolder.png';
	} else {
		document.getElementById('clientLogo').src = '_cachedir/' + arguments[0];
	}
}

function changeEmployee() {
	if(arguments.length == 0) {
		document.getElementById('employeePicture').src = 'images/spacer.gif';
		document.getElementById('employeeText').innerHTML = ' ';
	} else {
		document.getElementById('employeePicture').src = '_cachedir/' + employees[arguments[0]].source;
		document.getElementById('employeeText').innerHTML = employees[arguments[0]].text;
	}
}

function fillHW(id) {
	$("#chapter-handwerk").fadeOut("slow", function() {
		this.innerHTML = hw[id].title;
	});
	$("#chapter-handwerk").fadeIn("slow");
	$("#column-handwerk-1").fadeOut("slow", function() {
		this.innerHTML = hw[id].text;
	});
	$("#column-handwerk-1").fadeIn("slow");
	$("#handwerk-backbutton").fadeOut("slow");
	if(id != 'standard') {
		$("#handwerk-backbutton").fadeIn("slow");
	}
}
