﻿/* 
To apply a hover or click effect to any image or image input, simply add the desired extra
attributes to the image or input definition. The attribute names must ALWAYS be written in
lower case:
	hoversrc="hover.gif"     produces a hover/rollover effect
	activesrc="hover.gif"    produces a click/active effect
The syntax of these attributes is identical to the src attribute.

	Regular image:
		<img src="root.gif" height="50" width="50" alt="" border="0">
	Hover:
		<img src="root.gif" hoversrc="hover.gif" height="50" width="50" alt="" border="0">
	Click:
		<img src="root.gif" activesrc="active.gif" height="50" width="50" alt="" border="0">
	Hover and click:
		<img src="root.gif" hoversrc="hover.gif" activesrc="active.gif" height="50" width="50" alt="" border="0">
	Hover and click on an image input:
		<input type="image" src="root.gif" hoversrc="hover.gif" activesrc="active.gif" height="50" width="50" alt="" border="0">
*/

var MWJ_img_cache;

function initImageRollovers()
{
    MWJ_img_cache = new Object();
    for( var i = 0; i < 2; i++ ) {
	    var ar = i ? ( document.getElementsByTagName ? document.getElementsByTagName('input') : ( document.all ? document.all.tags('INPUT') : [] ) ) : document.images;
	    for( var x = 0; ar[x]; x++ ) {
		    var im = ar[x];
		    if( im.getAttribute ) { im.hoversrc = im.getAttribute('hoversrc'); im.activesrc = im.getAttribute('activesrc'); }
		    if( im.hoversrc || im.activesrc ) {
			    if( !MWJ_img_cache[im.src] ) { MWJ_img_cache[im.src] = new Image(); MWJ_img_cache[im.src].src = im.src; }
			    im.rootsrc = im.src;
			    im.onmouseout = function () { this.src = this.rootsrc; };
		    }
		    if( im.hoversrc ) {
			    if( !MWJ_img_cache[im.hoversrc] ) { MWJ_img_cache[im.hoversrc] = new Image(); MWJ_img_cache[im.hoversrc].src = im.hoversrc; }
			    im.onmouseover = function () { this.src = this.hoversrc; };
		    }
		    if( im.activesrc ) {
			    if( !MWJ_img_cache[im.activesrc] ) { MWJ_img_cache[im.activesrc] = new Image(); MWJ_img_cache[im.activesrc].src = im.activesrc; }
			    im.onmousedown = function (e) {
				    e = e ? e : window.event;
				    if( e.button > 1 || e.which > 1 ) { return; }
				    this.src = this.activesrc;
			    };
			    im.onmouseup = function (e) {
				    e = e ? e : window.event;
				    if( e.button > 1 || e.which > 1 ) { return; }
				    this.src = this.hoversrc ? this.hoversrc : this.rootsrc;
			    };
		    }
	    }
    }
}


// Sizes pop up Window
function sizesUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=640,left = 20,top = 10');");
}
// End -->

// Muse Sizes pop up Window
function museSizesUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=425,height=801,left = 20,top = 10');");
}
// End -->

// Palette pop up Window
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=640,left = 50,top = 20');");
}
// End -->

// Recycled pop up Window
function popRecycled(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=726,height=580,left = 50,top = 20');");
}
// End -->