	function nextDay(){
		selectedDay = document.selectDate.selectDay.selectedIndex;	
		daysLength = document.selectDate.selectDay.length-1;
		selectedMonth = document.selectDate.month.selectedIndex;
		selectedYear = document.selectDate.year.selectedIndex;
		yearsLength = document.selectDate.year.length-1;
		
		if(selectedDay != daysLength){
			document.selectDate.selectDay.selectedIndex++;
			doSubmitDay();
		}else if(selectedMonth != 11){
			document.selectDate.day.value = 1;
			document.selectDate.month.selectedIndex++;
			submitDay();
		}else if(selectedYear != yearsLength){
			document.selectDate.day.value = 1;
			document.selectDate.month.selectedIndex = 0;
			document.selectDate.year.selectedIndex++;
			submitDay();
		}
	}
	
	function previousDay(){
		selectedDay = document.selectDate.selectDay.selectedIndex;	
		maxDay = document.selectDate.numberOfPreviousMonthDays.value;
		selectedMonth = document.selectDate.month.selectedIndex;
		selectedYear = document.selectDate.year.selectedIndex;
		
		if(selectedDay != 0){
			document.selectDate.selectDay.selectedIndex--;
			doSubmitDay();
		}else if(selectedMonth != 0){
			document.selectDate.day.value = maxDay;
			document.selectDate.month.selectedIndex--;
			submitDay();
		}else if(selectedYear != 0){
			document.selectDate.day.value = maxDay;
			document.selectDate.month.selectedIndex = 11;
			document.selectDate.year.selectedIndex--;
			submitDay();
		}
	}
	
	function nextMonth(){
		selectedMonth = document.selectDate.month.selectedIndex;
		selectedYear = document.selectDate.year.selectedIndex;
		yearsLength = document.selectDate.year.length-1;
		
		 if(selectedMonth != 11){
			document.selectDate.month.selectedIndex++;
		}else if(selectedYear != yearsLength){
			document.selectDate.month.selectedIndex = 0;
			document.selectDate.year.selectedIndex++;
		}
		doSubmitMonth();
	}
	
	function previousMonth(){
		selectedMonth = document.selectDate.month.selectedIndex;
		selectedYear = document.selectDate.year.selectedIndex;
		
		if(selectedMonth != 0){
			document.selectDate.month.selectedIndex--;
		}else if(selectedYear != 0){
			document.selectDate.month.selectedIndex = 11;
			document.selectDate.year.selectedIndex--;
		}
		doSubmitMonth();
	}
	
	
	function doSubmitDay(){
		document.selectDate.day.value = document.selectDate.selectDay.selectedIndex+1;
		submitDay();	
	}
	
	function submitDay(){
		loadDayByDate(document.selectDate.day.value,document.selectDate.month.value,document.selectDate.year.value);	
	}
	
	
	function doSubmitMonth(){
		loadMonthByDate(document.selectDate.month.value,document.selectDate.year.value);
	}
	
	function openInfoBlock(elementID){
		showBlock("additional_info_" + elementID);
	}

	function showBlock(elementID) {
		if(document.getElementById(elementID).style.display!='block') {
   			document.getElementById(elementID).style.display='block';
 		}
		else {
   			document.getElementById(elementID).style.display='none';
  		}
	}
	
	function hideBlock(elementID) {
		if(document.getElementById(elementID).style.display!='none') {
   			document.getElementById(elementID).style.display='none';
 		}
		else {
   			document.getElementById(elementID).style.display='block';
  		}
	}
	
	function showInline(elementID) {
 	    row = document.getElementById(elementID);
 	    if (row==null) {return;}
 	    
		if(row.style.display!='table-row' && row.style.display!='block') {
		 
	      // conditional compilation to hide the try-catch blocks from IE4
	      /*@cc_on @if(!@_jscript || (@_jscript_version >= 5)) @*/
	        try {
	          row.style.display = 'table-row';
	        } catch(e) {
	          row.style.display = 'block';
	        }
	      /*@elif(@_jscript_version < 5)
	        row.style.display = 'block'; // for IE4
	      @end @*/
		  document.getElementById("hidePassedEventsLink").style.display='inline';
 		  document.getElementById("showPassedEventsLink").style.display='none';
 		}
		else {
			document.getElementById("hidePassedEventsLink").style.display='none';
 		  	document.getElementById("showPassedEventsLink").style.display='inline';
  			row.style.display='none';
  		}
	}
	
function showOldEvents(todaysEvent){

	for(i=0; i<todaysEvent;i++){
		showInline("event_"+i);
		showInline("additional_info_"+i);
	}
}	

var otherCalendarTypes;
var downloadOptions=new Array("outlook2007_option", "vista_option", "netvibes_option","lotusnotes_option", "ical_option", "excel_option", "pdf_option", "outlook_option", "otherCalendarTypes");
function toggleDiv(id) {	
	var dOption;
	for (var i=0; i<downloadOptions.length; i++)
	{
		if (id!=downloadOptions[i]) {
			
			hideDivFadeAway(downloadOptions[i]);
		}
	}
	if (otherCalendarTypes == 1 && id == "otherCalendarTypes")
	{
		hideDivFadeAway(id);
		otherCalendarTypes = 0;
	}
	else
	{
		showDiv(id);
		if (id == "otherCalendarTypes")
			otherCalendarTypes = 1;
	}
}

var delayHideTimer;
	
function showDropDown (dropDownId) {
	clearHide(dropDownId);
	document.getElementById(dropDownId).style.display='block';
	loadCountryList();
}

function delayHide(dropDownId){
	delayHideTimer = setTimeout("hideDropDown('"+dropDownId+"')",500);
}

function hideDropDown (dropDownId) {
	document.getElementById(dropDownId).style.display='none';		
}

function clearHide() {
	if (typeof delayHideTimer != "undefined")
		clearTimeout(delayHideTimer)
}

function showDiv(id) {
	document.getElementById(id).style.display='block'; 
	opacity(id, 0, 100, 700); 

	//document.getElementById("header").style.height="200px";
	return false;
}

function hideDivFadeAway(id) {
	opacity(id, 100, 0, 700); 
	setTimeout("document.getElementById('"+id+"').style.display='none';",700);
	 
	return false;
}

function hideDiv(id) {
	opacity(id, 100, 0, 0); 
	document.getElementById(id).style.display='none'; 
	return false;
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function updateCalendarFormat(format, email)
{
	document.downloadForm.format.value=format;
	document.downloadForm.email.value=email;

	if (email == "")
	{
		document.getElementById('errorMail').style.display="block";
		return;
	}
	document.downloadForm.submit();
}

function showShareButton(link, domainname) {
		document.getElementById('shareImageOption').src='/assets/images/button-widget-small.png';
		document.getElementById('shareImageOption').style.display='block';
		document.shareForm.shareCode.value='<a href=\''+link+'\' onClick=\'window.open(\"'+link+'&css=share\", \"AddToCalendar\", \"height=445,width=595,scrollbars=1,location=0,screenX=350,screenY=50,top=50,left=350\"); return false;\'><img src=\'http://'+domainname+'/assets/images/button-widget-small.png\'  border=\'0\'/></a>';	
}

function showShareLargeBannerButton(link, domainname) {
		document.getElementById('shareImageOption').src='/assets/images/button-widget-big.png';
		document.getElementById('shareImageOption').style.display='block';
		document.shareForm.shareCode.value='<a href=\''+link+'\' onClick=\'window.open(\"'+link+'&css=share\", \"AddToCalendar\", \"height=445,width=595,scrollbars=1,location=0,screenX=350,screenY=50,top=50,left=350\"); return false;\'><img src=\'http://'+domainname+'/assets/images/button-widget-big.png\'  border=\'0\'/></a>';
}

function showShareSmallBannerButton(link, domainname) {
		document.getElementById('shareImageOption').src='/assets/images/button-small-banner.png';
		document.getElementById('shareImageOption').style.display='block';
		document.shareForm.shareCode.value='<a href=\''+link+'\' onClick=\'window.open(\"'+link+'&css=share\", \"AddToCalendar\", \"height=445,width=595,scrollbars=1,location=0,screenX=350,screenY=50,top=50,left=350\"); return false;\'><img src=\'http://'+domainname+'/assets/images/button-small-banner.png\'  border=\'0\'/></a>'
}

function showShareLink(link, domainname, linktext) {
		document.getElementById('shareImageOption').style.display='none';		

		document.shareForm.shareCode.value='<a href=\''+link+'\' onClick=\'window.open(\"'+link+'&css=share\", \"AddToCalendar\", \"height=445,width=595,scrollbars=1,location=0,screenX=350,screenY=50,top=50,left=350\"); return false;\'>'+linktext+'</a>';
	
}

function downloadCalendar()
{
	document.downloadForm.submit();
}

var isAlreadyEmptied = false;
function emptyCommentBox()
{
	if (!isAlreadyEmptied)
	{
		isAlreadyEmptied = true;
		document.getElementById('commentbox').value = "";
	}
} 

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function insertSearchTerm(){
	document.searchForm.searchTerm.value =document.searchForm.searchTerm.value;
}

function doSearch(){
	document.searchForm.searchTerm.value = document.searchForm.searchTerm.value;
	document.searchForm.submit();
}

function submitenter(field,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   field.form.submit();
   return false;
   }
else
   return true;
}


	function hidereviewbutton () {
	   		document.addReviewForm.saveReview.style.visibility='hidden';
	   		return true;
		}	