/*
	knightbox - yes, just like lightbox, but way different :)
	(c) Frank R. Gross, Pavlovic.com - frank # gross ## pavlovic # com
	$Id: knightbox3b.js 10 2009-11-27 17:38:37Z Frank $
*/

/* aktuell */

var knibo = {

	basePath	: "aktuell/images/",
	numPrj		: 0,
	imgs		:
	[
		// 1
		[
			"neues_office_aktuell1.jpg"
		],
		// 2
		[
			"dummies/dummy2.jpg"
		],
		// 3
		[
			"pandion_belvedere_startschuss.jpg"
		],
		// 4
		[
			"kubus_y_startschuss.jpg"
		],
		// 5
		[
			"salus_klinik_projekte1.jpg"
		],
		// 6
		[
			"dummies/dummy2.jpg"
		],
		// 7
		[
			"dummies/dummy2.jpg"
		],
		// 8
		[
			"revitalisierung-boerogebaude_koeln.jpg"
		],
		// 9
		[
			"revitalisierung-hotel-koeln.jpg"
		],
		// 10
		[
			"dummies/dummy2.jpg"
		],
		// 11
		[
			"zob_hennef_kam10_tag_neu.jpg"
		],
		// 12
		[
			"erfstadt.jpg"
		],
		// 13
		[
			"rosenmaar.jpg"
		],
		// 14
		[
			"illux.jpg"
		],
		// 15
		[
			"cfk_koeln.jpg"
		],
		// 16
		[
			"haus_s._neubau_einfamlienhaus,_koeln_junkersdorf.jpg"
		],
		// 17
		[
			"dummies/dummy2.jpg"
		],
		// 18
		[
			"riva_6,_rheinauhafen_baufeld_6.jpg"
		]
	],

	activeImgDiv		: 1,

	toggleActiveImgDiv	: function() {
		if(this.activeImgDiv == 1) {
			this.activeImgDiv = 2;
		}
		else {
			this.activeImgDiv = 1;
		}
		//console.log("toggle activeImgDiv to " + this.activeImgDiv);
	},

	$:			function(elem) {
					return document.getElementById( elem );
				},

	showImg:	function(prjId,imgId) {
					this.hideNfos();
					this.hideImg();
					this.resetBtns(prjId);
					this.markBtn(prjId + "_" + imgId);
					this.$('prj_img_' + this.activeImgDiv).src = this.basePath + this.imgs[prjId-1][imgId-1];
					//console.log("fading in div " + this.activeImgDiv);
					this.$('prj_img_' + this.activeImgDiv).onload = function() {
						Effect.Appear('prj_imgs_' + knibo.activeImgDiv, {duration:1, delay: 0});
					}
				},

	hideImg:	function() {
					//console.log('--------');
					//console.log("hiding div " + this.activeImgDiv);
					this.$('prj_imgs_' + this.activeImgDiv).style.display = "none";
					this.toggleActiveImgDiv();
				},

	markBtn:	function(btnId) {
					// skip if not present
					if(!this.$("btn" + btnId)) return;
					this.$("btn" + btnId).style.fontWeight = "bold";
					this.$("btn" + btnId).style.color = "black";
					//this.$("btn" + btnId).blur();
				},

	resetBtn:	function(btnId) {
					// skip if not present
					if(!this.$("btn" + btnId)) return;
					this.$("btn" + btnId).style.fontWeight = "normal";
					this.$("btn" + btnId).style.color = "#747577";
				},

	resetBtns:	function(prjId) {
					for( var btnId = 1; btnId <= this.imgs[prjId-1].length; btnId++ ) {
						this.resetBtn(prjId + "_" + btnId);
					}
				},

	showBox:	function(prjId) {
					this.hideBoxes();
					this.$('prj' + prjId + '_box' ).style.display = "block";
					this.rstTtls();
					this.hlTtl(prjId);
					this.showImg(prjId,1);
				},

	hideBox:	function(prjId) {
					// skip if not present
					if(!this.$('prj' + prjId + '_box' )) return;
					this.$('prj' + prjId + '_box' ). style.display = "none";
				},

	hideBoxes:	function() {
					for( var i = 1; i <= this.numPrj; i++ ) {
						this.hideBox(i);
					}
				},

	hlTtl:		function(ttlId) {
					this.$('prj' + ttlId + '_ttl').className = "aktuell_item_active";
				},

	llTtl:		function(ttlId) {
					// skip if not present
					if(!this.$('prj' + ttlId + '_ttl')) return;
					this.$('prj' + ttlId + '_ttl').className = "aktuell_item";
				},

	rstTtls:	function() {
					for( var i = 1; i <= this.numPrj; i++ ) {
						this.llTtl(i);
					}
				},

	showNfo:	function(nfoId) {
//					this.resetBtns(nfoId);
//					this.hideImg();
//					this.llImgLnk(nfoId);
//					this.hlNfoLnk(nfoId);
//					Effect.Appear('prj' + nfoId + '_desc', {duration:1, delay: 0});
				},

	hideNfo:	function(nfoId) {
//					this.hlImgLnk(nfoId);
//					this.llNfoLnk(nfoId);
//					this.$('prj' + nfoId + '_desc').style.opacity = "0.0";
//					this.$('prj' + nfoId + '_desc').style.display = "none";
				},

	hideNfos:	function() {
//					for( var i = 1; i <= this.numPrj; i++ ) {
//						this.hideNfo(i);
//					}
				},

	hlImgLnk:	function(lnkId) {
					this.$('prj' + lnkId + '_img_lnk').style.fontWeight = "bold";
					this.$('prj' + lnkId + '_img_lnk').style.color = "black";
				},

	llImgLnk:	function(lnkId) {
					this.$('prj' + lnkId + '_img_lnk').style.fontWeight = "normal";
					this.$('prj' + lnkId + '_img_lnk').style.color = "#747577";
				},

	hlNfoLnk:	function(nfoId) {
					this.$('prj' + nfoId + '_nfo_lnk').style.fontWeight = "bold";
					this.$('prj' + nfoId + '_nfo_lnk').style.color = "black";
				},

	llNfoLnk:	function(nfoId) {
					this.$('prj' + nfoId + '_nfo_lnk').style.fontWeight = "normal";
					this.$('prj' + nfoId + '_nfo_lnk').style.color = "#747577";
				},

	init:		function() {
//					this.preload();
					this.showBox(1);
					this.numPrj = this.imgs.length;
				},

	preload:	function() {
					var d = document;
					var x = 0;

					d.p = new Array();

					for( var i = 0; i < this.imgs.length; i++ ) {
						for( var ii = 0; ii < this.imgs[i].length; ii++ ) {
							d.p[x] = new Image;
							d.p[x].src = this.basePath + this.imgs[i][ii];
							x++;
						}
					}
					//alert("preloading done: " + d.p.length + " : " + x );
				}

}
