$(document).ready(function(){
	$(".menu > li").click(function(e){
		switch(e.target.id){
			case "news":
				//change status & style menu
				$("#news").addClass("active");
				$("#tutorials").removeClass("active");
				$("#links").removeClass("active");
				//display selected division, hide others
				$("div.news").fadeIn();
				$("div.tutorials").css("display", "none");
				$("div.links").css("display", "none");
			break;
			case "tutorials":
				//change status & style menu
				$("#news").removeClass("active");
				$("#tutorials").addClass("active");
				$("#links").removeClass("active");
				//display selected division, hide others
				$("div.tutorials").fadeIn();
				$("div.news").css("display", "none");
				$("div.links").css("display", "none");
			break;
			case "links":
				//change status & style menu
				$("#news").removeClass("active");
				$("#tutorials").removeClass("active");
				$("#links").addClass("active");
				//display selected division, hide others
				$("div.links").fadeIn();
				$("div.news").css("display", "none");
				$("div.tutorials").css("display", "none");
			break;
		}
		//alert(e.target.id);
		return false;
	});
});


$(document).ready(function() {
	
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
		
});


$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
				});
			});




$(function(){

  // Very basic usage
  
  $.fn.EasyWidgets();
  
});


$(function() {
        $('a').click(function() {
            var os = $('p').css('font-size');
            var num = parseFloat(os);
            var uom = os.slice(-2);

            if (this.id == 'larger') {
                $('span').css('font-size', num * 1.4 + uom);
            } else
                $('span').css('font-size', num / 1.4 + uom);
        })

    })


$(function(){

  // Very basic usage
  
  $.fn.EasyWidgets({
    behaviour : {
      dragRevert : 400
    }
  });
  
});

$(function(){

  // Use the cookie plugin
  
  $.fn.EasyWidgets({

    effects : {
      effectDuration : 200,
      widgetShow : 'fade',
      widgetHide : 'fade',
      widgetClose : 'fade',
      widgetExtend : 'fade',
      widgetCollapse : 'fade',
      widgetOpenEdit : 'fade',
      widgetCloseEdit : 'fade',
      widgetCancelEdit : 'fade'
    }

  });
  
});

$(document).ready(function(){

	$(".btn-slide").click(function(){
		$("#panel").slideToggle("slow");
		$(this).toggleClass("active");
	});
	
	 
});






// DOM ready!

$(function(){

  // Use the cookie plugin
  
  $.fn.EasyWidgets({

    behaviour : {
      useCookies : true
    },

    callbacks : {

      onAdd : function(){
        Log('onAdd');
      },

      onEdit : function(){
        Log('onEdit');
      },

      onShow : function(){
        Log('onShow');
      },

      onHide : function(){
        Log('onHide');
      },

      onClose : function(){
        Log('onClose');
      },

      onEnable : function(){
        Log('onEnable');
      },

      onExtend : function(){
        Log('onExtend');
      },

      onDisable : function(){
        Log('onDisable');
      },

      onDragStop : function(){
        Log('onDragStop');
      },

      onCollapse : function(){
        Log('onCollapse');
      },

      onAddQuery : function(){
        Log('onAddQuery');
        return true;
      },

      onEditQuery : function(){
        Log('onEditQuery');
        return true;
      },

      onShowQuery : function(){
        Log('onShowQuery');
        return true;
      },

      onHideQuery : function(){
        Log('onHideQuery');
        return true;
      },

      onCloseQuery : function(){
        Log('onCloseQuery');
        return true;
      },

      onCancelEdit : function(){
        Log('onCancelEdit');
      },

      onEnableQuery : function(){
        Log('onEnableQuery');
        return true;
      },

      onExtendQuery : function(){
        Log('onExtendQuery');
        return true;
      },

      onDisableQuery : function(){
        Log('onDisableQuery');
        return true;
      },

      onCollapseQuery : function(){
        Log('onCollapseQuery');
        return true;
      },

      onCancelEditQuery : function(){
        Log('onCancelEditQuery');
        return true;
      },

      onChangePositions : function(){
        Log('onChangePositions');
      },

      onRefreshPositions : function(){
        Log('onRefreshPositions');
      }
    }

  });

  // Some Ajax progress stuff for Widgets on demand
  
  $('#ajax-progress').ajaxStart(function(){
    $(this).show();
  }).ajaxStop(function(){
    $(this).hide();
  });
  
 
});

var callbackNum = 0;

function Log(msg){
  callbackNum++;
  var console = $('#callbacks-console');
  console.append('<div>'+callbackNum+' :: '+msg+'</div>');
  // A barbarity, but ok for this time
  console.scrollTop(99999);
  return true;
}

function AddWidget(url, placeId){
  $.get(url, function(html){
    $.fn.AddEasyWidget(html, placeId);
  });
}



var auto_refresh = setInterval(
function ()
{
$('#showdata').load('record_count.php').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds



