function unBold(perPage, AllItems) {
  for(var i=0; i<Math.ceil(AllItems/perPage); i++)
  {
   document.getElementById('link_'+(i+1)).style.fontWeight='';
  }
}

function ShowPages(perPage, AllItems)
{
  for(var i=0; i<AllItems; i++)
  {
	 if( i>=0 && i<perPage )
    document.getElementById('s'+(i+1)).style.display='';
   else
    document.getElementById('s'+(i+1)).style.display='none';
  }

  var pages = '';
	for(var i=0; i<Math.ceil(AllItems/perPage); i++)
	{
		if( i == 0 )
			pages += '<a style="font-weight: bold; cursor: pointer;" id="link_' + (i+1) + '" onclick="unBold('+ perPage + ', ' + AllItems +');this.style.fontWeight=\'bold\';GoToPage(' + i + ', ' + perPage + ', ' + AllItems + ')">'+ (i+1) +'</a>  ';
    else
    	pages += '<a style="cursor: pointer;" id="link_' + (i+1) + '" onclick="unBold('+ perPage + ', ' + AllItems +');this.style.fontWeight=\'bold\';GoToPage(' + i + ', ' + perPage + ', ' + AllItems + ')">'+ (i+1) +'</a>  ';
  }
  document.write(pages);
}

function GoToPage(CurrentPage, perPage, AllItems)
{
	for(var i=0; i<AllItems; i++)
	{
	  if( i>=CurrentPage*perPage && i<(CurrentPage+1)*perPage )
    	document.getElementById('s'+(i+1)).style.display='';
    else
      document.getElementById('s'+(i+1)).style.display='none';
  }
}

function bookmark(){
    var title = 'Page Title';
    var url = 'http://webpage.pl/';

    if (window.sidebar) window.sidebar.addPanel(title, url,"");

    else if( window.opera && window.print )
    {
    var mbm = document.createElement('a');
    mbm.setAttribute('rel','sidebar');
    mbm.setAttribute('href',url);
    mbm.setAttribute('title',title);
    mbm.click();
    }

    else if( document.all ) window.external.AddFavorite( url, title);
}

