//*** ÖPPNAR OCH STÄNGER BOXARNA ***
function setBoxVisibility(obj)
{
	if(document.getElementById("subBox"+obj).style.display == "inline")
	{
		document.getElementById("subBox"+obj).style.display = "none";
		document.getElementById("imgClose"+obj).src = "images/boxOpen.png";
	}
	else
	{
		document.getElementById("subBox"+obj).style.display = "inline";
		document.getElementById("imgClose"+obj).src = "images/boxClose.png";
	}
}




//*** ÖPPNA NYTT FÖNSTER ***
//
// <a href="#" onClick="javascript:NewWindow('passwordSender.php','passwordSender',400,150,0,'center'); return false;" class="redBold">Länktext</a>
//
var win=null;

function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random")
	{
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center")
	{
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null)
	{
		LeftPosition=0;
		TopPosition=20;
	}
	
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}





//*** AJAX START *** 
var xmlHttp;
var styrDiv = 'temp';

function setView(obj, view, file)
{ 
	styrDiv = obj;
	document.getElementById(obj).innerHTML = "<center>Laddar...</center>";
	xmlHttp = GetXmlHttpObject()

	if (xmlHttp==null)
 	{
 		alert ("Din webbläsare stödjer inte HTTP Requests");
 		return
 	}
	
	var url = "Ajax/" + file;
	url=url+"?q2=" + view
	url=url+"&sid=" + Math.random()
	xmlHttp.onreadystatechange = stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{document.getElementById(styrDiv).innerHTML = xmlHttp.responseText;} 
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{xmlHttp=new XMLHttpRequest();} // Firefox, Opera 8.0+, Safari
	catch (e)
 	{
		try //Internet Explorer
		{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e)
		{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
 	}
	return xmlHttp;
}     
//*** AJAX SLUT *** 