///////////////////////////////////////////////////////
//
// localendar.com - Common.js
//
///////////////////////////////////////////////////////
var ppcIE =((navigator.appName == "Microsoft Internet Explorer") || ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion)==5)));
var ppcNN6 =((navigator.appName == "Netscape") && (parseInt(navigator.appVersion)==5));
var ppcNN =((navigator.appName == "Netscape")&&(document.layers)) ;
var posX = 4;
var posY = 4;
var now = new Date(); //"<= startDate >");
var eventWindow;
function today()
{
var result = ""
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = (d.getFullYear()+"").substring(2,4);
if (curr_month<10)
result+="0";
result += curr_month + "-";
if (curr_date<10)
result+="0";
result+=curr_date + "-" + curr_year;
return result
}
function getPos(atImg)
{
// MO: Using jQuery to get position 2/1/10
var position=$('#'+atImg).offset();
posX=position.left;
posY=position.top;
/*
if ( ppcIE )
{
posX = getOffsetLeft(document.images[atImg]);
posY = getOffsetTop(document.images[atImg]) + document.images[atImg].height;
}
else if (ppcNN)
{
posX = document.images[atImg].x;
posY = document.images[atImg].y + document.images[atImg].height;
}
*/
}
function fn_chg_color(lcfield,pcolor){
fn_chk_color(lcfield,pcolor);
}
function fn_chk_color(lcfield,pcolor){
var numStr = "0123456789ABCDEFabcdef";
if (pcolor.length==0) return true;
for (i = 0; i < pcolor.length; i++) {
thisChar = pcolor.charAt(i);
if (numStr.indexOf(thisChar) == -1){
$.Zebra_Dialog("Please enter a valid six character hexidecimal color value.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcfield.value = '';
return false;
}
}
if (pcolor.length!=6){
$.Zebra_Dialog("Please enter a valid six character hexidecimal color value.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcfield.value = '';
return false;
}
lcfield.value = pcolor;
return true;
}
function validateNewUser(lcform){
var retval = true;
if (( !isEmail(lcform)) /*|| (!isLocation(lcform))*/ || (! isName(lcform)) || (! checkPassword(lcform)) || (! checkAgree(lcform)) || (!checkTimezone(lcform)) ){
retval=false;
}
else {
if (lcform.country.value=="USA")
retval = checkZip(lcform);
else
retval = checkCountry(lcform)
}
return retval;
}
function checkSelect(lcform){
var w = eval("document." + lcform.name + ".event_category");
var count = 0;
for (var x = 0; x < w.length; x++)
{
if (lcform.event_category[x].checked)
{ count++ }
}
if (count == 0 )
{
$.Zebra_Dialog("Please select at least one category", {
'type': 'error',
'overlay_opacity': .5,
'title': 'No Categories Selected'
});
lcform.event_category[0].focus();
return false;
}
return true;
}
function category_check(lcform,pvalue){
var w = eval("document." + lcform.name + ".event_category");
for (var x = 0; x < w.length; x++) {
if (pvalue == 'all'){
w[x].checked = true;
}else {
w[x].checked = false;
}
}
}
function popup(info){
var view_window;
var lcf;
info=info.toUpperCase();
if (info=="HELP") lcf="FAQ";
if (info=="LEGAL") lcf="Legal";
if (info=="A1CLEGAL") lcf="A1CLEGAL";
if (info=="PRIVACY") lcf="Privacy";
if (info=="A1CPRIVACY") lcf="A1CPRIVACY";
// if (info=="PRINTCAL") lcf="PrintableCalendar";
view_window = window.open("/elsie?JSP="+lcf+"&context=None", "localendar", "width=500,height=500,scrollbars=yes,resizable=yes");
view_window.focus();
}
function popupEventAdd()
{
view_window = window.open("/elsie?JSP=EventEditorAnon", "localendar", "width=545,height=550,menubar=yes,scrollbars=yes,resizable=yes");
}
function popupPrintableCalendar()
{
var view_window = window.open("/elsie?JSP=PrintableCalendar&context=None", "printablelocalendar", "toolbar=yes,menubar=yes,width=700,height=600,scrollbars=yes,resizable=yes");
view_window.focus();
}
function lc_navjump(p_direction,p_menutype,p_startdate){
window.location.href="/elsie?JSP=Calendar&mode=MONTH_"+p_direction+"&menu_type="+p_menutype+"&start_date="+p_startdate;
}
function lc_dayjump(p_menutype,p_date){
window.location.href="/elsie?JSP=Calendar&menu_type="+p_menutype+"&start_date="+p_date;
}
function lc_weekjump(p_menutype,p_date){
window.location.href="/elsie?JSP=Calendar&menu_type="+p_menutype+"&start_date="+p_date;
}
function lc_monthjump(p_menutype,p_date){
window.location.href="/elsie?JSP=Calendar&menu_type="+p_menutype+"&start_date="+p_date;
}
function lc_yearjump(p_menutype,p_date){
window.location.href="/elsie?JSP=Calendar&menu_type="+p_menutype+"&start_date="+p_date;
}
/*
function lc_publishjump(p_menutype,p_date,p_calendarid,p_rsslink){
window.location.href="/elsie?JSP=PublishedCalendar&mode=PUBLISH_PUBLIC&search_type="+p_menutype+"&start_date="+p_date+"&calendar_id="+p_calendarid+"&rss_link="+p_rsslink;
}
*/
function lc_searchjump(p_lat,p_lon,p_radius,p_date,p_type){
window.location.href="/elsie?JSP=SearchResults&mode=ADVSEARCH&member_lat="+p_lat+"&member_long="+p_lon+"&radius="+p_radius+"&start_date="+p_date+"&search_type="+p_type;
}
function lc_pubsearchjump(p_lat,p_lon,p_radius,p_date,p_type){
window.location.href="/elsie?JSP=PublishedSearch&mode=PUBSEARCH&membar_lat="+p_lat+"&member_long="+p_lon+"&radius="+p_radius+"&start_date="+p_date+"&search_type="+p_type;
}
function HelpWindow(vers){
var view_window;
view_window = window.open(('https:' == document.location.protocol ? 'https://' : 'http://')+"www.localendar.com/docs/display/lc");
view_window.title = "FAQ";
view_window.focus();
}
function AddEvent(eventDate){
var target = "/elsie?DAM=EventEditor";
if (eventDate!=null){
target+="&eventDate="+eventDate;
}
window.location.href= target;
}
function Preferences(){
window.location.href="/elsie?JSP=PreferencesGeneral"
}
function Search(){
window.location.href="/elsie?JSP=Search"
}
function PublicEventDetail(m, calendar_id,event_id,more_info,exportDate,category)
{
if (eventWindow){
eventWindow.close();
}
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
var left = ((screen.width / 2) - (400 / 2)) + dualScreenLeft;
var top = ((screen.height / 2) - (510 / 2)) + dualScreenTop;
eventWindow = window.open(('https:' == document.location.protocol ? 'https://' : 'http://')+"localendar.com/event?DAM=PublishedEvent&m="+m+"&event_id="+event_id+"&calendar_id="+calendar_id+"&more_info="+more_info+"&export_date="+exportDate+"&category="+category, "previewevent", "scrollbars=yes,resizable=yes,width=400, height=510, top=" + top + ", left=" + left);
if (window.focus) {
eventWindow.focus();
}
}
function zipSearchSubmit(lcform)
{
var c = lcform.city.value;
if (c.length < 3)
{
$.Zebra_Dialog("Please enter at least the first 3 characters of the city", {
'type': 'warning',
'overlay_opacity': .5,
'title': 'Insufficient Information'
});
return false;
}
return true;
}
function checkAdvSearch(lcform)
{
var addressOK = "";
addressOK = $('#member_lat').val();
if (addressOK==null || addressOK=="" || addressOK=="null"){
$.Zebra_Dialog("Please provide a valid geographic location for searching", {
'type': 'warning',
'overlay_opacity': .5,
'title': 'Insufficient Information'
});
return false;
}
else {
return true;
}
}
function prefsGeneralSubmit(lcform)
{
if (checkDayViewRange(lcform))
return true;
else
return false;
}
function isNumber(data)
{
var numStr = "0123456789";
for (i = 0; i < data.length; i++)
{
thisChar = data.charAt(i);
if (numStr.indexOf(thisChar) == -1)
return false;
}
return true;
}
function checkCountry(lcform)
{
if (lcform.country.value=="---"){
$.Zebra_Dialog("Please select your country", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
return false;
}
else
return true;
}
function checkTimezone(lcform)
{
if (lcform.timezone.value=="---"){
$.Zebra_Dialog("Please select your timezone", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
return false;
}
else
return true;
}
function checkZip(lcform)
{
var zipcode = lcform.zip.value;
if (zipcode!="00000"&& ((!isNumber(zipcode)) || zipcode == "" || zipcode.length != 5) )
{
$.Zebra_Dialog("Please enter a valid 5 digit zipcode", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.zip.focus();
return false;
}
return true;
}
function checkDayViewRange(lcform)
{
var dayStart = lcform.dayStart.selectedIndex+1;
var dayEnd = lcform.dayEnd.selectedIndex+1;
if (dayEnd<=dayStart)
{
$.Zebra_Dialog("Please make sure the day-view 'To:' hour is later than the 'From:' hour.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.dayStart.focus();
return false;
}
return true;
}
// if you put one space in then it passes
function checkSubject(lcform)
{
var subject = lcform.event_title.value;
if (subject == "")
{
$.Zebra_Dialog("You must supply a title for this event", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.event_title.select();
return false;
}
return true;
}
function checkChangeMemberLogon(lcform)
{
var str = lcform.username.value;
// Return false if characters are not a-z, A-Z, or 1-9.
for (var i = 0; i < str.length; i++)
{
var ch = str.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || "9" < ch)) || ch ==' ' && ch != '.')
{
if (ch!='_' && ch!='-')
{
$.Zebra_Dialog("The Account name may only consist of letters & numbers (spaces are not allowed).
Please change your Account name.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.username.select();
lcform.username.focus();
return false;
}
}
}
return true;
}
function isName(lcform)
{
var str = lcform.username.value;
// Return false if name field is blank.
if (str == "")
{
$.Zebra_Dialog("The Account Name is blank.
Please enter your Account name.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.username.focus();
return false;
}
return checkChangeMemberLogon(lcform);
}
function isEmail(lcform)
{
// Return false if e-mail field is blank.
var str = lcform.email.value;
if (str == "")
{
$.Zebra_Dialog("The Email Address is blank.
Please enter your email address.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.email.focus();
return false;
}
// Return false if e-mail field does not contain a '@' and '.' .
if (str.indexOf ('@',0) == -1 || str.indexOf ('.',0) == -1){
$.Zebra_Dialog("Please enter a valid email address.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.email.select();
lcform.email.focus();
return false;
}
return true;
}
function isLocation(lcform)
{
// Return false if e-mail field is blank.
var str = lcform.member_location_desc.value;
if (str == "")
{
$.Zebra_Dialog("Please enter a valid location.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.member_phys_address.focus();
return false;
}
return true;
}
function checkPassword(lcform)
{
var pw1 = lcform.password.value;
var pw2 = lcform.confirmpw.value;
// Return false if pw don't match.
if (lcform.password.value == "")
{
$.Zebra_Dialog("The Password field is blank.
Please enter your password.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.password.focus();
return false;
}
if (lcform.confirmpw.value == "")
{
$.Zebra_Dialog("The Re-Enter Password field is blank.
Please enter your password again in the Re-Enter Password field.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.confirmpw.focus();
return false;
}
if (pw1 != pw2)
{
$.Zebra_Dialog("The Passwords you entered do not match.
Please check your entries.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.password.select();
lcform.password.focus();
return false;
}
if (pw1.length<6)
{
$.Zebra_Dialog("Please enter a password that is at least 6 characters long.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.password.select();
lcform.password.focus();
return false;
}
// Return false if characters are not '0-9' or '.' .
for (var i = 0; i < pw1.length; i++)
{
var ch = pw1.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || "9" < ch)) || ch ==' ' && ch != '.')
{
if (ch!='_' && ch!='-')
{
$.Zebra_Dialog("The Password field only accepts letters & numbers (spaces are not allowed).
Please change your password.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.password.select();
lcform.password.focus();
return false;
}
}
}
return true;
}
function checkChangePassword(lcform)
{
var old_pw = lcform.password.value;
var new_pw1 = lcform.newpassword.value;
var new_pw2 = lcform.confirmpw.value;
if (old_pw == "")
{
$.Zebra_Dialog("The Password field is blank.
Please enter your password.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.password.focus();
return false;
}
if (new_pw2 == "")
{
$.Zebra_Dialog("The Confirm Password field is blank.
Please enter your password again in the Confirm Password field.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.confirmpw.focus();
return false;
}
if (new_pw1 != new_pw2)
{
$.Zebra_Dialog("The Passwords you entered do not match.
Please check your entries.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
}); lcform.newpassword.select();
lcform.newpassword.focus();
return false;
}
if (new_pw1.length<6)
{
$.Zebra_Dialog("Please enter a password that is at least 6 characters long.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.password.select();
lcform.password.focus();
return false;
}
// Return false if characters are not '0-9' or '.' .
for (var i = 0; i < new_pw1.length; i++)
{
var ch = new_pw1.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || "9" < ch)) || ch ==' ' && ch != '.')
{
if (ch!='_' && ch!='-')
{
$.Zebra_Dialog("The Password field only accepts letters & numbers (spaces are not allowed).
Please change your password.", {
'type': 'error',
'overlay_opacity': .5,
'title': 'Validation Error'
});
lcform.newpassword.select();
lcform.newpassword.focus();
return false;
}
}
}
return true;
}
function checkAgree(lcform)
{
if (!lcform.agree.checked)
{
$.Zebra_Dialog("Please indicate that you accept the Terms of Service", {
'type': 'warning',
'overlay_opacity': .5,
'title': 'Message'
});
lcform.agree.focus();
return false;
}
return true;
}
function EditEvent(event_id,event_public,repeatsCode,eventDate)
{
if (repeatsCode!=null && repeatsCode!="N")
{
$.Zebra_Dialog('This is a repeating event. Do you want to edit the series, or just this occurrence?', {
'type': 'question',
'overlay_opacity': .5,
'title': 'Edit Repeating Event',
'buttons': ['Edit the Series','Edit this Occurrence'],
'onClose': function(caption) {
if (caption=="Edit the Series")
window.location.href="/elsie?DAM=EventEditor&event_id="+event_id+"&public_event="+event_public;
else if (caption=="Edit this Occurrence")
window.location.href="/elsie?DAM=EventEditor&event_id="+event_id+"&public_event="+event_public+"&occur=Y&odate="+eventDate;
}
});
}
else
window.location.href="/elsie?DAM=EventEditor&event_id="+event_id+"&public_event="+event_public;
}
function getRestaurants(zipcode)
{
var view_window;
view_window = window.open("http://www.usrg.com/script/nearzip.asp?ZIP="+zipcode,"localendar","width=800,height=500,scrollbars=yes,resizable=yes");
view_window.focus();
}
function trim(strValue)
{
var intLoop=0;
for(intLoop=0; intLoop=0; intLoop=strValue.length-1)
{
if(strValue.charAt(intLoop)==" ")
strValue=strValue.substring(0,intLoop);
else
break;
}
return strValue;
}
function AnonAddInfo()
{
var view_window;
view_window = window.open("/elsie?JSP=AnonAddInfo", "localendar", "width=475,height=565,scrollbars=no,resizable=yes");
view_window.focus();
}
// Geo-Encoding functions
function hideGeoAlerts(panel){
var prefix = "";
if (panel==0){
// Event Location
prefix="event";
} else if (panel==1){
// Weather Location
prefix="weather";
} else if (panel==2){
// Member Location
prefix="member"
}
$("#"+prefix+"_location_chooser").hide();
$("#"+prefix+"_location_valid").hide();
$("#"+prefix+"_location_invalid").hide();
$("#"+prefix+"_location_none").hide();
$("#"+prefix+"_lat").val("");
$("#"+prefix+"_long").val("");
$("#"+prefix+"_location_desc").val("");
}
function geocodeAddress(panel){
var prefix = "";
if (panel==0){
// Event Location
prefix="event";
} else if (panel==1){
// Weather Location
prefix="weather";
} else if (panel==2){
// Member Location
prefix="member"
}
hideGeoAlerts(panel);
$("#"+prefix+"_geoList").empty();
var address = $("#"+prefix+"_phys_address").val();
jQuery.support.cors = true;
$.getJSON("https://maps.googleapis.com/maps/api/geocode/json",{address:address,sensor:"false"}, function(data) {
if (data.results.length>0)
{
geoData = data;
if (geoData.results.length>1){
$("#"+prefix+"_geoList").append($("")
.attr("value",-1)
.text("-- Please select --")
);
}
for (i=0;i")
.attr("value",i)
.text(data.results[i].formatted_address)
);
}
} else {
geoData=null;
}
if (geoData==null){
$("#"+prefix+"_location_none").show();
} else if (geoData.results.length==1){
storeLatLong({value:"0"},panel)
$("#"+prefix+"_location_valid").show();
} else if (geoData.results.length>1) {
$("#"+prefix+"_location_chooser").show();
}
});
}
function storeLatLong(obj,panel){
var prefix = "";
if (panel==0){
// Event Location
prefix="event";
} else if (panel==1){
// Weather Location
prefix="weather";
} else if (panel==2){
// Member Location
prefix="member"
}
if (obj.value==-1){
$("#"+prefix+"_location_valid").hide();
$("#"+prefix+"_lat").val("");
$("#"+prefix+"_long").val("");
$("#"+prefix+"_location_desc").val("");
} else {
$("#"+prefix+"_lat").val(geoData.results[obj.value].geometry.location.lat);
$("#"+prefix+"_long").val(geoData.results[obj.value].geometry.location.lng);
var desc = $("#"+prefix+"_geoList option:selected").text();
if (""==desc){
desc = $("#"+prefix+"_phys_address").val();
}
$("#"+prefix+"_location_desc").val(desc);
$("#"+prefix+"_location_valid").html("Location valid ("+$("#"+prefix+"_location_desc").val()+")");
$("#"+prefix+"_location_valid").show();
}
}
//
// Task-related functions
//
function addTask()
{
window.location.href="/elsie?DAM=EventEditor"
}
function deleteTask(index)
{
$.Zebra_Dialog("Are you sure you want to delete entry\n\""+taskList[index].title+"\" ?", {
'type': 'question',
'overlay_opacity': .5,
'title': 'Delete Task?',
'buttons': ['Delete','Cancel'],
'onClose': function(caption) {
if (caption=="Delete"){
window.location.href="/elsie?DAM=TaskEditor&task_id="+taskList[index].tId+"&action=D";
}
}
});
}
function editTask(task_id)
{
window.location.href="/elsie?DAM=TaskEditor&task_id="+task_id;
}
google_ad_client = "pub-2644230428539254";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image"; //text
google_ad_channel = "7922072415";
google_color_border = "#E0E3E4";
google_color_bg = "#E0E3E4";
google_color_link = "#999999";
google_color_text = "#999999";
google_color_url = "#999999";
document.write("