var HM_DOM = (document.getElementById) ? true : false;
var HM_NS4 = (document.layers) ? true : false;
var HM_IE = (document.all) ? true : false;
var HM_IE4 = HM_IE && !HM_DOM;
var HM_Mac = (navigator.appVersion.indexOf("Mac") != -1);
var HM_IE4M = HM_IE4 && HM_Mac;

function cpic(pic, ww, hh)
{
  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 wndname=pic;wndname=wndname.replace (/[^A-Z]+/gi, '');
  var wnd=window.open('',wndname,'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 ww = 460;
  var hh = 453;
  var dati = 'menubar=no,width='+ww+',height='+hh+',scrollbars=yes,resizeable=no,'+center_window (ww,hh);
  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 nav (iname, sw)
{
  if (HM_DOM)
  {
  	var d = 'none';
  	if (sw == 1) d = 'inline';
    document[iname].style.display = d;
  }
}

function isEmail (obj,sMessage)
{
  var r = /^[a-z0-9\._-]+@{1}[a-z0-9\._-]+\.{1}[a-z]{2,4}$/gi;
  var s = obj.value;
  if (!s.match (r)) 
  {
  	alert (sMessage);
  	return false;
  }
}

