
function openNewWindow(URLtoOpen, windowName, windowFeatures) { 
		  newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}


	
function newWin(url) {
	win=window.open(url, "newwin", "scrollbars,status,resizable");
}



function WM_preloadImages() {
	if (typeof(document.WM) == 'undefined') document.WM = new Object();
	document.WM.loadedImages = new Array();
	var argLength = WM_preloadImages.arguments.length;
	for(arg=0;arg<argLength;arg++) {
		document.WM.loadedImages[arg] = new Image();
		document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
	}
}



function WM_imageSwap(myImage, mySrc){
	if (typeof(myImage) == 'string') {
		document.images[myImage].src = mySrc;
	} else if ((typeof(myImage) == 'object') && myImage && myImage.src) {
		myImage.src = mySrc;
	}
}


	
var currPos = [];
var currSpeed = [];
var finPos = [];
function featureSwapImage(obj, picName, captionName, snippetName, imgNo, noShuffleBool) {
	if (document.images) {
		finPos[snippetName] = obj.parentNode.offsetTop;
		if (typeof currPos[snippetName]=="undefined") currPos[snippetName] = 0;
		if (!noShuffleBool && (!shuffling[snippetName] || typeof shuffling[snippetName]=="undefined")) shuffleImage(snippetName);
		var picObj = document.getElementById(picName);
//		if (picObj.filters) picObj.filters[0].apply();
		picObj.src = imageArr[snippetName][imgNo].src;
//		if (picObj.filters) picObj.filters[0].play();
		if (imageArr[snippetName][imgNo].text) {
			document.getElementById(captionName).innerHTML = imageArr[snippetName][imgNo].text;
		}
	}
}



var shuffleImageTimer = [];
var shuffling = [];
function shuffleImage(snippetName) {
	shuffling[snippetName] = true;
	if (finPos[snippetName]>currPos[snippetName]) currSpeed[snippetName] = parseInt(Math.abs(finPos[snippetName]-currPos[snippetName])/4);
	if (finPos[snippetName]<currPos[snippetName]) currSpeed[snippetName] = -1*parseInt(Math.abs(finPos[snippetName]-currPos[snippetName])/4);
	currPos[snippetName] = currPos[snippetName] + currSpeed[snippetName];
    document.getElementById("dropper_"+snippetName).height = currPos[snippetName];
	if (Math.abs(finPos[snippetName]-currPos[snippetName])>5) {
		shuffleImageTimer[snippetName] = setTimeout("shuffleImage('"+snippetName+"')", 5);
	} else {
		shuffling[snippetName] = false;
	}
}

