function cpic(pic, ww, hh)
{
  if(wnd) wnd.close();
  if(isNaN(parseInt(ww))||isNaN(parseInt(hh))) return;
  var rww=ww;var rhh=hh;var scr='no';
  var sww=screen.availWidth;var shh=screen.availHeight-30;
  var cww=Math.round(sww/2)-Math.round(ww/2); var chh=Math.round(shh/2)-Math.round(hh/2);
  if(ww>sww){cww=0;ww=sww;}if(hh>shh){chh=0;hh=shh;ww+=16;scr='yes';}if(ww>sww){ww -= 22;}
  var wnd=window.open('','','menubar=no,width='+ww+',height='+hh+',scrollbars='+scr+',resizeable=no,left='+cww+',top='+chh);
  var doc = wnd.document;
  doc.write('<html><head><title>Preview</title><head><body>');
  if (pic.substr (pic.length-4,4) != '.swf') doc.write('<img src="'+pic+'" border="0" width="'+rww+'" height="'+rhh+'" style="position:absolute;left:0px;top:0px">');
  else doc.write('<OBJECT style="position:absolute;left:0px;top:0px" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+rww+' HEIGHT='+rhh+'><PARAM NAME=movie VALUE="'+pic+'"> <PARAM NAME=quality VALUE=high><PARAM NAME=menu VALUE=false><EMBED style="position:absolute;left:0px;top:0px" src="'+pic+'" quality=high bgcolor=#FFFFFF  WIDTH='+rww+' HEIGHT='+rhh+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
  doc.write('</body></html>');
  wnd.focus();
}

function center_window (w, h)
{
  var left = Math.round (screen.availWidth / 2) - Math.round (w / 2);
  var top = Math.round (screen.availHeight / 2) - Math.round (h / 2);
  return 'left='+left+',top='+top;
}

function popup (file)
{
  var dati = 'menubar=no,width=486,height=320,scrollbars=yes,resizeable=no,'+center_window (486,320);
  var wind = window.open (file, 'popup', dati);
  wind.focus();
}

function goFromPopup (link)
{
	if (window.opener) {window.opener.location.href = link;}
  window.close();
}

function on(nos)
{
  if (document.images) {document[nos].src = eval(nos + "on.src"); }
}

function off(nos)
{
  if (document.images) {document[nos].src = eval(nos + "off.src");}
}

function goBookmark (f)
{
  window.location = "#" + f;
}

function checkForm (txt, chk)
{
  var r = /[ ]+/g
  var str = txt.value;
  str = str.replace (r, '');
  if (str == '') txt.value = '';
  if (str.length) chk.checked = true; else chk.checked = false;
}
function checkForm2 (txt, chk)
{
  var r = /[ ]+/g
  var str = txt.value;
  str = str.replace (r, '');
  if (str == '') txt.value = '';

  if(chk.checked == true)
  {
    txt.focus();
    if (txt.value == '' || txt.value == '0') {txt.value = '1';}
  }
}
