/*
JQuery plug-in code
 *
 */
 
// READ MORE TOGGLE 
   $(document).ready(function(){
     $(".article .thebody").hide();
     $("#container .article ul.actions")
       .prepend("<li class='readbody'><a href='' title='Read the full text'>+ CLICK TO READ MORE</a></li>");
      $(".actions li.readbody a").click(function(event){
       $(this).parents("ul").prev(".thebody").slideToggle(200);
	   $(this).text($(this).text() == '+ CLICK TO READ MORE' ? '- CLICK TO COLLAPSE' : '+ CLICK TO READ MORE');
       return false;
     });
   });
// SHOW DETAILS SLIDE TOGGLE
$(document).ready(function(){
$(".msg_body").hide();
$('.msg_list').click(function(e){
if ($(e.target).is('.msg_head'))
$(e.target).next('.msg_body').slideToggle(400);
});
});

// SCREENSHOT PREVIEW
this.screenshotPreview = function(){	
	/* CONFIG */
		xOffset = 10;
		yOffset = 30;
		// these 2 variable determine popup's distance from the cursor
	/* END CONFIG */
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
 $(document).ready(function(){
	screenshotPreview();
});
 
 
 
    $(document).ready(function(){
        $("#extra").css("display","none");
       $("#checkme").click(function(){
        if ($("#checkme").is(":checked"))
        {
            $("#extra").show("fast");
        }
        else
        {      
             $("#extra").hide("fast");
        }
      });

    });

$(document).ready(function() {
  $('#rowclick li')
    .filter(':has(:checkbox:checked)')
    .addClass('selected')
    .end()
    .click(function(event) {
    $(this).toggleClass('selected');
    if (event.target.type !== 'checkbox') {
      $(':checkbox', this).trigger('click');
    }
  });
});


function bakecookie(name, value) { 
   var argv = bakecookie.arguments; 
   var argc = bakecookie.arguments.length; 
   var daysgood = (argc > 2) ? argv[2] : null; 
   var path = (argc > 3) ? argv[3] : "/"; 
   var domain = (argc > 4) ? argv[4] : null; 
   var secure = (argc > 5) ? argv[5] : false; 
   var expires = new Date(); 
   expires.setDate (expires.getDate()+daysgood); 
   document.cookie = name + "=" + escape (value) +((daysgood == null) ? "" : ("; expires=" + expires.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : ""); 
} 

function eatcookie(name) { 
   var arg = name + "="; 
   var alen = arg.length; 
   var clen = document.cookie.length; 
   var i = 0; 
   while (i < clen) { 
      var j = i + alen; 
      if (document.cookie.substring(i, j) == arg) {return eatcookieval (j);} 
      i = document.cookie.indexOf(" ", i) + 1; 
      if (i == 0) {break;} 
   } 
   return null; 
} 

function eatcookieval(offset){ 
   var endstr=document.cookie.indexOf(";",offset); 
   if (endstr == -1) {endstr = document.cookie.length;} 
   return unescape(document.cookie.substring(offset,endstr)); 
}