//----------------------------------------------------------------------------------
// Function: 	Function pack
// Author: 	Lars Nielsen - 6.11.2005
//----------------------------------------------------------------------------------

var currActive = null;
function none(){}

function setAMon(o){if(currActive != o){o.className = 'actMenuRollover';}}
function setAMoff(o){if(currActive != o){o.className = 'actMenu';}}

function setMon(o){if(currActive != o){o.className = 'actMRollover';}}
function setMoff(o){if(currActive != o){o.className = 'actM';}}

function setDocon(o){if(currActive != o){o.className = 'DocItemRollover';}}
function setDocoff(o){if(currActive != o){o.className = 'DocItem';}}


function setTEon(o){o.className = 'te_but_s';}
function setTEoff(o){o.className = 'te_but';}

function setGon(o){o.className = 'g_but_s';}
function setGoff(o){o.className = 'g_but';}

function swapImg(imgDocID,imgObjName) {document.images[imgDocID].src = eval(imgObjName + ".src");}
function newImage(arg){if (document.images) {rslt = new Image();rslt.src = arg;return rslt;}}


if (document.images){
 msgbox_x = newImage("/images/msgbox_x.gif");
 msgbox_x_s = newImage("/images/msgbox_x_s.gif");

 normalhtml_x = newImage("/images/txt_normal_html.gif");
 normalhtml_x_s = newImage("/images/txt_normal_html_s.gif");
}


function validateNr(formin,fieldin) {
var field = eval('document.'+formin+'.'+fieldin+'.value');
var valid = "0123456789";

if (field == ''){return false;}
else{
	for (var i=0; i < field.length; i++) {
		temp = "" + field.substring(i, i+1);
		if (valid.indexOf(temp) == "-1"){eval('document.'+formin+'.'+fieldin+'.value = "0"');return false;}
	}
	return true;
	}
}

function validateYear(formin,fieldin) {
var field = eval('document.'+formin+'.'+fieldin+'.value');
var valid = "0123456789";

if (field == ''){return false;}
else{
	for (var i=0; i < field.length; i++) {
		temp = "" + field.substring(i, i+1);
		if (valid.indexOf(temp) == "-1"){eval('document.'+formin+'.'+fieldin+'.value = "1900"');return false;}
	}
	return true;
	}
}

function isaNr(string) {
    for (var i=0;i < string.length;i++){
        if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9')){return false;}
    }
    	return true;
}

function cc_calcPos(topmenu, i, x_adjust, y_adjust){

	var coords = getXYcoord(topmenu);
	
	if(nn){this.ele=document.getElementById(i);this.ele.style.left=(coords.x-x_adjust);this.ele.style.top=(coords.y+y_adjust);}
	else{eval(i+'.style.pixelLeft = '+(coords.x-x_adjust));eval(i+'.style.pixelTop = '+(coords.y+y_adjust));}
}  

function cc_calcPosBubble(topmenu, i, x_adjust, y_adjust){

	var coords = getXYcoord(topmenu);
	
	if(nn){this.ele=document.getElementById(i);this.ele.style.left=(coords.x+x_adjust);this.ele.style.top=(coords.y+y_adjust);}
	else{eval(i+'.style.pixelLeft = '+(coords.x+x_adjust));eval(i+'.style.pixelTop = '+(coords.y+y_adjust));}
}  



function popUpAll(cUrl,width,height,x,y,scrollbars,toolbar){

	if (x == 0){x = ((window.screen.width - width)/2);}
	if (y == 0){y = ((window.screen.height - height)/2);}
	if (scrollbars == ''){scrollbars = 'yes';}
	if (toolbar == ''){toolbar= 'yes';}

	var popUpA = window.open(cUrl, 'popupA', 'width='+width+',height='+height+',left='+x+',top='+y+',toolbar='+toolbar+',location=no,status=yes,scrollbars='+scrollbars+',noresize,menubar=no');
	popUpA.focus();
}

function popUpPrint(cUrl,width,height){

	x = ((window.screen.width - width)/2);y = ((window.screen.height - height)/2);

	var popUpA = window.open(cUrl, 'popupA', 'width='+width+',height='+height+',left='+x+',top='+y+',toolbar=yes,location=no,status=yes,scrollbars=yes,resizable,menubar=yes');
	popUpA.focus();
}

function popInfo(cUrl){

	var popUpI = window.open(cUrl, 'popupI', 'width=340,height=260,left=10,top=10,toolbar=no,location=no,status=no,scrollbars=yes,noresize,menubar=no');
	popUpI.focus();
}


function resizeOuterTo(w,h){			//resize browserwindow
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}

function getRadioValue(radioName){
	
	var collection; collection = document.all[radioName];
	if(collection){for(i=0;i<collection.length;i++){if(collection[i].checked){return(collection[i].value);}}}
}
//--------------------------------------------------------------------------------
function popImageLib(o, cUrl){

	docobj = o;

	width = 600; height = 600;
	x = ((window.screen.width - width)/2);
	y = ((window.screen.height - height)/2);

	var popUpLib = window.open(cUrl, 'popupI', 'width='+width+',height='+height+',left='+x+',top='+y+',toolbar=no,location=no,status=yes,scrollbars=yes,noresize,menubar=no');
	popUpI.focus();
}
//--------------------------------------------------------------------------------

//---------------------------------------------------------------------
//----------------------- FolderTree function -------------------------
//---------------------------------------------------------------------
var openImg = new Image();
openImg.src = "../images/fld_open.gif";
var closedImg = new Image();
closedImg.src = "../images/fld_closed.gif";

function showBranch(branch){
	var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block")
		objBranch.display="none";
	else
		objBranch.display="block";
}

function swapFolder(img){
	objImg = document.getElementById(img);
	if(objImg.src.indexOf('closed.gif')>-1)
		objImg.src = openImg.src;
	else
		objImg.src = closedImg.src;
}
