var displayPageing = 0;
var preciceCount = 0;

function handlePageing(next,total){
	for(i=0;i<total;i++)
		document.getElementById('artcomHidden'+i).style.display = 'none';
		
	if(next){
		if(displayPageing<(total-1))
			displayPageing++;
	} else {
		if(displayPageing>0)
			displayPageing--;
	}	
	
	document.getElementById('artcomHidden'+displayPageing).style.display = '';
	setStyles();
}

function handleFirstRoll(total){
	for(i=0;i<total;i++)
		document.getElementById('artcomHidden'+i).style.display = 'none';

	displayPageing = 0;
	
	document.getElementById('artcomHidden'+displayPageing).style.display = '';
	setStyles();
}

function handleSeAll(total){
	for(i=0;i<total;i++)
		document.getElementById('artcomHidden'+i).style.display = '';
	
	displayPageing = 0;
	setStyles();
	
	document.getElementById('rollnrfra').value = "Kommentar 1 til " + preciceCount;

}

function setStyles(){
	dispString = "Kommentar " +((displayPageing*10)+1)+" til ";

	if(preciceCount<(displayPageing*10)+10)
		dispString += preciceCount;
	else
		dispString += (displayPageing*10)+10;

	document.artcomOutput.rollnrfra.value = dispString;

	if(displayPageing == 0){
		document.getElementById("btnFirst").className = "artcomDisabled font2";
		document.getElementById("hrefFirst").disabled = true;
		
		document.getElementById("btnPrev").className = "artcomDisabled font2";
		document.getElementById("hrefPrev").disabled = true;
	} else {
		document.getElementById("btnFirst").className = "font2 Color1";
		document.getElementById("hrefFirst").disabled = false;
	
		document.getElementById("btnPrev").className = "font2 Color1";
		document.getElementById("hrefPrev").disabled = false;
	}
	
	if(preciceCount>10 && ((displayPageing+1)*10)>=preciceCount){
		document.getElementById("btnNext").className = "artcomDisabled font2";
		document.getElementById("hrefNext").disabled = true;
	} else {
		document.getElementById("btnNext").className = "font2 Color1";
		document.getElementById("hrefNext").disabled = false;
	}
}

function clrOnFocus(obj,defText){
	if(obj.value == defText)
		obj.value = "";
}

function restoreIfBlank(obj,defText){
	if(obj.value == "")
		obj.value = defText;
}

function clrOnSubmit(){
	if(document.artcom.Title.value == "tittel") 									document.artcom.Title.value = "";
	if(document.artcom.Comment.value == "Skriv din mening her..") document.artcom.Comment.value = "";		
	if(document.artcom.Name.value == "Ditt navn") 								document.artcom.Name.value = "";	
	document.artcom.ArtTitle.value = document.title;
	document.artcom.submit();
}

function anmeldPopup(Form){
	Form.Title.value = document.title;
	window.open('about:blank','anmeld','width=500px,height=360px');
	Form.submit();
}