
function popup (url, name, width, height, status, menu, resizable) {
	var prop = 'toolbar=no,location=no,directories=no,scrollbars=yes,copyhistory=no,';
	prop += 'status='+ (status ? 'yes' : 'no') +',';
	prop += 'resizable='+ (resizable ? resizable : 'yes') +',';
	prop += 'menu='+ (menu ? 'yes' : 'no') +',';
	prop += 'width='+ (width ? width : 500) +',';
	prop += 'height='+ (height ? height : 400);

	var win = window.open(typeof(url) == 'string' ? url : url.href, name, prop);

	win.focus();
	
	return false;
}

function winpop(win)
{
	bakom=window.open(win, "bakom", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=540,height=400");
	bakom.focus();
}
function barnen(win)
{
	bakom=window.open(win, "bakom", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=750,height=550");
	bakom.focus();
}
function custompop(win, width, height, status, menu)
{
	bakom=window.open(win, 'bakom', 'toolbar=no,location=no,directories=no,status=' + status +  ',menubar=' + menu + ',scrollbars=yes,resizable=yes,copyhistory=no,width=' + width + ',height=' + height);
	bakom.focus();
}
function lockedCat() {
	alert("Du behöver vara inloggad för att se denna informationen");
}
function visa(id) { //togglar visa av / på 
  if(document.getElementById) { var obj = document.getElementById(id); } 
  else 
    if(document.all){ var obj = document.all(id); } 
    if(obj.style.display == 'none'){ obj.style.display = ''; } 
    else { obj.style.display = 'none'; } 
} 


function show(id) { //visa
  obj = document.getElementById(id);
  if (obj != null) {
  	obj.className = 'openedMenu'; 
  }
}

function hide(id) { //dölj
  obj = document.getElementById(id);
  if (obj != null) {
  	obj.className = 'closedMenu'; 
  }
}

function openSubMenu(id) {
	hideMenus();
	show(id);
}


//image gallery
var aImages = new Array;
var aImageIDs = new Array;

function preloadImage( index, src, id ) {
	aImages[index] = new Image();
	aImages[index].src = src;
	aImageIDs[index] = id;
}


function Swapimage( index, width, height ) {
	custompop('imageview.php?image='+aImages[index].src+'&id='+aImageIDs[index], 471, 520, 'yes', 'no');
}


function closeImage() {
	document.getElementById('imgHolder').style.display = "none";
}


function SwapimageHorizontal( index, width, height ) {
	custompop('imageview.php?image='+aImages[index].src+'&id='+aImageIDs[index], 471, 520, 'yes', 'no');
}


function closeImageHorizontal() {
	//document.getElementById('imgHolder').style.display = "none";
}


//hide/show
w3 = document.getElementById ? true : false;
ns = document.layers ? true : false;
ie = document.all ? true : false;

function divswap(hideshow, id) {
	if(w3) {
		document.getElementById(id).style.visibility = (hideshow != 'show') ? 'hidden' : 'visible';
	} else if (ie) {
		document.all[id].style.visibility = (hideshow != 'show') ? 'hidden' : 'visible';
	} else if (ns) { 
		document.layers[id].visibility = (hideshow != 'show') ? 'hide' : 'show';
	}
}