var myForm, contentHeight;

function navigate(site, doc) {
	myForm.action = site;
	myForm.commit.value = '';
	myForm.doc.value = doc;
	myForm.submit();
}

function cleanDoor(site, doc) {

	myForm.action.value = site;
	myForm.clear.value = 1;
	myForm.commit.value = '';
	myForm.doc.value = doc;
	
	myForm.submit();
	return false;
}

	
function removeDoc(site, doc) {

	if (confirm('Er du sikker?')) {
		myForm.action.value = site;
		myForm.remove.value = doc;
		myForm.commit.value = '';
		myForm.doc.value = 0;

		myForm.submit();
		
		return (true);
	}
	
	else return (false);
}

function apply(commit, site, doc) {

	myForm.action = site;
	myForm.commit.value = commit;
	myForm.doc.value = doc;
	
	myForm.submit();

	return false;
}


function sortList (site, order) {
	
	myForm.action.value = site;
	myForm.sort.value = order;
	
	myForm.submit();
}

function page(site, page) {

	myForm.site.value = site;
	myForm.f_page.value = page;
	
	myForm.submit();
}
	
function raisePriority(site, commit, doc) {

	myForm.action.value = site;
	myForm.commit.value = commit;
	myForm.doc.value = doc;
	myForm.raise.value = 1;
	
	myForm.submit();
}

function lowerPriority(site, commit, doc) {

	myForm.action.value = site;
	myForm.commit.value = commit;
	myForm.doc.value = doc;
	myForm.raise.value = 0;
	
	myForm.submit();

}

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow")) 
     anchor.target = "_blank"; 
 } 
} 


function init() {
	myForm = document.getElementById('theform');
							 
	resizeWindow();

	externalLinks();
}


function resizeWindow() {

	var height, newHeight;
	newHeight =  document.getElementById('main').scrollHeight;
	document.getElementById('main').style.height = (newHeight > 710 ? newHeight : 710) + 'px';
	document.getElementById('leftback').style.height = (newHeight > 710 ? newHeight : 710) + 'px';

}


 window.onresize = resizeWindow;
 window.onload = init;