/****************************************
|
| London Home Builders' Association
| Created by: Kevin Biskaborn
| Copyright 2008 ScriptReaction
| http://www.scriptreaction.com
|
****************************************/

/********** icap_v1 **********/
var icap1 = {
	launch: function (galleryId){
		icap1.galleryId = galleryId;
		
		var divs = document.getElementsByTagName("div");
		for(var i=0; i<divs.length; i++){
			var whichdiv = divs[i];
			var divclass = whichdiv.className;
			if(divclass == "icap1"){
				var theimg = whichdiv.getElementsByTagName("img")[0];
				theimg.id = "icap_img_" + i;
				var thecap = whichdiv.getElementsByTagName("div")[0];
				thecap.id = "icap_cap_" + i;
				theimg.onmouseover = thecap.onmouseover = function(){
					icap1.showCap(this.id);
				}
				theimg.onmouseout = thecap.onmouseout = function(){
					icap1.hideCap(this.id);
				}
				theimg.onclick = thecap.onclick = function(){
					icap1.capClick(this.id);	
				}
			}
		}
	},
	getCapId: function (x){
		var idin = x.split("_");
		var idout = "icap_cap_" + idin[2];
		return document.getElementById(idout);	
	},
	getImgId: function (x){
		var idin = x.split("_");
		var idout = "icap_img_" + idin[2];
		return document.getElementById(idout);
	},
	showCap: function (x){
		icap1.getCapId(x).style.visibility = "visible";
	},
	hideCap: function (x){
		icap1.getCapId(x).style.visibility = "hidden";
	},
	capClick: function (x){
		var theimg = icap1.getImgId(x);
		var imgId = theimg.name;
		top.location.href = "/gallery/?id=" + icap1.galleryId + "&view=" + imgId;
	}
}
