dom=document.getElementById?1:0;
ie4=document.all?1:0;
img=document.images?1:0;

//check for older browsers

if (!document.getElementById) {
    window.location="http://www.webstandards.org/upgrade/";
}

// images list array for preloading
p=new Array(
	"gallery",
	"latest",
	"about",
	"contact"
	);

// generic popup function
 
function makePopup(targ,width,height) { 
winProps ='height='+height+',width='+width+',top='+popTop+',left='+popLeft+',scrollbars=no,resizable=0';
popUp = window.open(targ,'makepopup',winProps);
if(parseInt(navigator.appVersion) >= 4) { popUp.window.focus(); } }

function viewimage(rowid,width,height) { 
popLeft =(screen.width - width)/2; popTop = (screen.height - height)/2;
winProps ='height='+height+',width='+width+',top='+popTop+',left='+popLeft+',scrollbars=no,resizable=0';
popUp = window.open("viewport.php?image="+rowid,'image',winProps);
if(parseInt(navigator.appVersion) >= 4) { popUp.window.focus(); } }

function dosearch() { which = document.forms.searchform; if(which.query.value!="") { which.submit(); }}
function dostatus(string) { window.status=string; }


// rollover script


preloadFlag=false;

// creates new image object

function newImage(arg) { if (document.images) { rslt = new Image(); rslt.src = arg; return rslt; }}

// preloads images into objects
	
function preloadimages() {
	if(document.images) {
		for(i=0;i<p.length;i++) {
			var tmp=p[i]+"_on";
			tmp=newImage("images/"+p[i]+"_on.gif");
		}
		preloadFlag=true;
	}
}

// changes images on rollover/rollout

function swapimages(name,on) {
	if(document.images && preloadFlag) {
		if(document.images[name]) {
			if(on) {
				document.images[name].src="images/"+name+"_on.gif";
			} else {
				document.images[name].src="images/"+name+"_off.gif";
			}
		}
	}
}

// removes link borders
function getObjTag(n) {if(dom){return document.getElementsByTagName(n);}else if(ie4){return document.all.tags(n);}else { return 0;}}
function doblur() { this.blur(); }
function blurAll() { 
var linx = getObjTag("a"); if(linx){for(var i=0;i<linx.length;i++){linx[i].onfocus=doblur;}}
var selex = getObjTag("select"); if(selex){for(var i=0;i<selex.length;i++){selex[i].onfocus=doblur;}}
}
