
var Site={
	init:function(){
		
	},
	showpaging:function(page){
		if(!page) {
			page = 1;
		}
		var tagid = jQuery('#tagid').text();
		var param = "";
		if(tagid!=""){
			param = {__class: 'Site', __proc: 'showWorklist',tagid:tagid, page: page};
		}else{
			param = {__class: 'Site', __proc: 'showWorklist',page: page};
		}
		jQuery.get('/wp-handler.php', param , function(data) {
			jQuery('#catlist').html(data);
		});
	},
	picktag:function(tagid, tagname, page){
		
		jQuery("#pickatag").html(tagname);
		jQuery('#tagid').html(tagid);
		if(!page) {
			page = 1;
		}
		jQuery.get('/wp-handler.php', {__class: 'Site', __proc: 'showWorklist', tagid:tagid, page: page}, function(data) {
			jQuery('#parent2').fadeOut("slow" ,function(){
				jQuery('#catlist').html(data);
				jQuery('#parent2').fadeIn("slow");
			});
			
		});
	}	
 };


jQuery(function() {
	var winH=jQuery(window).height();
	jQuery('.col-1').css("height",winH+"px");
	jQuery("body").not("#subject span").click(function(){
		jQuery("body").find("#subject ul").slideUp('slow');										  
	});
	
	jQuery("#subject span").click(function (e) {
		jQuery("#subject ul").slideToggle('slow');
		e.stopPropagation();
		});
});

jQuery(function(){
	Site.init();

});


function readCookie(name) {
			var nameEQ = name + "=";
			var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1,c.length);
				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			}
			return null;
		}
		
		function eraseCookie(name) {
			createCookie(name,"",-1);
		}
		
		function createCookie(name,value) {
			/*if (days) {
				var date = new Date();
				date.setTime(date.getTime()+(days*24*60*60*1000));
				var expires = "; expires="+date.toGMTString();
			}*/
			 var expires = "";
			document.cookie = name+"="+value+expires+"; path=/";
		}
		
		function setPages(page, tag){
			createCookie('pages', page);
			createCookie('tag', tag);
			return true;
		}
