	
	function newWindow(bookgif) {
		bookWindow = window.open(bookgif,'bookWin','resizable=1,width=275,height=350,left=0,top=0')
		bookWindow.focus()
	}
	
	function gothere(mname){
		var thisform = mname;
		if (thisform.selectsite.options[thisform.selectsite.options.selectedIndex].value != "nolink") 
		{window.open(thisform.selectsite.options[thisform.selectsite.options.selectedIndex].value);}
	}

var months = ["OCTUBRE","NOVEMBRE","DESEMBRE","GENER","FEBRER","MARÇ","ABRIL","MAIG","JUNY","JULIOL","AGOST","SETEMBRE"];

var daycounts = [31,30,31,31,28,31,30,31,30,31,31,30]; //els anys bixests febrer 29 dies


var firstdays = [2,5,0,3,6,6,2,4,0,2,5,1];





//[des del dia,del mes,fins el dia,del mes,"missatge"]

var apps = [ 

[9,1,9,1,"Dia del PV"],

[12,1,12,1,"Pilar"],

[1,2,1,2,"Tots Sants"],

[6,3,8,3,"Constitució+Immaculada"],

[1,8,1,8,"Festa del treball"]

];

function CheckDate(month,dayno)

{

   var retval = new String(dayno);

   var m = month + 1;

   

   for(var app = 0; app < apps.length; app++)

   {

      if(m == apps[app][1] ) //primer mes

      {

         if(apps[app][3] - apps[app][1] > 0)

         {

            if(dayno >= apps[app][0])

            {

               retval = "<div class='hol' title='" + apps[app][4] + "'>" + dayno + "</div>";

            }

         }

         else

         {

            if(dayno >= apps[app][0] && dayno <= apps[app][2])

            {

               retval = "<div class='hol' title='" + apps[app][4] + "'>" + dayno + "</div>";

            }

         }

      }

      else if(m == apps[app][3]) // segon mes

      {

         if(dayno <= apps[app][2])

         {

            retval = "<div class='hol' title='" + apps[app][4] + "'>" + dayno + "</div>";

         }

      }

      else if( m > apps[app][1] && m < apps[app][3] )

      {    

         retval = "<div class='hol' title='" + apps[app][4] + "'>" + dayno + "</div>";

      }

   }



   return retval;

}



function PrintMes(month)

{

   var done = false;

   var day = 0;



   document.write("<table class='inner'><caption><b>" + months[month] + "</b></caption><thead>");

   document.write("<th>Dil</th><th>Dim</th><th>X</th><th>Dij</th><th>Div</th><th>Dis</th><th>Diu</th></thead>");

   while(!done)

   {

      document.write("<tr>");

      PrintWeek(month,day, firstdays[month], daycounts[month]);

      document.write("</tr>");

      day = day + 7;

      if( day > daycounts[month] + firstdays[month])

      {

         done = true;

      }

   }

   document.write("</tbody></table><p>");

}





function PrintWeek(monthno,start,min,max)

{

   var d;

   var desc;

   for(var j = 0; j < 7; j++)

   {

      document.write("<td>");

      d = start + j;

      if(d >= min && d < max + min)

      {

         desc = CheckDate(monthno,d - min + 1);

         document.write(desc);

      }

      document.write("</td>");

   }

}

