$(document).ready(function(){

				  if ( $('#header .logo a') ) {
				  $('#header .logo a').ifixpng(); 
				  $('#header .spcc-building').ifixpng(); 
				  }
				  if ($('div.scroll-banner-holder')){
				  $('div.scroll-banner-holder').css("display","none");
				  $('div.scroll-banner-holder').fadeIn(6000);
				  }
				  if ( $('#yearList') ){
				  $('#yearList').change(function() {
										var u = $('#baseURL').val();
										u += '/page/' + $(this).val();
										window.location = u;
										});
				  }
				if($(".sub li.active")) {
				$(".sub li.active").parent().parent().toggleClass("active");
				}


				  $('#search-form').submit(function() {
										   var str = $('#header-q').val();
										   window.location = 'http://www.google.com.hk/search?q=' + encodeURIComponent(str) + '+' + encodeURIComponent('site:www.spcc.edu.hk');
										   return false;
										   });
				  
				  
				  
				  if ( $('#school_calendar').length ) {
				  // ajax to get the events in school calendar of the given year, month
				  var mydate = new Date();
				  $('#school_calendar').load(ajaxURL + '/school_calendar/' + mydate.getFullYear() + '/' + (mydate.getMonth() + 1)
											 );
				  //				  $('#school_calendar').datepicker({
//												   changeYear: true,
//												   prevText: '<',
//												   nextText: '>',
//												   dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
//												   dateFormat: 'yy-mm-dd',
//												   yearRange: ((mydate.getFullYear() - 1) + ':' + (mydate.getFullYear() + 1)),
//												   onSelect: function(dateText, inst) { 
//												   var dateAy = $(this).val().split('-');
//												   if ( eventDays.indexOf(parseInt(dateAy[2])) >= 0 ) {
//												   location = schoolCalendarURL + '/date/' + $(this).val();
//												   } else {
//												   alert('ooops');
//												   }
//												   },
//												   beforeShowDay: function(date) {
//												   if ( eventDays.indexOf(date.getDate()) >= 0 ) {
//												   return new Array(true, 'event');
//												   }
//												   return new Array(true, '');
//												   
//												   },
//												   onChangeMonthYear: changeDateHandler,
//												   });
				  }
if($(".subpage #main .wrap")) {
	if ($(".subpage #main .wrap").height() < 480 ) {
		$(".subpage #main .wrap").height(481);
	}
}

  // Increase Font Size
  $("a.increaseFont").click(function(){
    var currentFontSize = $('body').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
	if( currentFontSizeNum < 16 ) {
    var newFontSize = currentFontSizeNum+2;
    $('body').css('font-size', newFontSize);
	}
    return false;
  });
  // Decrease Font Size
  $("a.decreaseFont").click(function(){
    var currentFontSize = $('body').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
	if( currentFontSizeNum > 8 ) {
    var newFontSize = currentFontSizeNum-2;
    $('body').css('font-size', newFontSize);
	}
    return false;
  });


});
				  var eventDays;
function changeDate(year, month) {
	$('#school_calendar').load(ajaxURL + '/school_calendar/' + year + '/' + month);
}
