function findObj(n, d) {
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
  	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
	return x;
}

function MouseOverImage(width, height, name, name1, name2) {
	this.cur = 0;
        this.name = name;
        this.pictures = new Array(2);
        this.pictures[0] = new Image(width, height);
        this.pictures[0].src = 'images/objects/' + name1 +'.gif';
        this.pictures[1] = new Image(width, height);
        this.pictures[1].src = 'images/objects/' + name2 +'.gif';
}

function NavMouseOverImage(width, height, name) {
	this.cur = 0;
        this.name = name;
        this.pictures = new Array(2);
        this.pictures[0] = new Image(width, height);
        this.pictures[0].src = 'images/buttons/' + name +'-w.gif';
        this.pictures[1] = new Image(width, height);
        this.pictures[1].src = 'images/buttons/' + name +'-r.gif';
}

function setPicture(picset,imagenumber, picturenumber) {
        var theimage = picset[imagenumber];
        if (theimage.cur != picturenumber) {
        	theimage.cur = picturenumber;
            	findObj(theimage.name).src = theimage.pictures[theimage.cur].src;
        }
}

function ViewImage(title,image,width,height) {
        if ( navigator.userAgent.indexOf("MSIE")!=-1 ) {
                width+=14;
                height+=33;
        }
	PopupWin = window.open("viewimage.php?"+title+"&"+image+"&"+width+"&"+height, "popup", "width="+width+",height="+height+",dependent=yes,resizable=yes");
	PopupWin.focus();
}
