var flagCaptcha = false; var flagFields = true; var message = 'Please fill in all mandatory fields ! \n'; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; function ajaxpage(url, containerid, requesttype){ var page_request = createRequestObject(); if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime(); page_request.open('GET', url+bustcacheparameter, true); page_request.send(null); page_request.onreadystatechange=function(){ loadpage(page_request, containerid); } } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) document.getElementById(containerid).innerHTML=page_request.responseText; } function ShowToolTip(object) { document.getElementById(object).style.visibility = 'visible'; } function HideToolTip(object) { document.getElementById(object).style.visibility = 'hidden'; } function pause(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis) } function editEvent1(dt,eid) { var loginElement = 'login' + eid; var loginValue = document.frm1[loginElement].value; if( loginValue != ""){ ajaxpage('/calendar/load-date-events.php?ac=edit_event&cid=1&dt='+dt+'&eid='+eid+'&l='+loginValue,'DateEvents1','get'); } else { alert("Enter Event Password!"); } } function checkEventForm(checkEmail){ re = /([0-9a-zA-Z\.\-\_]+)@([0-9a-zA-Z\.\-\_]+)\.([0-9a-zA-Z\.\-\_]+)/; var email, summary, description, dataRight = true; var message = ""; if(checkEmail) email = document.frm1.email.value; summary = document.frm1.summary.value; description = document.frm1.description.value; if (summary.length==0){ message += "\n - Title"; dataRight=false; } if (description.length==0){ message += "\n - Description"; dataRight=false; } if(checkEmail){ if (email.length==0){ message += "\n - Email"; dataRight=false; } if (email.length!=0 && email.match(re)==null){ dataRight=false; message += "\n - Email is incorrect"; } } if (!dataRight){ if (message != ""){ message ="\n You failed to correctly fill in the form:\n" + message; } alert(message); } return dataRight; } function saveEvent1(dt, month, year) { if(checkEventForm(true)){ var poststr = "ac=add_event&dt="+dt+"&sHour=" + encodeURIComponent( document.frm1.sHour.value ) + "&sMin=" + encodeURIComponent( document.frm1.sMin.value ) + "&sTime=" + encodeURIComponent( document.frm1.sTime.value ) + "&eHour=" + encodeURIComponent( document.frm1.eHour.value ) + "&eMin=" + encodeURIComponent( document.frm1.eMin.value ) + "&eTime=" + encodeURIComponent( document.frm1.eTime.value ) + "&eventColor=" + encodeURIComponent( document.frm1.eventColor.value ) + "&email=" + encodeURIComponent( document.frm1.email.value ) + "&summary=" + encodeURIComponent( document.frm1.summary.value ) + "&description=" + encodeURIComponent( document.frm1.description.value ); ajaxpage('/calendar/load-date-events.php?cid=1&'+poststr,'DateEvents1','get'); pause(500); ajaxpage('/calendar/load-calendar.php?cid=1&month='+month+'&year='+year,'EventCalendar1','get'); } }; function updateEvent1(eid,dt, month, year) { if(checkEventForm(false)){ var poststr = "ac=update_event&eid="+eid+"&dt="+dt+"&sHour=" + encodeURIComponent( document.frm1.sHour.value ) + "&sMin=" + encodeURIComponent( document.frm1.sMin.value ) + "&sTime=" + encodeURIComponent( document.frm1.sTime.value ) + "&eHour=" + encodeURIComponent( document.frm1.eHour.value ) + "&eMin=" + encodeURIComponent( document.frm1.eMin.value ) + "&eTime=" + encodeURIComponent( document.frm1.eTime.value ) + "&eventColor=" + encodeURIComponent( document.frm1.eventColor.value ) + "&summary=" + encodeURIComponent( document.frm1.summary.value ) + "&description=" + encodeURIComponent( document.frm1.description.value ); ajaxpage('/calendar/load-date-events.php?cid=1&'+poststr,'DateEvents1','get'); pause(500); ajaxpage('/calendar/load-calendar.php?cid=1&month='+month+'&year='+year,'EventCalendar1','get'); } }; loadCalendar = '
'; document.writeln(loadCalendar);