// JavaScript Document
var interId;

function showcontent(id) {
	historizer.src = "changer.php?act=content!"+id;
}

function choose(id) {
	var idx = id.indexOf('!');
	var type = id.substring(0, idx);
	var act = id.substring(idx+1);
	if (act == "")
		return;
	switch(type) {
		case "content":
			displayContent(act);
			break;
	}
}

function displayContent(id) {
	if (!id)
		return;
	var disp = document.getElementById(id);
	if (cur)
		cur.style.display = "none";
	disp.style.display = "block";
	cur = disp;
	if (id == "currentpictures") {
		document.getElementById('picframe').src = 'dirlist.php';
		document.getElementById('dispimg').src = 'dispimg.php';
	}
	bgH = 0;
	bgW = 0;
	//display.src = 'e.gif';
	//curPicPage.style.display = "none";
	//curPicPage = document.getElementById("images");
	//curPicPage.style.display = "block";
	document.body.style.height = 225 + disp.clientHeight;
}

function resizeIframe(iframe) {
	var docbody = iframe.contentWindow.document.body;
	iframe.style.width= "690px";
	iframe.style.height=docbody.clientHeight==0?iframe.style.height:docbody.clientHeight + 30 + "px";//change the height of the iframe
	iframe.style.width=docbody.clientWidth==0?iframe.style.width:docbody.clientWidth + "px";//change the width of the iframe

	iframe.parentNode.style.width = Math.max(parseInt(iframe.style.width),690) + "px";
	if (iframe.id == "dispimg")
		document.documentElement.scrollTop = document.documentElement.scrollHeight;
}

function loadup() {
	//toggler();
	if (window.iefix)
		iefix();
	
	document.onmousedown=function(evt) { 
							if ((window.event && event.button == 2)||(evt && evt.which==3)) 
									alert('Please contact us to purchase photos'); 
						 };

	/*
	display = document.getElementById("dispimg");
	display.onload = function() { 
		bgH=this.height; 
		bgW=this.width; 
		//oldWidth = parseInt(document.body.style.width);
		//document.body.style.width = (oldWidth + bgW + 50) + 'px';
		if (this.src.substr(this.src.lastIndexOf('/')+1) != "e.gif")
			document.documentElement.scrollTop = document.documentElement.scrollHeight;
		};
	*/
	bgH = 0;
	bgW = 0;
	oldWidth = 0;
	baseWidth = 0;
	
	historizer = document.getElementById("historizer");
	//curPicPage = document.getElementById("images");
	//curPicPage.style.display = "block";
	cur = document.getElementById("loading");
	showcontent("home");
}
var cur, curPicPage;
var bgH=0,bgW=0, display;
var oldWidth, baseWidth;
var historizer;

window.onload=loadup;
