function OpenTextPopup(url,width,height) {
 var rnd = (Math.round((Math.random()*999)+1));
 var top=Math.round((screen.height-height)/2);
 var left=Math.round((screen.width-width)/2);
 this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
}

function OpenIdPopup(id, width, height) {
 var rnd = (Math.round((Math.random()*999)+1));
 var top=Math.round((screen.height-height)/2);
 var left=Math.round((screen.width-width)/2);
 this.open(WWW_ROOT_URL + 'details.php?id=' + id, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
}

function OpenImagePopup(url,width,height) {

 var rnd = (Math.round((Math.random()*999)+1));
 var top=Math.round((screen.height-height)/2);
 var left=Math.round((screen.width-width)/2);
 this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
}
function OpenText(url) {
 var width=440;
 var height=530;
 var rnd = (Math.round((Math.random()*999)+1));
 var top=Math.round((screen.height-height)/2);
 var left=Math.round((screen.width-width)/2);
 this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=np,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
}
function OpenPopupWindow(url,width,height) { OpenImagePopup(url,width,height); }

function OpenImagePopupID(id,width,height) {
 //OpenImagePopup(CMS_URL+id+'&w='+width+'&h='+height,width,height);
 
   if( media_window ) {
    media_window.close();
    media_window = false;
   }
 
   win_url = WWW_ROOT_URL + 'media_details.php?media=image&show_title=1&id=' + id;
   win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
   win_width = 575;
   win_height = 430;
  
   win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
   win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
   
   media_window = window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");
  

}


  var media_window = false;
  var download_window = false;
  
  function showFiles( id ) {
 
   if( media_window ) {
    media_window.close();
    media_window = false;
   }
 
   win_url = WWW_ROOT_URL + 'media_details.php?media=files&show_title=1&id=' + id;
   win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
   win_width = 575;
   win_height = 430;
  
   win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
   win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
  
   media_window = window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");
  
  }
  
  function showDownloadDetails( id ) {
 
	showFiles( id );

/**
   
   if( download_window ) {
    download_window.close();
    download_window = false;
   }
 
   win_url = WWW_ROOT_URL + 'media_download.php?id=' + id;
   win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
   win_width = 300;
   win_height = 200;
  
   win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
   win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
  
   download_window = window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=0,status=false,directories=0,toolbar=0");
  
*/
  
  }
  

  function showImages( id ) {
 
   if( media_window ) {
    media_window.close();
    media_window = false;
   }
 
   win_url = WWW_ROOT_URL + 'media_details.php?media=images&show_title=1&id=' + id;
   win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
   win_width = 575;
   win_height = 430;
  
   win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
   win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
   
   media_window = window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");
  
  }
  
  
  function showImagesNoTitle( id ) {
 
   if( media_window ) {
    media_window.close();
    media_window = false;
   }
 
   win_url = WWW_ROOT_URL + 'media_details.php?media=images&show_title=0&id=' + id;
   win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
   win_width = 575;
   win_height = 430;
  
   win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
   win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
   
   media_window = window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");
  
  }
  

function showImages2( id ) {
 
   if( media_window ) {
    media_window.close();
    media_window = false;
   }
 
   win_url = WWW_ROOT_URL + 'details.php?id=' + id;
   win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
   win_width = 600;
   win_height = 400;
  
   win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
   win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
   
   media_window = window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");
  
  }

