var SelRow=0;
var SelRowBC="";
var srl=6;
var smap= new Array("","","","");
var fieldName="";
var update=false;
var showDiID;
var vvDataTop=80;
var field;

var ld=(document.all);
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;

function fldChkNumeric(){
	try{
		if(field!=null){
			var value = field.value;
			if(isNaN(value)){
				alert("Antal skall anges med siffror!");
				field.focus();
				return false;
			}
			if(parseInt(value)<1){
				alert("Antal skall vara storre an noll!");
				field.focus();
				return false;
			}
		}
		else{
			return true;
		}
	}
	catch(e){
		var info ="Tekniskt fel!\n\n";
		info += e.description;
		alert(info);
		return true;
	}
	return true;
}

function ei(idx){
	SelectRow(idx+1)
	var f=document.forms[0]
	var sid=idx*7

	actc=idx
	 /* f.txtExID.value=idx+1 */
	idx*=srl;

	//var exid = document.getElementById('txtExID');
	var exid = document.getElementById('txtExID');
	var inln = document.getElementById('txtInloggName');
	var los = document.getElementById('txtLosen');
	var nam = document.getElementById('txtUserName');

	exid.value=smap[0];
	inln.value=smap[1];
	los.value=smap[2];
	nam.value=smap[3];

	/*alert(exid.value);*/
}

function di(idx){
	SelectRow(idx+1);
	
	var strConf = "Ar du saker pa att du vill ta bort inloggnig for:\n";
	//"&#196;r du s&#228;ker p&#229; att du vill ta bort inloggning f&#246;r "

	if(!confirm(strConf+smap[3]+"?"))
		{SelectRow(-1);return;}

	var f=document.f;

	act="delinlogg.asp?exid="+smap[0];

	location=act;

	DeleteRow(idx+1);
}

function SelectRow(row)
{
	if(SelRow!=row)
	{
		var bar=document.getElementById('tblEXInloggs')
		if(SelRow>=0)
			bar.rows[SelRow].style.backgroundColor=SelRowBC
		if(row>=0)
		{
			SelRowBC=bar.rows[row].style.backgroundColor
			bar.rows[row].style.backgroundColor="#7A7AE5"
		}
		smap[0] = bar.rows[row].cells[0].innerHTML;
		smap[1] = bar.rows[row].cells[1].innerHTML;
		smap[2] = bar.rows[row].cells[2].innerHTML;
		smap[3] = bar.rows[row].cells[3].innerHTML;
		SelRow=row
	}
}

function DeleteRow(row)
{
	if(SelRow!=row)
	{
		var bar=document.getElementById('tblEXInloggs');
		var tblrow = bar.rows[row];
		
		bar.rows[row].remove(tblrow);

		SelRow=0;
	}
}

function topWindow(sPicPath)
{
	popup = window.open("/Script/showPic.asp?pic="+sPicPath, "", "height=100, width=100, resizable=yes, titlebar=no, directories=no, statusbar=no");
	//scrollbars=no, toolbar=no, menubar=no, location=no, titlebar=no, fullscreen=no
	//"height=250, width=700, resizable=yes, titlebar=no, directories=no, statusbar=no"
}

//Javascript från frmMain.aspx
var showDiID
var theForm = document.forms['CatalogForm'];

if (!theForm) {
	theForm = document.CatalogForm;
}

function fnShowDialog()
{
	showDiID = showModelessDialog("frmLoggin.aspx",window,"status:false;dialogWidth:350px;dialogHeight:250px");
}

function openLoggin()
{
	window.open("frmLoggin.aspx", "_blank", "height=250,width=350,status=yes,toolbar=no,menubar=no,location=no");
}

function dilw(fl)
{
  var x,y;
  if (self.innerHeight)
  {// all except Explorer
    x = self.innerWidth;
    y = self.innerHeight;
  }
  else 
  if (document.documentElement && document.documentElement.clientHeight)
  {// Explorer 6 Strict Mode
   x = document.documentElement.clientWidth;
   y = document.documentElement.clientHeight;
  }
  else
  if (document.body)
  {// other Explorers
   x = document.body.clientWidth;
   y = document.body.clientHeight;
  }

  var el=document.getElementById('DIV_DESKTOP');
	if(null!=el)
	{
		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.width = x + "px";
		el.style.height = y + "px";
		el.style.zIndex = 1;

		if (fl==0)
		{
			el.style.visibility = "hidden";
		}
	}

	var el=document.getElementById('loader');
	if(null!=el)
	{
		var top = (y/2) - 50;
		var left = (x/2) - 250;
		if( left<=0 ) left = 10;

		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.left = left + "px"
		el.style.top = top + "px";

		if (fl==0)
		{
			el.style.visibility = "hidden";
		}
//		for(i=1; i< 301; i++)
//		{
//			el.style.width = i + "px";
		el.style.zIndex = 2;
//		}
	}
}

function init() 
{ 
	if(ns4) {
		ld=document.loading;
		ld.visibility="hidden";
		/* alert("ns4"); */
	} 
	else if (ns6||ie4) {
		/*
		ld.display="none"; 
		*/

		var ldiv = document.getElementById("loading");
		ldiv.style.display="none";
		/*
		alert("ns6||ie4 ld.display='none'"); 
		*/
	}
	else
		alert("Something else ??");
}

function moveVVData(bodyScrollTop)
{
	var vvData = document.getElementById("vvData");
	
	if (bodyScrollTop > vvDataTop)
	{
		vvData.style.top = bodyScrollTop;
	}
	else
	{
		vvData.style.top = vvDataTop;
	}

}
