/*
	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

/*
	This is a compiled version of Dojo, built for deployment and not for
	development. To get an editable version, please visit:

		http://dojotoolkit.org

	for documentation and information on getting the source.
*/

function closeInputBox(){
resetEventBox();
hideEventBoxErrors();
hide("eventDiv");
};
function closeEventListBox(){
hide("eventListDiv");
};
function closeDetailsBox(){
hide("eventDetailsDiv");
};
function hide(_1){
dojo.fadeOut({node:dojo.byId(_1),duration:500,onBegin:function(){
dojo.style(_1,"opacity","1");
},onEnd:function(){
dojo.style(_1,"display","none");
}}).play();
};
function closeUserListBox(){
var _2=document.userListForm;
if(_2.elements.removeUser){
var _3=_2.elements.removeUser;
if(_3&&_3.length>0){
for(var i=0;i<_3.length;i++){
var _5=_3[i].checked=false;
}
}
}
if(_2.elements.reAddUser){
var _6=_2.elements.reAddUser;
if(_6&&_6.length>0){
for(var j=0;j<_6.length;j++){
var _8=_6[j].checked=false;
}
}
}
hide("userListDiv");
var _9=dojo.byId("eventDetailsDiv");
dojo.fadeIn({node:_9,duration:500}).play();
return false;
};
function resetEventBox(){
document.calendarForm.title.value="";
document.calendarForm.location.value="";
document.calendarForm.hour.value="80";
document.calendarForm.minutes.value="90";
document.getElementsByName("amPm")[0].checked=false;
document.getElementsByName("amPm")[1].checked=false;
document.calendarForm.description.value="";
};
function hideEventBoxErrors(){
document.getElementById("titleSpan").style.visibility="hidden";
document.getElementById("locationSpan").style.visibility="hidden";
document.getElementById("amPmSpan").style.visibility="hidden";
};
function getPosX(e){
var _b=0;
if(!e){
e=window.event;
}
if(e.pageX){
_b=e.pageX;
}else{
if(e.clientX){
_b=e.clientX+document.body.scrollLeft;
}
}
return _b-7;
};
function getPosY(e){
var _d=0;
if(!e){
e=window.event;
}
if(e.pageY){
_d=e.pageY;
}else{
if(e.clientY){
_d=e.clientY+document.body.scrollTop;
}
}
if(_d>110){
_d-=170;
}
return _d;
};
function isPosXTooLarge(_e){
if(_e>900){
return true;
}
return false;
};
function adjustPosX(_f){
return _f-110;
};
function getParentPosX(id){
return dojo.byId(id).offsetLeft;
};
function getParentPosY(id){
return dojo.byId(id).offsetTop;
};
function validTime(){
var _12=document.calendarForm.hour.value;
var min=document.calendarForm.minutes.value;
if(_12>12&&min<60){
document.getElementById("timeSpan").style.visibility="visible";
return false;
}else{
if(_12<=12&&min>60){
document.calendarForm.minutes.value="00";
}
}
return true;
};
function validateEvent(){
hideEventBoxErrors();
var _14=false;
if(document.calendarForm.title.value===""){
_14=true;
document.getElementById("titleSpan").style.visibility="visible";
}
if(document.calendarForm.location.value===""){
_14=true;
document.getElementById("locationSpan").style.visibility="visible";
}
if(document.calendarForm.hour.value<12||document.calendarForm.minutes.value<60){
if(!validTime()){
_14=true;
}
if(document.calendarForm.amPm[0].checked==false&&document.calendarForm.amPm[1].checked==false){
_14=true;
document.getElementById("amPmSpan").style.visibility="visible";
}
}
if(_14){
return false;
}
return true;
};
function validateUser(){
if(document.userForm.username.value===""){
document.getElementById("userSpan").style.visibility="visible";
return false;
}
return true;
};
function takeYear(_15){
x=_15.getYear();
var y=x%100;
y+=(y<38)?2000:1900;
return y;
};
function adjustForTooltipArrow(elm,_18){
if(_18){
dojo.removeClass(elm,"dijitTooltipABLeft");
dojo.addClass(elm,"dijitTooltipABRight");
}else{
if(dojo.hasClass(elm,"dijitTooltipABRight")){
dojo.removeClass(elm,"dijitTooltipABRight");
dojo.addClass(elm,"dijitTooltipABLeft");
}
}
};
function addCalendarEvent(e,day,_1b){
var col=document.getElementsByName("eventDetails");
if(col){
for(var i=0;i<col.length;i++){
var _1e=col[i];
if(_1e.style.display==="block"){
return false;
}
}
}
var _1f=new Date(_1b);
var _20;
if(_1f){
_20=new Date(_1f.getFullYear(),_1f.getMonth(),day);
var _21=(_20.getMonth()+1)+"/"+_20.getDate();
document.getElementById("monthYear").value=_21+"/"+takeYear(_20);
document.getElementById("showDate").innerHTML=_21;
}
document.getElementById("day").value=day;
var _22=getPosX(e);
var _23=getPosY(e);
var _24=isPosXTooLarge(_22);
if(_24){
_22=adjustPosX(_22);
_22-=75;
}
var _25=dojo.byId("eventDiv");
adjustForTooltipArrow(_25,_24);
dojo.style(_25,{left:_22+"px",top:(_23-30)+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:_25,duration:500}).play();
return false;
};
function addUserToEvent(e,_27){
if(document.getElementById("eventDiv").style.display==="block"){
return false;
}
document.getElementById("eventId").value=_27;
var _28=getPosX(e);
var _29=getPosY(e);
var _2a=dojo.byId("eventUserDiv");
dojo.style(_2a,{left:_28+"px",top:_29+"px",display:"block"});
return false;
};
function saveEvent(){
if(!validateEvent()){
return false;
}
var _2b=document.calendarForm;
var _2c=_2b.day.value;
var p={calId:_2b.calId.value,title:_2b.title.value,day:_2c,monthYear:_2b.monthYear.value,hour:_2b.hour.value,minutes:_2b.minutes.value,amPm:_2b.amPm.value,description:_2b.description.value,location:_2b.location.value,userId:_2b.userId.value};
closeInputBox();
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=addEvent",handleAs:"text",timeout:2000,content:p,load:function(_2e){
dojo.byId("day"+_2c).innerHTML=_2e;
},error:function(_2f){
dojo.byId("day"+_2c).innerHTML="Sorry... there was an error adding this event.<br />Please close this box and try again.";
}});
};
function updateEvent(){
var _30=dojo.byId("calendarForm");
var _31={calId:_30.calId.value,eventId:_30.eventId.value,title:_30.title.value,day:_30.day.value,monthYear:_30.monthYear.value,hour:_30.hour.value,minute:_30.minutes.value,amPm:_30.amPm.value,description:_30.description.value,location:_30.location.value,addedBy:_30.userId.value};
var _32=dojo.byId("eventDiv");
var _33=dojo.style(_32,"left");
var _34=dojo.style(_32,"top");
closeInputBox();
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=updateEvent",content:_31,handleAs:"text",timeout:2000,load:function(_35){
var _36=dojo.byId("eventDetailsDiv");
_36.innerHTML=_35;
dojo.style(_36,{left:_33+"px",top:_34+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:_36,duration:500}).play();
},error:function(_37){
var _38=dojo.byId("eventDetailsDiv").innerHTML="Sorry... there was an error updating.<br />Please close this box and try again.";
}});
};
function saveSessionUser(cid,eid,day){
var _3c={calId:cid,eventId:eid,day:day};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=saveSessionUser",content:_3c,handleAs:"text",timeout:2000,load:function(_3d){
var elm=dojo.byId("eventDetailsDiv");
elm.innerHTML=_3d;
var _3f=dojo.style(elm,"left");
var _40=dojo.style(elm,"top");
dojo.style(elm,{left:_3f+"px",top:_40+"px",display:"block"});
}});
};
function removeSessionUser(_41,_42,_43){
var _44={calId:_41,eventId:_42,calUserId:_43};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=deleteSessionUser",content:_44,handleAs:"text",timeout:2000,load:function(_45){
var elm=dojo.byId("eventDetailsDiv");
elm.innerHTML=_45;
var _47=dojo.style(elm,"left");
var _48=dojo.style(elm,"top");
dojo.style(elm,{left:_47+"px",top:_48+"px",display:"block"});
}});
};
function showEvent(e,_4a,_4b,_4c,_4d){
var _4e=getPosX(e);
var _4f=getPosY(e);
if(_4d&&_4d==true){
var _50=dojo.byId("eventListDiv");
_4e=dojo.style(_50,"left");
_4f=dojo.style(_50,"top")-60;
closeEventListBox();
}
if(dojo.byId("eventDiv").style.display=="block"||dojo.byId("eventDetailsDiv").style.display=="block"){
return false;
}
var _51=isPosXTooLarge(_4e);
if(_51){
_4e=adjustPosX(_4e);
}
function _52(){
var _53={calId:_4a,eventId:_4c,day:_4b};
var elm=dojo.byId("eventDetailsDiv");
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=showEventDetails",content:_53,timeout:2000,handleAs:"text",load:function(_55){
elm.innerHTML=_55;
adjustForTooltipArrow(elm,_51);
dojo.style(elm,{left:_4e+"px",top:_4f+10+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:elm,duration:500}).play();
},error:function(_56){
dojo.byId("eventDetailsDiv").innerHTML="Sorry... there was an error retrieving the event.<br /> Close close this box and try again.";
}});
};
return setTimeout(_52,500);
};
function deleteEvent(_57,_58,_59,_5a){
closeDetailsBox();
var _5b={calId:_57,eventId:_58,userId:_59,day:_5a};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=deleteEvent",content:_5b,handleAs:"text",timeout:2000,load:function(_5c){
dojo.byId("day"+_5a).innerHTML=_5c;
}});
};
function showUpdateBox(e,_5e,_5f,day){
var x=getPosX(e);
var y=getPosY(e);
closeDetailsBox();
var _63=isPosXTooLarge(x);
if(_63){
x=adjustPosX(x);
}
var _64={calId:_5e,eventId:_5f,day:day};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=getEventForUpdate",content:_64,handleAs:"text",timeout:2000,load:function(_65){
var _66=dojo.byId("eventDiv");
_66.innerHTML=_65;
dojo.byId("day").value=day;
adjustForTooltipArrow(_66,_63);
dojo.style(_66,{left:x-70+"px",top:y-20+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:_66,delay:500,duration:500}).play();
}});
};
function showAllUsers(_67,_68,_69){
var x=getParentPosX("eventDetailsDiv");
var y=getParentPosY("eventDetailsDiv");
dojo.style(dojo.byId("eventDetailsDiv"),"opacity","0.5");
var _6c={calId:_67,eventId:_68,day:_69};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=showUserList",content:_6c,handleAs:"text",timeout:2000,load:function(_6d){
var _6e=dojo.byId("userListDiv");
_6e.innerHTML=_6d;
adjustForTooltipArrow(_6e,isPosXTooLarge(x));
dojo.style(_6e,{left:x+10+"px",top:y-10+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:_6e,duration:500}).play();
}});
};
function getChecked(_6f){
var _70=[];
if(undefined!=_6f.length){
for(var i=0;i<_6f.length;i++){
if(_6f[i].checked==true){
_70.push(_6f[i].value);
}
}
}else{
if(_6f.checked){
_70[0]=_6f.value;
}
}
return _70;
};
function expandEventDetails(e,_73,_74){
if(dojo.byId("eventListDiv").style.display=="block"||dojo.byId("eventDiv").style.display=="block"||dojo.byId("eventDetailsDiv").style.display=="block"){
return false;
}
var x=getPosX(e);
var y=getPosY(e);
var _77=isPosXTooLarge(x);
if(_77){
x=adjustPosX(x)+50;
}
function _78(){
var _79={calId:_73,dayId:_74};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=list",content:_79,handleAs:"text",timeout:2000,load:function(_7a){
var _7b=dojo.byId("eventListDiv");
_7b.innerHTML=_7a;
adjustForTooltipArrow(_7b,_77);
dojo.style(_7b,{left:x-10+"px",top:y+40+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:_7b,duration:500}).play();
}});
};
return setTimeout(_78,500);
};
function moderateUsers(_7c,_7d,_7e){
var x=getParentPosX("userListDiv");
var y=getParentPosY("userListDiv");
dojo.style(dojo.byId("eventDetailsDiv"),"opacity","0.5");
var del=null;
var add=null;
if(document.userListForm){
if(document.userListForm.elements["removeUser"]){
del=getChecked(document.userListForm.elements["removeUser"]);
}
if(document.userListForm.elements["reAddUser"]){
add=getChecked(document.userListForm.elements["reAddUser"]);
}
}
var _83={calId:_7c,eventId:_7d,day:_7e,toDelete:del,toAdd:add};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=moderateUserList",content:_83,handleAs:"text",timeout:2000,load:function(_84){
var _85=dojo.byId("eventDetailsDiv");
_85.innerHTML=_84;
closeUserListBox();
dojo.style(_85,{left:x+"px",top:y+"px",display:"block",opacity:"0"});
dojo.fadeIn({node:_85,duration:500}).play();
}});
};
function changeMonth(_86,_87,_88,_89){
var _8a={forumId:_86,month:_87,year:_88,direction:_89};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=changeMonth",content:_8a,handleAs:"text",timeout:2000,load:function(_8b){
dojo.byId("calendar").innerHTML=_8b;
}});
};
function getCalendar(_8c){
var _8d={forumId:_8c};
dojo.xhrPost({url:"/jforum"+SERVLET_EXTENSION+"?module=calendar&action=getCalendar",content:_8d,handleAs:"text",timeout:2000,load:function(_8e){
dojo.byId("calendar").innerHTML=_8e;
}});
};
