function setupDemos() { Shadowbox.setup("a.swf", { gallery: "swf", continuous: true }); } function SelectedDay(d, inst) { $(".events_notes").html("loading ..."); var parts = d.split('/'); var month = parseInt(parts[0], 10); var day = parseInt(parts[1], 10); var year = parseInt(parts[2], 10); req_path = SitePath + "/events/" + month + "_" + day + "_" + year; $(".events_notes").hide(300, function(){ $.get(req_path, function (res) { $(".events_notes").html(res || "No Events"); $(".events_notes").show(200); socializer( '.socializer' ); }).fail(function() { $(".events_notes").html("Could not load events for this date."); $(".events_notes").show(200); }); }) } function loadBooks(){ $.get(SitePath + "/_get_books_data.php", function (res) { if(res){ $('#for_books_list').html(res); $('#for_books_list').selecter("refresh") } }); } function loadEvents() { $.ajax({ url: SitePath + "/event_date.php?s=" + ($("#event_search").length > 0 ? $("#event_search").val() : ''), data: "action=showdates", dataType: "json", success: function(calendarEvents){ if (!$.isArray(calendarEvents)) { calendarEvents = []; } $(".for_cal").datepicker("destroy"); $(".for_cal").datepicker({ onSelect: SelectedDay, // [rows, columns] if you want to display multiple calendars. numberOfMonths: [1, 1], showCurrentAtPos: 0, beforeShowDay: function (date){ for (var i = 0; i < calendarEvents.length; i++) { var ev = calendarEvents[i]; var sameMonthDay = (date.getMonth() == ev[0] - 1 && date.getDate() == ev[1]); if (!sameMonthDay) { continue; } var isRecurring = (ev[4] === 1 || ev[4] === true || ev[4] === "1"); if (isRecurring || date.getFullYear() == ev[2]) { return [true,"ui-state-highlight myClass",ev[3] || ""]; } } // Non-event days must be disabled: theme styles every // selectable .ui-state-default with the purple fill. return [false, ""]; } }); }, error: function() { $(".for_cal").datepicker("destroy"); $(".for_cal").datepicker({ onSelect: SelectedDay, numberOfMonths: [1, 1], showCurrentAtPos: 0 }); } }); } function whoaskiSearchTerm() { var $input = $("#search_input"); if (!$input.length) return ""; var term = $.trim($input.val() || ""); var title = $input.attr("title") || ""; if (title && term === title) return ""; return term; } function whoaskiSearchHasCriteria() { var cat = ($("#the_cat").length ? $("#the_cat").val() : "") || ""; return whoaskiSearchTerm() !== "" || (cat !== "" && cat !== "-1"); } function whoaskiShowSearchStatus(message, busy) { var $box = $("#whoaski-search-status"); if (!$box.length) return; $box.find(".whoaski-search-status-text").text(message); $box.toggleClass("is-busy", !!busy); $box.attr("aria-busy", busy ? "true" : "false"); $box.removeAttr("hidden"); } function whoaskiHideSearchStatus() { $("#whoaski-search-status").removeClass("is-busy").attr("aria-busy", "false").attr("hidden", "hidden"); } $(document).ready ( function () { $("#nav_menu ul li").click (function (){ $("#nav_menu ul li") .removeClass("selected"); $(this).addClass("selected") ; }); $(".delete_post_group").click(function(e) { selected = ""; for (i=0; i < $(".remove_group").length; i++ ){ cur_one = $(".remove_group:eq("+i+")"); if ( cur_one.is(':checked') ) { selected = cur_one.val() + "," + selected ; } } if (selected != "") alert(''); location.href = "/_the_admin/posts_management.php?pid="+selected+"&action=delete"; }); $(".delete_members_group").click(function(e) { selected = ""; for (i=0; i < $(".remove_group").length; i++ ){ cur_one = $(".remove_group:eq("+i+")"); if ( cur_one.is(':checked') ) { selected = cur_one.val() + "," + selected ; } } if (selected != "") { location.href = "/_the_admin/members_management.php?memid="+selected+"&act=remove"; } }); $(".delete_events_group").click(function(e) { selected = ""; for (i=0; i < $(".remove_group").length; i++ ){ cur_one = $(".remove_group:eq("+i+")"); if ( cur_one.is(':checked') ) { selected = cur_one.val() + "," + selected ; } } if (selected != "") { location.href = "/_the_admin/events_management.php?eid="+selected+"&action=delete"; } }); $(".sort_by").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main_recent").fadeOut(200); $.get(SitePath + "/get_ordered_group/" + $(this).attr("rel") + "/", function(res){ $("#main_recent").html(res); $("#main_recent").fadeIn(200); } ) } ); }); $(".sort_by_featured").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main_featured").fadeOut(200); $.get(SitePath + "/get_ordered_group_featured/" + $(this).attr("rel") + "/", function(res){ $("#main_featured").html(res); $("#main_featured").fadeIn(200); } ) } ); }); $(".sort_by_tag").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main_featured").fadeOut(200); $.get(SitePath + "/get_ordered_group_tag/"+$(this).attr("rel")+"/" + $("#TagMemberId").val()+ "/", function(res){ $("#main_featured").html(res); $("#main_featured").fadeIn(200); } ) } ); }); $(".sort_by_favorites").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main_favorites").fadeOut(200); $.get(SitePath + "/get_ordered_group_favorites/" + $(this).attr("rel") + "/", function(res){ $("#main_favorites").html(res); $("#main_favorites").fadeIn(200); } ) } ); }); $(".sort_by_profile_favorites").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main_recent").fadeOut(200); $.get(SitePath + "/get_ordered_group_profile_favorites/" + $(this).attr("rel") + "/", function(res){ $("#main_recent").html(res); $("#main_recent").fadeIn(200); } ) } ); }); $(".sort_by_profile_posts").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main_recent").fadeOut(200); $.get(SitePath + "/get_ordered_group_profile_posts/" + $(this).attr("rel") + "/", function(res){ $("#main_recent").html(res); $("#main_recent").fadeIn(200); } ) } ); }) $(".sort_by_album").each(function(i) { $(this).click( function(e){ e.preventDefault(); $("#main").fadeOut(200); $.get(SitePath + "/get_ordered_group_album/" + $(this).attr("rel") + "/", function(res){ $("#main").html(res); $("#main").fadeIn(200); } ) } ); }); $(".sort_by_search").each(function(i) { $(this).click( function(e){ e.preventDefault(); if (typeof document.search_form === "undefined") return; whoaskiShowSearchStatus("Sorting results…", true); $("#main").fadeOut(200); $.ajax({ url: SitePath + "/get_ordered_group.php?group=search&the_cat="+encodeURIComponent(document.search_form.the_cat.value)+"&the_album="+encodeURIComponent((document.search_form.the_album && document.search_form.the_album.value) ? document.search_form.the_album.value : "")+"&search_input="+encodeURIComponent(document.search_form.search_input.value)+"&order_by=" + encodeURIComponent($(this).attr("rel")), success: function(res){ $("#main").html(res); $("#main").fadeIn(200); whoaskiHideSearchStatus(); }, error: function(){ $("#main").stop(true, true).fadeIn(200); whoaskiShowSearchStatus("Sorting did not finish. Please try again.", false); } }); } ); }); $(".like_link").click(function(e) { e.preventDefault(); //alert (SitePath + "/like_it/" + $(this).attr("rel") + "/" + $(".the_post_id").html() + "/") ; $.get(SitePath + "/like_it/" + $(this).attr("rel") + "/" + $(".the_post_id").html() + "/", function(){ location.href = location.href; }); }); loadEvents(); function moveCloseLink(){ var cb=document.getElementById('sb-nav-close'); var tb=document.getElementById('sb-title'); if(tb) tb.appendChild(cb); } Shadowbox.init( { overlayColor: "#491d3c", overlayOpacity: 0.8, autoplayMovies: true, width:700, height:400, onOpen: moveCloseLink }, setupDemos); $("#search_input").focus(function(){ var title = $(this).attr("title"); if (title && $(this).val() === title) $(this).val(""); }); $("#search_input").blur(function(){ var title = $(this).attr("title"); if (title && $(this).val() == "") $(this).val(title); }); $("#search_form").on("submit", function (e) { var action = $(this).attr("action") || ""; if (action.indexOf("/search/") === -1) return; if (!whoaskiSearchHasCriteria()) { e.preventDefault(); whoaskiShowSearchStatus("Enter a word or choose a category to search.", false); $("#search_input").focus(); return false; } whoaskiShowSearchStatus("Searching…", true); $(this).find("button[type=submit]").prop("disabled", true); }); $("#whoaski-search-status").on("click", function () { if (!$(this).hasClass("is-busy")) whoaskiHideSearchStatus(); }); $(".input_field").focus(function(){ $(this).val(""); }); if ( $("#forgot_my_pass").length ) { $("#forgot_my_pass").validate(); var options = { target: '#adding_comment_res' ,url: SitePath + "/forget_my_pass/" ,success: HashSent }; $('#forgot_my_pass').ajaxForm(options); } if ( $("#provide_hash_code").length ) { $("#provide_hash_code").validate(); var options = { target: '#adding_comment_res' ,url: SitePath + "/forget_my_pass/" ,success: HashEntered }; $('#provide_hash_code').ajaxForm(options); } $(".input_field").blur(function(){ if ($(this).val() == "") $(this).val($(this).attr("title")); }) $("ul.navigation li").each(function(){ $(this).mouseenter(function(){ if ($(this).find("ul.sub_menu").length) { my_width = $(this).width() ; $(this).css("background", "url(img/menu_item_hover_bg.png)"); $(this).find("ul.sub_menu li").each(function(){ $(this).css("minWidth", my_width) ; }) $(this).find("ul.sub_menu").show(); } }); $(this).mouseleave(function(){ if ($(this).find("ul.sub_menu").length) { $(this).css("background", "url(img/upper_menu_item_bg.png)"); $(this).find("ul.sub_menu").hide(); } }); }); /* if ($("#member_registration_form").length) { $("#member_registration_form").validate({rules:{member_pass2: {equalTo: "#member_pass"}}}); var options = { target: '#register_res' ,url: SitePath + "/confirm/" //beforeSubmit: showRequest, ,success: showResponse }; $('#member_registration_form').ajaxForm(options); }*/ if ($("#login_form").length) { //$("#member_registration_form").validate({rules:{member_pass2: {equalTo: "#member_pass"}}}); var options = { target: '#login_box' ,url: SitePath + "/member_log_in.php" ,success: LoginSuccess }; $('#login_form').ajaxForm(options); } if ($("#add_comment_form").length) { // $("#add_comment_form").validate(); var options = { target: '#adding_comment_res' ,url: SitePath + "/adding_comment.php" ,success: AddCommentRes }; $('#add_comment_form').ajaxForm(options); } $(".events_notes").html("Event loading ..."); var event_get_path = SitePath + "/events/01_01_1800"; $(".events_notes").hide(300, function(){ $.get( event_get_path, function (res) { $(".events_notes").html(res); $(".events_notes").show(200); socializer( '.socializer' ); }) ; }); $(".banner_sidebar").html("Loading..."); var banner_get_path = SitePath + "/get_banner.php"; $(".banner_sidebar").hide(300, function(){ $.get( banner_get_path, function (res) { $(".banner_sidebar").html(res); $(".banner_sidebar").show(200); }) ; }); }); function nav() { $('.navigation li:first-child').addClass('first'); $('.navigation li:last-child').addClass('last'); } function showRequest(formData, jqForm, options) { var queryString = $.param(formData); return true; } // post-submit callback function showResponse(responseText, statusText, xhr, $form) { if (/thank/ig.test(responseText)) { $("#member_registration_form").hide(1200); } } function LoginSuccess(responseText, statusText, xhr, $form) { location.href = SitePath ; } function HashSent(responseText, statusText, xhr, $form) { $(".add_comment_form").hide(1200); } function HashEntered(responseText, statusText, xhr, $form) { if (/Step/ig.test(responseText)) { $("#provide_hash_code").hide(400); } } function AddCommentRes(responseText, statusText, xhr, $form) { post_id = $form.find("#post_id").val() ; member_id = $form.find("#member_id").val() ; if (/thank/ig.test(responseText) > -1) { mymatch = /\d+/.exec(responseText); if (mymatch.length) { rec_id = (mymatch[0]); $.get(SitePath+"/adding_comment.php?rec_id=" + rec_id , function(res) { CommentBox = $("