var pIndex = 0;
var pContent='';

function paginate(nav)
{

	pContent = jQuery('div.statiskSide').children('div.page');
	
	for( var i = 1; i < pContent.length; i++ ) {
	
		jQuery(pContent[i]).hide();
	
	}
	
	if( pContent.length > 1 ) 
	{
	
		jQuery("#navContainer").html('<a href="javascript:void(0);" onclick="pagPrev();" id="pPrevLink"><img src="/gfx/prev.jpg" alt="Forrige" align="left" /></a><a href="javascript:void(0);" onclick="pagNext();" id="pNextLink"><img src="/gfx/next.jpg" alt="Neste" align="left" /></a>');
	
	} else {
		jQuery("#navContainer").html('&nbsp;');
	}
	pagCheckNav();
}

function pagPrev() 
{

	if( pIndex > 0 ) 
	{
		jQuery(pContent[pIndex]).fadeOut('',function() {
			pIndex--;
			pagCheckNav();
			jQuery(pContent[pIndex]).fadeIn();
		});
	}

}

function pagNext() 
{

	if( pIndex < (pContent.length-1) ) 
	{
		jQuery(pContent[pIndex]).fadeOut('',function() {
			pIndex++;
			pagCheckNav();
			jQuery(pContent[pIndex]).fadeIn();
		});
	}

}

function pagShow(id) {

	if( id < (pContent.length-1) ) 
	{
		jQuery(pContent[pIndex]).fadeOut('',function() {
			pIndex = id;
			jQuery(pContent[pIndex]).fadeIn();
		});
	}
	pagCheckNav();

}

function pagCheckNav() 
{

	if(pIndex==0) 
	{
		jQuery("#pPrevLink").css("display","none");
	} 
	else {
		jQuery("#pPrevLink").css("display","inline");
	}

	if(pIndex== (pContent.length-1)) 
	{
		jQuery("#pNextLink").css("display","none");
	} 
	else {
		jQuery("#pNextLink").css("display","inline");
	}


}
