

//////////////////
// browser check for NN6
//
//
var browser;
var version;
//var pixwidth;
//var pixheight;
var NN6=false;

function BrowserCheck()
{
if(navigator.appName=="Netscape")
	{
	browser="Netscape";
	version=(parseInt(navigator.appVersion));
	//pixwidth=screen.width;
	//pixheight=screen.height;
	//alert("Browser:"+browser+version);
	//alert("Upplösning:"+pixwidth+"*"+pixheight)
	}
if(browser=="Netscape"&&version==5)
	NN6=true; // Netscape 6
	else
	NN6=false;
//alert("NN6="+NN6)

}
////////////END\\\\\\\\\\\\\\\\\\

// xScroll 1.0
// Needs BrowserCheck to work properly
var xScrollLayerName; // your layer
var xScrollLayerPx; // your position
var temppx;
function xScroll(xScrollLayerName,xScrollLayerPx)
{

// Internet Explorer 4.0-6.0
if (document.all&&NN6==false)
	{
	temppx = document.all[xScrollLayerName].style.pixelTop;
	temppx = (temppx-(-(-xScrollLayerPx)));
	if(temppx<20)
	document.all[xScrollLayerName].style.top=temppx;
	}

// Netscape 4.0
if (!document.all&&NN6==false)
	{
	temppx = document.layers[xScrollLayerName].pageY;
	temppx = temppx-(-(-(xScrollLayerPx)));
	if(temppx<20)
	document.layers[xScrollLayerName].pageY=temppx;
	}

// Netscape 5.0-6.0
if (NN6==true)
	{
	var xNN6temp;
	xNN6temp = document.getElementById('visa') //xScrollLayerName)
	temppx = temppx-(-(-(xScrollLayerPx)));
	if(temppx<20)
	xNN6temp.style.top=temppx;
	else
	temppx=0;
		
	//temppx = temppx-(-(-(xScrollLayerPx)));
	//xLayerNn6temp.style.pixelTop=temppx;
	
	}

}


/////////////////////////////////
//	xLayer 1.0 layercontrol copmpatible with IE4-6 NN4.5-6.1
//  needs BrowserCheck() to work properly
//  interface looks like, xLayer(xLayerName, xLayerAction)
//  nameOfTheLayer = String (the layers ID)
//  action = String (show/hide)
//////////////////////////////////
var xLayerName;
var xLayerAction;
var xLayerNn6temp;

function xLayer(xLayerName, xLayerAction)
{
//	alert("Running xLayer...")
BrowserCheck(); // checking up the browser. 
// variables used in this function

if (xLayerAction=="show") // show-action
	xLayerAction="visible";

if (xLayerAction=="hide") // hiding-action
	xLayerAction="hidden";

// Internet Explorer 4.0-6.0
if (document.all&&NN6==false)
	{
	//alert("IE")
	document.all[xLayerName].style.visibility=xLayerAction;
	}

// Netscape 4.0
if (!document.all&&NN6==false)
	{
	//alert("NN4")
	document.layers[xLayerName].visibility=xLayerAction;
	}

// Netscape 5.0-6.0
if (NN6==true)
	{
	//alert("NN6")
	xLayerNn6temp = document.getElementById(xLayerName)
	xLayerNn6temp.style.visibility=xLayerAction;
	}



}

function winopen(url){
window.open(url,'', 'width=400,height=300,toolbar=no, scrolling=yes');
}

function save(a, id){
	document.data.actionId.value=id;
	document.data.doAction.value=a;
	document.data.submit();
	
}
function create(id){
	var url = "create.php?id="+id;
	window.open(url, '','height=600,width=500,scrollbars=yes,resizable=yes');
}

function setKate(){
	document.data.actionCase.value = "galleri";
	document.data.submit();	
}

function modKate(mode){

	var oldname = "";
	if (document.data.kate.length > 0)
			oldname = document.data.kate.options[document.data.kate.selectedIndex].text;

	if (mode == "insertkate"){
		oldname = "";
	}
	if (mode != "deletekate"){
		var newkate = window.prompt ("Namn på kategori?", oldname);
	}

	if (newkate != ""){
		document.data.actionData.value = newkate;
	}
	
	if (document.data.kate.length > 0 && mode != "insertkate")
		document.data.actionId.value = document.data.kate.options[document.data.kate.selectedIndex].value;

	document.data.doAction.value = mode;
	document.data.actionCase.value = "galleri";
	document.data.submit();

}

function newfile(){
	document.data.actionCase.value = "galleri";
	document.data.doAction.value = "newimage";
	document.data.submit();
}

function foto(foto_id){
	var url = "foto.php?foto_id=" + foto_id;
	window.open(url, '','toolbar=no,scrollbars=yes,resizable=yes,width=540,height=700');
}

function load(url){
	window.location=url;
}

function send(){
	document.gb_rubrik.asdf.value = "asdf";
	document.gb_rubrik.submit();
}