var zoomer=false;
function zoomr() {
	var obj = this;
	this.div = document.createElement('div');
	this.div.id = 'zoom';
	this.overlay = document.createElement('div');
	this.overlay.className = 'overlay';
	this.div.appendChild(this.overlay);
	this.outputcontainer = document.createElement('div');
	this.outputcontainer.className = 'outputcontainer';
	this.div.appendChild(this.outputcontainer);
	this.output = document.createElement('div');
	this.output.className = 'output';
	this.outputcontainer.appendChild(this.output);
	var div = document.createElement('div');
	div.className = 'close';
	var a = document.createElement('a');
	a.href='#';
	a.onclick=function() { obj.close(); }
	a.innerHTML = 'CLOSE';
	div.appendChild(a);
	this.outputcontainer.appendChild(div);
	document.body.appendChild(this.div);
	this.images = new Object();
}
zoomr.prototype = {
	display:function(i,s) {
		var height=window.innerHeight && window.scrollMaxY?window.innerHeight+window.scrollMaxY:(document.body.scrollHeight>document.body.offsetHeight?document.body.scrollHeight:document.body.offsetHeight);
		var width=window.innerWidth && window.scrollMaxX?window.innerWidth+window.scrollMaxX:(document.body.scrollWidth>document.body.offsetWidth?document.body.scrollWidth:document.body.offsetWidth);
		this.div.style.height=height+'px';
		this.overlay.style.height=height+'px';
		this.div.style.width=width+'px';
		this.overlay.style.width=width+'px';
		if (typeof(this.images[i]) == 'undefined') {
			this.images[i] = new Image();
			this.images[i].src = psq+'nb%5Bop%5D=image&nb%5Bsize%5D='+s+'&nb%5Bid%5d='+i;
		}
		this.outputcontainer.style.left = (Math.floor(width / 2) - 310) + 'px';
		if (this.output.childNodes.length) {
			this.output.replaceChild(this.images[i],this.output.childNodes[0]);
		} else {
			this.output.appendChild(this.images[i]);
		}
		this.div.style.display = 'block';
	},
	close:function() {
		this.div.style.display = 'none';
	}
}
function zoom(i,s) {
	if (zoomer == false) {
		zoomer = new zoomr();
	}
	zoomer.display(i,s);
	return false;
}
function inithover() {
	if (document.getElementById) {
		this.over = new Object();
		var i = document.getElementsByTagName('img');
		var x,c;
		var o=this;
		for (x = 0,c = i.length; x < c; x++) {
			var f = i[x].getAttribute('hover');
			if (f && i[x].parentNode.tagName == 'A') {
				if (typeof(this.over[f]) == 'undefined') {
					this.over[f] = new Image();
					this.over[f].src='/weddings/style/images/'+f;
				}
				i[x].def = new Image();
				i[x].def.src = i[x].src;
				i[x].parentNode.onmouseover=o.show(i[x],o.over[f]);
				i[x].parentNode.onmouseout=o.show(i[x],i[x].def);
			}
		}
	}
}
inithover.prototype.show = function(i,o) {
	return function() {
		i.src = o.src;
	}
}
