  function rn_display(box)
  {
    if(box.checked === true)
    {
      img_name.style.display='';
    }
    else
    {
      img_name.style.display='none';
    }
  }

  function rs_display(box)
  {
    if(box.checked === true)
    {
      resize1.style.display='';
      resize2.style.display='';
    }
    else
    {
      resize1.style.display='none';
      resize2.style.display='none';
    }
  }

  function op(iname,winwidth,winheight)
  {
    window.open("image.php?image="+iname,"","scrollbars=yes,status=no,location=no,width="+winwidth+",height="+winheight+",resize=yes");
  }

  function opsm(iname,winwidth,winheight)
  {
    window.open(iname,"","scrollbars=yes,status=no,location=no,width="+winwidth+",height="+winheight+",resize=yes");
  }
  
  function dropdown_swapstyles( a )
  {
    if( a.className == 'dropdown_invisible' )
    {
      a.className = 'dropdown_visible';
    }
    else
    {
      a.className = 'dropdown_invisible';
    }
  }
  
  function over(i)
  {
    if(document.all)
    {
      eval("document.images.dot_"+i+".src=\"images/dot_.gif\"");
    }
  }
  
  function out(i)
  {
    if(document.all)
    {
      eval("document.images.dot_"+i+".src=\"images/dot.gif\"");
    }
  }
  
  function doAdd(item,i)
  {
    eval("document.f[\"ctent_form["+item+"]\"].value = '"+i+"'");
    document.f.submit();
  }
  
  function autofill(box)
  {
    if( box.checked == true )
    {
      form = document.venue_form;
      form["venue_form[VenueContactName]"].value     = form["venue_form[VenueNameContact]"].value;
      form["venue_form[VenueContactEmail]"].value    = form["venue_form[VenueEmail]"].value
      form["venue_form[VenueContactAddress]"].value  = form["venue_form[VenueAddress]"].value
      form["venue_form[VenueContactTownCity]"].value = form["venue_form[VenueTownCity]"].value
      form["venue_form[VenueContactCounty]"].value   = form["venue_form[VenueCounty]"].value
      form["venue_form[VenueContactPostcode]"].value = form["venue_form[VenuePostcode]"].value
      form["venue_form[VenueContactTel]"].value      = form["venue_form[VenueTel]"].value
    }
  }
  
  function check(box)
  {
    if( box.value == 'off' )
    {
      box.value = 'on';
    }
    else if( box.value == 'on' )
    {
      box.value = 'off';
    }
  }

  function rnImg(link,prompttxt,defprompt)
  {
    var new_name = prompt(prompttxt,defprompt);
    if(new_name == null) return false;
    else
    {
      link = link+'&new_name='+new_name;
      document.location = link;
    }
  }
  
  function debug_alert( obj )
  {
    var msg = ''
    var a

    for( a in obj )
    {
      if( obj[a] && a != 'innerHTML' && a != 'innerText' && a != 'outerHTML' && a != 'outerText' ) msg += a + "=" + obj[a] + "\n"
    }

    alert( msg )
  }

  var current_menu = 0
  var current_innermenu = 0

  function hide_menu()
  {
    if( current_menu ) current_menu.style.visibility = 'hidden'
    current_menu = 0
  }

  function show_menu( popup, td )
  {
    hide_menu()
    current_menu = popup
    popup.style.left = maintable.offsetLeft + td.offsetLeft + 10
    popup.style.top  =  td.offsetTop + 148;
    popup.style.visibility = ''
  }

  function show_menu_end( popup, td )
  {
    hide_menu()
    show_menu( popup, td )
    popup.style.left = maintable.offsetLeft + td.offsetLeft - 80
  }
  
  function remove1()
  {
    window.open("<?=$server['site_url']?>/remove_image1.php","","width=200,height=100,resizable=yes,scrollbars");
    h_1.style.display = 'none';
  }
  function remove2()
  {
    window.open("<?=$server['site_url']?>/remove_image2.php","","width=200,height=100,resizable=yes,scrollbars");
    h_2.style.display = 'none';
  }
  function remove3()
  {
    window.open("<?=$server['site_url']?>/remove_image3.php","","width=200,height=100,resizable=yes,scrollbars");
    h_3.style.display = 'none';
  }
  function op2(list)
  {
    selectedIndex = list.selectedIndex;
    n = list.options[selectedIndex].n;
    n = list.options[selectedIndex].value;
    w = list.options[selectedIndex].w;
    h = list.options[selectedIndex].h;
    op(n,w,h);
  }
  
  function disp(iname,winwidth,winheight)
  {
    document.writeln(' : Name : '+iname);
    document.writeln(' : Width : '+winwidth);
    document.writeln(' : Height : '+winheight);
  }
  
  function op(iname,winwidth,winheight)
  {
    iname = escape(iname);
  
    if(winheight > 500)
    {
      winwidth = winwidth*1+10;
      window.showModalDialog("imageview.php?image=images/"+iname,"James","dialogHeight: 500px; dialogWidth: "+winwidth+"px; dialogTop: 150px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
      //window.open("imageview.php?image=images/"+iname,"","width="+winwidth+",height=500,resizable=yes,scrollbars");
    }
    else
    {
      winheight = winheight*1+29;
      winwidth = winwidth*1+10;
      window.showModalDialog("imageview.php?image=images/"+iname,"James","dialogHeight: "+winheight+"px; dialogWidth: "+winwidth+"px; dialogTop: 150px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
      //window.open("imageview.php?image=images/"+iname,"","width="+winwidth+",height="+winheight+",resizable=yes");
    }
  }
  
  function opsm(iname,winwidth,winheight)
  {
    window.open(iname,"","scrollbars,width="+winwidth+",height="+winheight+",resize");
  }
  
  function hideurl(boxi,ind,b2)
  {
    if(boxi.checked)
    {
      eval("urlext_"+ind+".style.display = 'none';")
      eval("urlint_"+ind+".style.display = '';")
      eval("document.f.ext_url_"+ind+".checked = 1")
    }
    else
    {
      eval("urlext_"+ind+".style.display = '';")
      eval("urlint_"+ind+".style.display = 'none';")
      b2.checked = 0;
    }
  }