function setStyleClass(div)
{
	
	 allElements = div.getElementsByTagName("DIV");
	 
	for ( var i=1, len=allElements.length; i<len; ++i )
	{
		
		myDiv = allElements[i];
		myLink = myDiv.firstChild;
		
		if(document.location == 'http://www.gjallarhorn.no/')
		{
			
			if(i == 1)
			{
				myDiv.className = 'selected';
			}
			else
			{
				myDiv.className = 'notSelected';
			}
		}
		else
		{
			
				if(myLink.href == document.location)
				{
					myDiv.className = 'selected';
				}
				else
				{
					myDiv.className = 'notSelected';
				}
			
		}
 	}
	
}

function howerMenu(div, color)
{
	var currentColor = div.style.backgroundColor;
	var currentClass = div.className;
	
	if(currentClass != 'selected')
	{
		if(color != 'old')
		{
			div.oldBackgroundColor = currentColor;
			div.style.backgroundColor = color;
			div.style.borderBottom = '1px solid #999999';
			div.style.borderTop = '1px solid #999999';
		}
		else
		{
			div.style.backgroundColor = div.oldBackgroundColor;
			div.style.borderBottom = '0px none';
			div.style.borderTop = '0px none';
		}
	}
}


function deleteActivity(id)
{
	var form = document.forms["deleteRow"];
	document.deleteRow.aId.value = id;
	form.submit();
}

function deleteNyhet(id)
{
	
	var form = document.forms["deletePost"];
	document.deletePost.postId.value = id;
	form.submit();
}

function editNyhet(id)
{
	
	var form = document.forms["editPost"];
	document.editPost.postId.value = id;
	form.submit();
}





function setDiv()
{

	
	document.getElementById('member').style.visibility = 'visible';
	document.getElementById('member').style.display = "block";

	


}




function showDiv(divId)
{


	




}

function hideDiv(divId)
{


	document.getElementById('member').style.visibility = 'hidden';
	document.getElementById('member').style.display = 'none';

	


}

function hideDivOLD(divId)
{


	if(document.getElementById(divId).style.visibility = 'visible')
	{
		document.getElementById(divId).style.visibility = 'hidden';
		document.getElementById(divId).style.display = 'none';

	}


}


function submitSelect(id)
{
	var myForm = document.forms['submitSelection'];
	
	var bottomRight = (document.body.clientWidth/2)-260;
	var topleft = (document.body.clientHeight/2)-210;
	

	controllerRow = myForm.elements['id'];
	controllerRow.value = id;
	
	
 	myForm.submit();
 }
function setOverlay()
 {
 
		var div = document.getElementById('overlay');
			var opacity = 50;
		div.style.filter="alpha(opacity="+opacity+")";
		div.style.opacity=(opacity / 100);      //NS6 syntax
		div.style.MozOpacity = (opacity / 100);
		div.style.KhtmlOpacity = (opacity / 100); 
		div.style.zIndex = 100;
		div.style.position = 'absolute';
		div.style.top = 0;
		div.style.left = 0;
		div.style.height = (document.body.clientHeight+250) + "px";
		div.style.width = document.body.clientWidth + "px";
		div.style.backgroundColor = 'black';
		div.style.visibility = 'visible';
			
	}
	
	
function setBlueTransparent()

{
 
		var div = document.getElementById('blueTransparent');
		var opacity = 70;
		div.style.filter="alpha(opacity="+opacity+")";
		div.style.opacity=(opacity / 100);      //NS6 syntax
		div.style.MozOpacity = (opacity / 100);
		div.style.KhtmlOpacity = (opacity / 100); 
		div.style.zIndex = 200;
		div.style.position = 'absolute';
		
		var top = (document.body.clientHeight / 2 ) - 110;
		var left = (document.body.clientWidth / 2 ) - 260;
		div.style.top = top + "px";
		div.style.left = left + "px";
		div.style.height = 420 + "px";
		div.style.width =  520+ "px";
		//div.style.backgroundColor = '#0f7dca';
		div.style.backgroundImage="url(/Imgsub/popupBlue.gif)"
		div.style.visibility = 'visible';
			
	}
	
function setPopupItself()	
{
	//	alert('h: ' +  myTable.height + ' | w : ' + myTable.width)
	
		var div = document.getElementById('popupItself');
		div.style.zIndex = 250;
		div.style.position = 'absolute';
		div.style.top = 100 + "px";
		div.style.left = '40%';
	//	div.style.height = myTable.height + "px";
		div.style.width =  300+ "px";
		div.style.backgroundColor = '#ffffff';
		div.style.visibility = 'visible';
		div.style.display = 'block';
		
	
	
		div.style.border = '2px solid #fff';
	
}

function verifyPasswords(password1, password2, message)
		{
			if(password1 == "")
			{
				mess = document.getElementById('userMessage');
				mess.innerHTML = message;
				alert(message);
				return false;
			}
			if(password1 == password2)
				return true;
			else
			{
				mess = document.getElementById('userMessage');
				mess.innerHTML = message;
				alert(message);
				return false;
			}
		}
		
function validateBlankField(myFormName, myElementName, message)
{
// Check the value of the element named text_name
// from the form named text_form
var myForm = document.forms[myFormName];
var myElement = myForm[myElementName];
	

if (myElement.value == "")
{
// If null display and alert box
alert(message);
// Place the cursor on the field for revision
myElement.focus();
// return false to stop further processing
return (false);
}
// If text_name is not null continue processing
return (true);
}		
 	