////////////////////////////////////////////////////////////////////
//					  JavaScript Functions						  //
//							ver. 1.1							  //
//						Author: Alex Kvak						  //
////////////////////////////////////////////////////////////////////

// initializing a browser
var aks_isIE=0,aks_isNN=0, aks_isMF=0;
if (navigator.userAgent.indexOf("Firefox")!=-1) aks_isMF=1;
if	(document.all) 
	aks_isIE=1;
else 
	if(document.layers) 
		aks_isNN=1;
var aks_isOpera = (navigator.userAgent.indexOf("Opera") > 0);

// 
function aks_suredelete(obj)
{
    val_ = confirm(aks_suredelete_confirm);
    if (val_== false) return false;
    obj.action_.value='delete';
    return true;
}

function aks_suredelete_rubrik(obj)
{
    return confirm(aks_suredelete2_confirm);
}

function aks_sureoben(obj)
{
    val_ = confirm("Wollen Sie dieses Artikel nach oben schieben?");
    if (val_== false) return false;
    obj.action_.value='oben';
    return true;
}

function aks_sureunten(obj)
{
    val_ = confirm("Wollen Sie dieses Artikel nach unten schieben?");
    if (val_== false) return false;
    obj.action_.value='unten';
    return true;
}

// return Element by Id 
function aks_getElement(n)
{
   if (typeof document.getElementById(n) != "undefined")
	   return document.getElementById(n);
   else
   	   return false;
}

// creates a new window
function aks_popupWnd(url,title,width,height,scrollbars)
{
   if (title == "random")
   	 title = "wnd"+(Math.random() * 10).toString();
	 
   var options = "status=off,menubar=off,height="+height+",width="+width;
   var xtop = (screen.height-height)/2, xleft = (screen.width-width)/2;
   options += ",top="+xtop+",left="+xleft;
   if (scrollbars)
   	options += ",scrollbars=auto";
   else
   	options += ",scrollbars=off";
   
   var popup = window.open(url,title,options); 
   popup.document.close();
}

// set the display property of Element num
function aks_setView(num, show)
{
	var obj = aks_getElement(num);
	obj.style.display = (show) ? 'block':'none';
}

// set the visibility of Element num	
function aks_setVisibility(num, show)
{
	var obj = aks_getElement(num);
    obj.style.visibility = (show) ? "visible":"hidden";
}

// returns the display property of Element num			
function aks_getView(num)
{
    var obj = aks_getElement(num);
    return obj.style.display;
}

// changes the visibility of Element num		
function aks_changeView(num)
{
    visibility_ = aks_getView(num);
	show = (visibility_ == 'none') ? true : false;
	aks_setView(num, show);
	return true;
}

// sets the color farbe to all cells of table row obj
function aks_setFarbe(obj,farbe)
{
    theCells = obj.cells;
    var rowCellsCnt  = theCells.length;
    for (c = 0; c < rowCellsCnt; c++) 
        theCells[c].style.backgroundColor=farbe;
}

// sets the color farbe to specified cell obj
function aks_setFarbeCell(obj,farbe)
{
     obj.style.backgroundColor = farbe;
}
