



// Swap document.img1.src with img2

function swapImg(img1, img2)
{
	document[img1].src = img2;
}


// Preload img with name imgName

function preloadImg(imgName, img)
{

	var imgName	= new Image();
	imgName.src	= img;

}

function openSlideShow(world, slideShow, x, y, useScrollBars) {
	popSlideShow = null;
	var defaultX = 434;
	var defaultY = 545;
	if(typeof(useScrollBars) != "undefined") {
		useScrollBars  = 'yes';
	} else {
		useScrollBars  = 'no';
	}
	
	slideShow = slideShow + "&world="+world;
	
	if(typeof(x) != "undefined") {
		var width  = x;
	} else {
		var width  = defaultX;
	}
	
	if(typeof(y) != "undefined") {
		var height = y;
	} else {
		var height = defaultY;
	}

	var screenWidth		=	(screen.width - width) / 2;
	var screenHeight	=	(screen.height - height) / 2;

	if(typeof(caption) != "undefined") {	url += "&caption="+escape(caption); }
	
	popSlideShow = window.open(slideShow,"popExpand","width="+width+",height="+height+",left="+screenWidth+",top="+screenHeight+",toolbar=no,resizable=no,scrollbars="+useScrollBars+",location=no,directories=no,menubar=no");
	
}

function popVideo(world, url, movieWidth, movieHeight, windowWidth, windowHeight)
{

	if(windowWidth == "undefined") {
		windowWidth = movieWidth;
	}
	if(windowHeight == "undefined") {
		windowHeight = movieHeight;
	}
	
	// add 15 to height for player ui
	movieHeight += 15;

	var screenWidth		=	(screen.width - windowWidth) / 2;
	var screenHeight	=	(screen.height - windowHeight) / 2;

	winUrl = "/meta/expand/video.html?world="+world+"&url="+url+"&mw="+movieWidth+"&mh="+movieHeight+"&ww="+windowWidth+"&wh="+windowHeight;
	
	vidWin = window.open(winUrl,"vidPopRd","width="+windowWidth+",height="+windowHeight+",toolbar=no,resizable=no,scrollbars=no,location=no,directories=no,menubar=no,top="+screenWidth+",left="+screenHeight);
}