function showpopup (imagepage)
{
    var imagewindow1 = window.open(imagepage,'imagewindow1','width=440,height=560');
    
    if (imagewindow1.opener == null)
        imagewindow1.opener = self;

    imagewindow1.focus (); 
}

function showpopup2 (statspage)
{
    var statwindow1 = window.open(statspage,'statwindow1','width=500,height=396');
    
    if (statwindow1.opener == null)
        statwindow1.opener = self;

    statwindow1.focus (); 
}

function showpopup3 (sUrl,iWidth,iHeight,sScrollbars,sResizable) {
    var winleft = (screen.width - iWidth) / 2;
    var winUp = (screen.height - iHeight) / 2;
    var mywindow = window.open(sUrl,'mywindow','scrollbars='+sScrollbars+',resizable='+sResizable+',width='+iWidth+',height='+iHeight+',left='+winleft+',top='+winUp+'');
    if (mywindow.opener == null)
        mywindow.opener = self;
        mywindow.focus (); 
}


/* New functions to show popups of single gifs with dynamic resizing.
	This does not require graphics to be in Media Galleries in IRIS; they can be anywhere on the system as long as the relative URL is passed in.
	Based on an example from The JavaScript Source!! http://javascript.internet.com
	modded somewhat by PC    .. Aug 05 */


function PopupGraphic(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}

function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}

function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//Basic Image Rollover script added by SC
function toggleImage(img_name,img_src) {
	document[img_name].src = img_src;
}

function toggleVisibility(name,state) {
	document.getElementById(name).style.visibility=state;
}

var timer; 

function toggleVisibilitySetTimeout(){
  timer = setTimeout("toggleVisibility('hiddentable','hidden')",1000);
}

function toggleVisibilityClearTimeout() {
  clearTimeout(timer);
}

// Radio popup added Jun 07
// the last two parameters are the IRIS mediaid and the media name and will only be set when user has selected a specific file from the list on the website
var gmyWin = null;
function myOpenWindow( winURL, winName, winFeatures, winObj, intMediaID, strMediaName )
	{

      var theWin; // this will hold our opened window 
		// first check to see if the window already exists
	  if (winObj != null) {
			// the window has already been created, but did the user close it?
			// if so, then reopen it. Otherwise make it the active window.
			if (!winObj.closed) {
                winObj.focus();
                if (intMediaID > 0 ) {
                    winURL += '?mediaid=' + intMediaID + '&medianame=' + strMediaName; 
                }
		        theWin = window.open(winURL, winName, winFeatures); 
		        return theWin;
  				//winObj.focus();
  				//return winObj;
			} 
			// otherwise fall through to the code below to re-open the window
		}
		// if we get here, then the window hasn't been created yet
        // if intMediaID > 0 then the user will have chosen the radio show from a list of shows and we'll need to supply the popup with its' ID and name
        if (intMediaID > 0 ) {
            winURL += '?mediaid=' + intMediaID + '&medianame=' + strMediaName; 
            //alert(winURL);
            }
		theWin = window.open(winURL, winName, winFeatures); 
		return theWin;
}