function newWin(url) {
	window.open(url, '_blank');
	return false;
}

function mOpen(image_url, width, height) {

	var ajmo = window.open(image_url, 'popup_win', 'width='+width+',height='+height+',top='+(screen.height/2-(height/2))+',left='+(screen.width/2-(width/2)));
	ajmo.document.write('<html>\n<head>\n<title>Preview</title>\n</head>\n');
	ajmo.document.write('<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 onBlur="window.close()">\n<img src="'+image_url+'" width='+width+' height'+height+' border=0>\n</body>\n');
	ajmo.document.write('</html>\n');
	ajmo.document.close();

}

function toggleVisibility(vis,hid) {
	layerstoshow = vis.split(',');
	for (i=0; i<layerstoshow.length; i+=1)
	{
		if (selectedlayer = document.getElementById(layerstoshow[i]))
		{
			selectedlayer.style.visibility = 'visible';
		}
	}
	layerstohide = hid.split(',');
	for (i=0; i<layerstohide.length; i+=1)
	{
		if (selectedlayer = document.getElementById(layerstohide[i]))
		{
			selectedlayer.style.visibility = 'hidden';
		}
	}
}

function preloadImages() {
  if (document.images) { 
    if (typeof(document.lupiga) == 'undefined'){
      document.lupiga = new Object();
    }
    document.lupiga.loadedImages = new Array();
   
    var argLength = preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
     
      document.lupiga.loadedImages[arg] = new Image();
     
      document.lupiga.loadedImages[arg].src = preloadImages.arguments[arg];
    }
  }
}

function swapImages(imageName, imageUrl){ 
  if(document.images){
		if(eval(imageName + ".complete")) {
				document.images[imageName].src = imageUrl;
		}
	}
}

function swapImageButton(imageID, imageUrl){ 
  document.getElementById(imageID).src = imageUrl;
}
