// JavaScript Document
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' non ? un indirizzo e-mail valido.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' deve contenere un numero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' deve contenere un numero tra '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' richiesta.\n'; }
  } if (errors) alert('Si ? riscontrato il seguente errore:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function sendText(e, text)
{
e.value += text
}

function ver(){
 if(document.contatti.accetto_privacy[1].checked==true){
  alert('La richiesta non pu? essere processata.\nSi prega di spuntare il check box per il trattamento dei dati personali.')
  return false;
 }
}

 function printpage()
{
  if (window.print)
  {
    window.print();
  }
  else
  {
    alert('Funzione stampa non supportata da questo browser.');
  }
}

function mmLoadMenus() {
  if (window.mm_menu_0805132840_0) return;
  window.mm_menu_0805132840_0 = new Menu("root",100,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FF3300","#FF9933","#990000","#5C0D05","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0805132840_0.addMenuItem("Statuto","location='http://www.mayadance.com/pagine/statuto.php'");
    mm_menu_0805132840_0.addMenuItem("Scuola&nbsp;di&nbsp;Danza","location='http://www.mayadance.com/pagine/scuola_danza.php'");
    //mm_menu_0805132840_0.addMenuItem("Link","location='http://www.mayadance.com/servizi/link/index.php'");    
   mm_menu_0805132840_0.hideOnMouseOut=true;
   mm_menu_0805132840_0.bgColor='#990000';
   mm_menu_0805132840_0.menuBorder=1;
   mm_menu_0805132840_0.menuLiteBgColor='#990000';
   mm_menu_0805132840_0.menuBorderBgColor='#990000';
   
     window.mm_menu_0805133608_0 = new Menu("root",140,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FF3300","#FF9933","#990000","#5C0D05","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
   mm_menu_0805133608_0.addMenuItem("Modern&nbsp;Oriental&nbsp;Dance","location='http://www.mayadance.com/pagine/modern_oriental_dance.php'");
   mm_menu_0805133608_0.hideOnMouseOut=true;
   mm_menu_0805133608_0.bgColor='#990000';
   mm_menu_0805133608_0.menuBorder=1;
   mm_menu_0805133608_0.menuLiteBgColor='#990000';
   mm_menu_0805133608_0.menuBorderBgColor='#990000';

  window.mm_menu_0805133236_0 = new Menu("root",60,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FF3300","#FF9933","#990000","#5C0D05","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
    mm_menu_0805133236_0.addMenuItem("Stage","location='http://www.mayadance.com/servizi/corsi/stage.php'");
   mm_menu_0805133236_0.hideOnMouseOut=true;
   mm_menu_0805133236_0.bgColor='#990000';
   mm_menu_0805133236_0.menuBorder=1;
   mm_menu_0805133236_0.menuLiteBgColor='#990000';
   mm_menu_0805133236_0.menuBorderBgColor='#990000';
   
     window.mm_menu_0805133216_0 = new Menu("root",140,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FF3300","#FF9933","#990000","#5C0D05","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
    mm_menu_0805133216_0.addMenuItem("Iscrizione associazione","location='http://www.mayadance.com/servizi/registrazione/index.php'");
    mm_menu_0805133216_0.addMenuItem("Guest book","location='http://www.mayadance.com/servizi/guest/index.php'");

mm_menu_0805133216_0.hideOnMouseOut=true;
   mm_menu_0805133216_0.bgColor='#990000';
   mm_menu_0805133216_0.menuBorder=1;
   mm_menu_0805133216_0.menuLiteBgColor='#990000';
   mm_menu_0805133216_0.menuBorderBgColor='#990000';
   
        window.mm_menu_0805133233_0 = new Menu("root",80,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FF3300","#FF9933","#990000","#5C0D05","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
    mm_menu_0805133233_0.addMenuItem("Photogallery","location='http://www.mayadance.com/servizi/gallery/index.php'");
    mm_menu_0805133233_0.addMenuItem("Video","location='http://www.mayadance.com/pagine/video.php'");
   mm_menu_0805133233_0.hideOnMouseOut=true;
   mm_menu_0805133233_0.bgColor='#990000';
   mm_menu_0805133233_0.menuBorder=1;
   mm_menu_0805133233_0.menuLiteBgColor='#990000';
   mm_menu_0805133233_0.menuBorderBgColor='#990000';



mm_menu_0805133608_0.writeMenus();
} // mmLoadMenus()
//-->



var dofade=true;     // ENABLES FADE-IN EFFECT FOR IE4+ AND NS6 ONLY
var center=true;     // CENTERS THE BOX UNER THE MOUSE, OTHERWISE DISPLAYS BOX TO THE RIGHT OF THE MOUSE
var centertext=false; // CENTERS THE TEXT INSIDE THE BOX. YOU CAN'T SIMPLY DO THIS VIA STYLE BECAUSE OF NS4.
                     // OTHERWISE, TEXT IS LEFT-JUSTIFIED. 


////////////////////////////// NO NEED TO EDIT BEYOND THIS POINT //////////////////////////////////////

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var w_y, w_x, navtxt, boxheight, boxwidth;
var ishover=false;
var isloaded=false;
var ieop=0;
var op_id=0;

function getwindowdims(){
w_y=(NS4||NS6)? window.innerHeight : (IE5||IE4)? document.body.clientHeight : 0;
w_x=(NS4||NS6)? window.innerWidth : (IE5||IE4)? document.body.clientWidth : 0;
}

function getboxwidth(){
if(NS4)boxwidth=(navtxt.document.width)? navtxt.document.width : navtxt.clip.width;
if(IE5||IE4)boxwidth=(navtxt.style.pixelWidth)? navtxt.style.pixelWidth : navtxt.offsetWidth;
if(NS6)boxwidth=(navtxt.style.width)? parseInt(navtxt.style.width) : parseInt(navtxt.offsetWidth);
}

function getboxheight(){
if(NS4)boxheight=(navtxt.document.height)? navtxt.document.height : navtxt.clip.height;
if(IE4||IE5)boxheight=(navtxt.style.pixelHeight)? navtxt.style.pixelHeight : navtxt.offsetHeight;
if(NS6)boxheight=parseInt(navtxt.offsetHeight);
}

function movenavtxt(x,y){
if(NS4)navtxt.moveTo(x,y);
if(W3C||IE4){
navtxt.style.left=x+'px';
navtxt.style.top=y+'px';
}}

function getpagescrolly(){
if(NS4||NS6)return window.pageYOffset;
if(IE5||IE4)return document.body.scrollTop;
}

function getpagescrollx(){
if(NS4||NS6)return window.pageXOffset;
if(IE5||IE4)return document.body.scrollLeft;
}

function writeindiv(text){
if(NS4){
navtxt.document.open();
navtxt.document.write(text);
navtxt.document.close();
}
if(W3C||IE4)navtxt.innerHTML=text;
}

//**** END UTILITY FUNCTIONS ****//

function image(text){
if(isloaded){
if(text!=0){
ishover=true;
if(NS4)text='<div class="navtext">'+((centertext)?'<center>':'')+text+((centertext)?'</center>':'')+'</div>';
writeindiv(text);
getboxheight();
if((W3C || IE4) && dofade){
ieop=0;
incropacity();
}}else{
if(NS4)navtxt.visibility="hide";
if(IE4||W3C){
if(dofade)clearTimeout(op_id);
navtxt.style.visibility="hidden";
}
writeindiv('');
ishover=false;
}}}

function incropacity(){
if(ieop<=100){
ieop+=4;
if(IE4 || IE5)navtxt.style.filter="alpha(opacity="+ieop+")";
if(NS6)navtxt.style.MozOpacity=ieop/100;
op_id=setTimeout('incropacity()', 50);
}}

function moveobj(evt){
if(isloaded && ishover){
margin=(IE4||IE5)? 1 : 23;
if(NS6)if(document.height+27-window.innerHeight<0)margin=15;
if(NS4)if(document.height-window.innerHeight<0)margin=10;
//mx=(NS4||NS6)? evt.pageX : (IE5||IE4)? event.clientX : 0;
//my=(NS4||NS6)? evt.pageY : (IE5||IE4)? event.clientY : 0;
if (NS4){
mx=evt.pageX
my=evt.pageY
}
else if (NS6){
mx=evt.clientX
my=evt.clientY
}
else if (IE5){
mx=event.clientX
my=event.clientY
}
else if (IE4){
mx=0
my=0
}

if(NS4){
mx-=getpagescrollx();
my-=getpagescrolly();
}
xoff=(center)? mx-boxwidth/2 : mx+5;
yoff=(my+boxheight+30-getpagescrolly()+margin>=w_y)? -15-boxheight: 30;
movenavtxt( Math.min(w_x-boxwidth-margin , Math.max(2,xoff))+getpagescrollx() , my+yoff+getpagescrolly());
if(NS4)navtxt.visibility="show";
if(W3C||IE4)navtxt.style.visibility="visible";
}}

if(NS4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;
window.onload=function(){
  navtxt=(NS4)? document.layers['navtxt'] : (IE4)? document.all['navtxt'] : (W3C)? document.getElementById('navtxt') : null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  isloaded=true;
  if((W3C || IE4) && centertext)navtxt.style.textAlign="center";
  if(W3C)navtxt.style.padding='4px';
  if(IE4 || IE5 && dofade)navtxt.style.filter="alpha(opacity=0)";
  }
window.onresize=getwindowdims;

function popup(str) {
searchWin =window.open(str,'popup','scrollbars=yes,resizable=no,width=550,height=550,status=no,location=no,toolbar=no');
}
