/*
 * A collection of functions for use in get2dom.com and indeed many other
 * places. This is a dHTML library. basic functionality for non DOM
 * compliant browsers, fun with DOM browsers (document.getElementByID),
 * and a little extra for MS Internet Explorer 5.5 & later.
 *
 * AUTHOR: Dominic Winsor, get2dom.com
 * VERSION: 1.0
 * LAST UPDATED: 10 Nov 2002
 */
 
 
 
 
 /* getRef
 *   Return an object reference, first DOM, then UA specific
 *   Warning: object must exist
 *   Dominic Winsor, www.get2dom.com
 */
function getRef( element ) {

	if ( document.getElementById( element ) )
		return document.getElementById( element );
		
	if ( document.all )
		return document.all[element];
	
	if ( document.layers )
		return document.layers[element];

}
 
/* 
 * swapClass
 * Toggle the className of an element
 * Author: Dominic Winsor
 * Usage: index=element.id, if not supplied then it will return to previous class.
 */

lastChange = new String();
lastClass = new String();

function swapClass(index,className) {
	if( index ) {
		lastChange = index;
		lastClass = getRef(index).className;
		getRef(index).className = className;
	} else {
		getRef(lastChange).className = lastClass;
	}
}


/* selfPopup
 * open popup window with href determined from the href attribute on the anchor:
 * <a href="index.html" onclick="selfPopup(this,300,400); return false;">Index</a>
 */
function selfPopup( loc, x, y ) {
   LeftPosition = (screen.width) ? (screen.width-x)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-y)/2 : 0;
   window.open(loc.href,"","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width="+x+",height="+y+',left='  +LeftPosition +  ',top='  +TopPosition +"");
}

/* selfPopupImage
 * open popup window with href determined from the href attribute on the anchor:
 * same as selfPopup, but assumes target is an image file
 * <a href="index.html" onclick="selfPopup(this,300,400); return false;">Index</a>
 */
function selfPopupImage( loc, x, y ) {
   LeftPosition = (screen.width) ? (screen.width-x)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-y)/2 : 0;
   myWindow = window.open("","Picture","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width="+x+",height="+y+',left='  +LeftPosition +  ',top='  +TopPosition +"");
   myWindow.document.write("<html><head>");
   myWindow.document.write("<title>Image</title>");
   myWindow.document.write("<meta name="keywords" content="kanya uk, kanya, clean room systems, connecting systems, kanya extrusion, profile systems, machining aluminium, aluminium workbenches, aluminium frameworks, aluminium rigging, machine enclosures, extrusion systems, machine build systems, alprofil, aluminium structures, machine guards, alusett, item, aluminium profiles, aluminium extrusion, "></head>
<body marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' onload=\"window.focus();\">");
   myWindow.document.write("<a href=\"javascript:window.close()\"><img border=0 hspace=0 vspace=0 height=" + y + " width=" + x + " src='" + loc.href + "'></a>");
   myWindow.document.write("</body></html>");
   myWindow.document.close();
}