/*js functions for GPCalender admin*/

/*get the instance of the last "/" in the url - this gives us portability*/

var docUrl = document.URL.substring(0,(document.URL.lastIndexOf('/')));

function get_gpc_data(id,fct,t) {
ajaxurl = docUrl+"/wp-content/plugins/GPCalendar/gpc_ajax.php";

//drop jquery AJAX requests here - may not need the above createXMLHttpRequest
jQuery.ajax({
type:"POST",
url: ajaxurl,
data: "id="+id+"&fn="+fct+"&type="+t,
dataType:'script'
});
}//end function

jQuery(document).ready(function($) {
if ($('#gp_cal_spanholder').length > 0) {//if, and only if, the cal_spanholder exists (this saves the code being called on every page)
//well move the contents to another part of the page - a pre-formed submenu bar at the top.
var t = $('.evtype').html();
//call the default page
//get_gpc_data('','show',t);
}
else if ($('#gp_cal_summary').length > 0){
get_gpc_data('','view'); //show the initial page content
}

/*$('.gp_cal_month').click(function() {
if ($('#gp_cal_spanholder').length > 0) {
var m = $(this).html();
var t = $('.evtype').html();
get_gpc_data(m,'show',t);
}
*/
//});//end gp_cal_month click

});//end document ready
