$(document).ready(function(){	
	initMainContentClick();
    printMe();
	if ( typeof(size)== "undefined") {		
		initPager(5);
	}
	else{
		initPager(size);
	}
    alignXopusImages();
});

function initMainContentClick(){
	/* Functie voor de "Lees verder" functionaliteit van de hoofd content */
	$(".content_click_detail").click(function(){
		$(this).hide();        	        	
		$(this).nextAll(".hidden_detail:first").show();    
		});
};
function initPager(size){	
		$("ul.nieuwsoverzicht").quickPager({pageSize:size});
};	

function pop_me_up(title,link){
	window.open(link
             ,'title'
             ,'width=600,height=800,top=100,left=100,scrollbars=yes,toolbar=no,titlebar=no,location=no,menubar=no,status=no'
             );			   
}

function alignXopusImages() {
  $(".xopus_content img[align='left']").css("margin-right", "8px");
  $(".xopus_content img[align='right']").css("margin-left", "8px");
}

function printMe() {
  $(".print").click( function() {
    if ($("td[width='502']").length > 0) {
      $('<div id="logo"><img alt="PME Home" src="/pls/portal/docs/PAGE/pme/Beheer/img/header_logo.png"></div>').prependTo("td[width='502']");
      $("td[width='502']").jqprint();
      $('#logo').remove(); 
    } else {
      $('<div id="logo"><img alt="PME Home" src="/pls/portal/docs/PAGE/pme/Beheer/img/header_logo.png"></div>').prependTo(".pagewrapper:eq(1)");
      $('.pagewrapper:eq(1)').jqprint();
      $('#logo').remove();             
    }
    return false;
  });  
}
