// TreeMenu.js, Version 1.0, 2004/03
// Copyright (C) 2004 by Hans Bauer, Schillerstr. 30, D-73072 Donzdorf
//                       http://www.h-bauer.de
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation.
//
var tree_name;
var x;var y;
	
function MyBox(entry){
	MyDialog.OpenDialog('a','b','../core/par_entry.php?entry=' + entry ,'600','600','');
}

function SetIt (a) {
	x=a;
}

function GetIt (b,command) {
	y=b;
	if(x != y){
		question = confirm("Wirklich verschieben ?")
		if (question !="0"){
			document.location.href="index.php?source="+ x +"&"+ command +"="+ y;
		}
	}
}

function Node(id,indent,text,target,url,tooltip,iconOpen,iconClose,isOpen,isWorkflow,entry,code) {    //>Node (Folder or Item)
	this.id        = id;				this.indent    	= indent;                  // Initialize variables
	this.text      = text;				this.target    	= target;                  //     ..        ..
	this.url       = url;				this.tooltip   	= tooltip;                 //     ..        ..
	this.iconOpen  = iconOpen;			this.iconClose 	= iconClose;               //     ..        ..
	this.parent    = null;				this.childs    	= [];                      //     ..        ..
	this.isOpen    = isOpen;			this.entry		= entry;
	this.isWorkflow = isWorkflow;		this.code		= code;
}                                                   //     ..        ..

function treemenu(name, showLines, showIcons, useCookies, me) {                     //>treemenu
 this.name      = name;               this.showLines = showLines;               // Initialize variables
 this.showIcons = showIcons;          this.useCookies= useCookies;              //     ..        ..
 this.nodes     = [];                 this.root      = new Node(-1,-1,'root');  //     ..        ..
 this.selected  = -1;                 this.maxIndent = 0;                       //     ..        ..
 this.expire    = 1;                  this.openNodes = '';                      //     ..        ..
 this.classDepth= 2;                                                            // ClassDepth for text-format-> css-file
 this.readCookies();                                                            // Read cookies if available
 
 if (!navigator.cookieEnabled) this.useCookies = false;                         // Respect the browsers cookie setting
 this.defaults = {                                                              // Default images/icons
   iconRoot  : '../'+me+'/images/root.gif',        iconItem  : '../'+me+'/images/item.gif',               //    ..        ..
   iconOpen  : '../'+me+'/images/open.gif',        iconClose : '../'+me+'/images/close.gif',              //    ..        ..
   passLine  : '../'+me+'/images/passline.gif',    empty     : '../'+me+'/images/empty.gif',              //    ..        ..
   tieLine   : '../'+me+'/images/tieline.gif',     tiePlus   : '../'+me+'/images/tieplus.gif',            //    ..        ..
   endLine   : '../'+me+'/images/endline.gif',     endPlus   : '../'+me+'/images/endplus.gif',            //    ..        ..
   rectPlus  : '../'+me+'/images/rectplus.gif',    tieMinus  : '../'+me+'/images/tieminus.gif',           //    ..        ..
   rectMinus : '../'+me+'/images/rectminus.gif',   endMinus  : '../'+me+'/images/endminus.gif',           //    ..        ..
   minIcon   : '../'+me+'/images/minicon.gif'  } }                                           //

// ----------- Build up menu -----------
//----------------Put a node to the treemenu
treemenu.prototype.put = function(open, label, target, url, tooltip, iconOpen, iconClose, isWorkflow, entry, code) {
	if (this.selected==-1) this.selected = this.nodes.length;                      // Set 'selected' if not cookie-defined
 	this.add(open, label, target, url, tooltip, iconOpen, iconClose, isWorkflow, entry, code);
}


//-------------Add a node to the treemenu
treemenu.prototype.add = function(open, label, target, url, tooltip, iconOpen, iconClose, isWorkflow, entry, code) {
	var indent = 0;
 	while (label.charAt(indent)=='.') indent++;						//	Indent by leading spaces
	if (this.maxIndent<indent) this.maxIndent = indent;				// 	Adjust 'maxIndent'
	var id = this.nodes.length;										//	ID of the new node
	var isOpen = (open==0) ? false : true;							//	IsOpen from given value '0' or '1'
	if (this.openNodes && id<this.openNodes.length){				//	On given 'OpenNodes'
     isOpen = (this.openNodes.charAt(id)=='1') ? true : false;		// -> Status depending on cookie
	} else isOpen = false;
	// New node: ID corresponds with number                  
	var node = new Node(id, indent, label.substr(indent), target, url, tooltip, iconOpen, iconClose, isOpen, isWorkflow, entry, code);
	this.nodes[this.nodes.length] = node;							//	Append node to the nodes-array
	for (i=this.nodes.length-1; i>=0; i--)							//	Parent node:
	if (this.nodes[i].indent < indent) {							//	Loop back to find parent by indent
		node.parent = this.nodes[i];
		break;
	}
	if (!node.parent) node.parent = this.root;						//	Root-node is parent if none found
	if (node.parent.indent < node.indent-1){							//	Invalid indent
    	alert('Indent of "' + node.text + '" must be <' + (node.parent.indent + 2)); //   -> alert-message
	}
	node.parent.childs[node.parent.childs.length] = node;			//	New node is child of the parent
}

                                                                                // ---------- Build Html-code ----------
treemenu.prototype.toString = function(sysentry,me) {                                      //>ToString used by document.write(...)
//	var str = '<div class="TreeMenu"><ul>';                                            // Encapsulate class 'TreeMenu'
	var str = '<div class="treeMenu">';                                            // Encapsulate class 'TreeMenu'
	var lastIndent = 0;                                                            // Initialize lastIndent
	for (id=0; id<this.nodes.length; id++) {                                       // Loop: Nodes
		var node = this.nodes[id]                                                    //   Current node
		if (lastIndent < node.indent) lastIndent = node.indent;                      //   Update lastIndent to max
		while (lastIndent>node.indent){ 																	          //   Close previous </div>-Subtrees
			str += '</ul>';   lastIndent--; 
		}
		str += this.writeNode(node,sysentry,me);                                                 //   Write node
		if (0<node.childs.length) {                                                  //   Parent -> SubTree of childs
			str += '<ul id="' + this.name + 'SubTree_' + id                           //   -> Write <div..-block to display
         		+ '" style="display:'                                              //            or to hide the SubTree
				+ ((node.isOpen) ? 'block' : 'none') + ';width:200px">';
		}
	}                      																												//            according to isOpen-value
	for (i=lastIndent; i>0; i--) str += '</ul>';                                  // Close remaining SubTrees
	str += '</div>';                                                               // Close class 'TreeMenu'
//	str += '</ul></div>';                                                               // Close class 'TreeMenu'
	this.setCookies(this.expire);                                                  // Set Cookies
	this.loadSelected();                                                           // LoadSelected on already filled frames
	return str;					                                                                 // Discomment to see Html-Code
}

// -------------- Write ----------------
treemenu.prototype.writeNode = function(node,sysentry,me){
	if (node.target=='hide') return '';
	var str = '<li class="treemenu">'
	//var str = '<div>'
		+ this.writeIndenting(node)  + this.writeTieUpIcon(node)
		+ this.writeNodeSymbol(node);
	if(node.code & 64) str +=  '<img src=\"../' + me +'/images/workflow.gif\" alt=\"in workflow\" width=\"15\" height=\"15\" border=\"0\">';
	if(parseInt(node.entry) > 4) str +=  '<img src=\"../' + me +'/images/tool3.gif\" alt=\"edit\" width=\"15\" height=\"12\" border=\"0\" onclick=\"MyBox('+ node.entry +')\">';
	str += this.writeNodeText(node);
	if(node.entry != ''){
		if(parseInt(node.entry) > 4){
			str +=  '&nbsp;<a href=\"Javascript:SetIt('+ node.entry +');\"><img src=\"../' + me +'/images/source.gif\" alt=\"Quelle\" width=\"10\" height=\"16\" border=\"0\"></a>';
			str +=  '<a href=\"Javascript:GetIt('+ node.entry +',\'prev\');\"><img src=\"../' + me +'/images/pre.gif\" alt=\"Voranstellen\" width=\"10\" height=\"16\" border=\"0\"></a>';
		}
		str +=  '<a href=\"Javascript:GetIt('+ node.entry +',\'child\');\"><img src=\"../' + me +'/images/child.gif\" alt=\"Unterverzeichnis\" width=\"10\" height=\"16\" border=\"0\"></a>';
		if(parseInt(node.entry) > 4){
			str +=  '<a href=\"Javascript:GetIt('+ node.entry +',\'next\');\"><img src=\"../' + me +'/images/target.gif\" alt=\"Anhängen\" width=\"10\" height=\"16\" border=\"0\"></a>';
		}
 	}
	str += '</li>';
	//str += '</div>';
	return str;
}

// -------------- Write Indenting
treemenu.prototype.writeIndenting = function(node){
	if (node.indent < 2) return '';	// MAX Indent (styles)
	var str      = '';	
	var icons    = [];	
	var ancestor = node.parent; 	
	for (i=node.indent-2; i>=0; i--, ancestor=ancestor.parent){ 	
		icons[i] = (this.isLastChild(ancestor) ? 'empty' : 'passLine');  }	
	for (i=0; i<=node.indent-2; i++) {	
		var icon = this.defaults.empty;	
		if (this.showLines && icons[i]!='empty') icon = this.defaults.passLine;	
		str += '<img name="' + icons[i] + '" src="' + icon + '" alt="" />'; }	
	return str;
}	

//-----------------------WriteTieUpIcon
treemenu.prototype.writeTieUpIcon = function(node)  {
	if (node.indent < 1) return '';
	var icon = this.getTieUpIcon(node);	
	var str  = '';	
	if (0==node.childs.length){	
		str = '<img id="' + this.name + 'TieUp_' + node.id // No childs -> Return only TieUpIcon
					+ '" src="' + icon + '" alt="" />';	
	} else {
		str = '<a href="javascript: ' + this.name + '.toggle(' + node.id + ')">'  // Parent node:
					+  '<img id="' + this.name + 'TieUp_' + node.id	
          +  '" src="' + icon + '" alt="" /></a>';
	}
	return str;
}                                                                  

//------------------WriteNodeSymbol
treemenu.prototype.writeNodeSymbol = function(node) {                           
	var icon = this.getNodeSymbol(node) ;		// GetNodeSymbol
	if (0==node.childs.length) {							// No childs:
		var str = '';
// NO LINK IN SYMBOL
/*	if (node.url) {
			str += '<a href="' + node.url + '"';											//	if a url is given and load
			if (node.target) str += ' target="' + node.target + '")'; //	the url into the target frame.
			str += '">';
		} */
		str += '<img id="' + this.name + 'Symbol_' + node.id		//	Write the Html-code for the
       +  '" src="'   + icon + '" alt="" />';								//	image of the node-symbol
/* if (node.url) str += '</a>'; */
		return str;
	}
 	return   '<a href="javascript: ' + this.name + '.toggle(' + node.id + ')">'	// Parent:
          + '<img id="' + this.name + 'Symbol_' + node.id
          + '" src="' + icon + '" alt="" /></a>';
}

//--------------------WriteNodeText
treemenu.prototype.writeNodeText = function(node) {                             
	var cls = this.getNodeTextClass(node, this.selected);	//	Get NodeTextClass
	var str = '';
	//node.entry + node.isWorkflow + 
	str += '<a id="' + this.name + 'Node_' + node.id + '" class="' + cls + '" '; // Add '<a id=...' and 'class=...'
	if (node.url){
		str += ' href=' + node.url;			//	HRef-link to node.url
	} else {
		str += ' href="javascript: '+this.name+'.toggle('+node.id+')"';	//	toggle
	}
	if (node.url && node.target)  str += ' target="' + node.target   + '"';	//	Target
	if (node.tooltip)	str += ' title="'  + node.tooltip  + '"';							// Title
	str += ' onclick="javascript: ' + this.name + '.pick(' + node.id + ')">';       // OnClick="javascript.pick"
	var text = node.text.split("#");
	if(text.length > 1){
		str += text[0] + '<br>';
		for(i=1; i<(text.length-1); i++){
			str += this.writeIndenting(node)  + this.writeTieUpIcon(node) + '&nbsp;' + text[i] + '<br>';
		}
		str += this.writeIndenting(node)  + this.writeTieUpIcon(node) + '&nbsp;' + text[text.length - 1];
	} else str += node.text;
	str += '</a>';
	return str;
}

treemenu.prototype.getNodeTextClass = function(node, selectID) {                //>GetNodeTextClass for TreeMenu.css
 var cls = (node.id==selectID) ? 'Selected' : 'Node';                           // Class 'Selected', 'Node'
 if (!node.url) cls = 'Item';                                                   //    or 'Item' (without url)
 return cls + '_' + Math.min(node.indent, this.classDepth); }                   // Append '_indent' or '_classDepth'

// Html-code for the TieUpIcon
treemenu.prototype.getTieUpIcon = function(node) {
	if (0 == node.childs.length) {					// No childs:
		if (!this.showLines){
			return this.defaults.empty;					//	Don't show Lines   -> empty
		} else if(this.isLastChild(node)){
			return this.defaults.endLine;				//	Else if last child -> endLine
   	} else return this.defaults.tieLine;
	}
	else if (node.isOpen) {									//	Open parent:
		if (!this.showLines) {
//			return this.defaults.rectMinus; 		//	Don't show Lines -> rectMinus
			return this.defaults.empty; 		//	Don't show Lines -> rectMinus
   } else if (this.isLastChild(node)){
	 	return this.defaults.endMinus;				//	Else if last child -> endMinus
   } else return this.defaults.tieMinus;  //	Else if fore child -> tieMinus
	} else {																//	Closed parent:
		if (!this.showLines){
			//return this.defaults.rectPlus;			// 	Don't show Lines   -> rectPlus
			return this.defaults.empty;			// 	Don't show Lines   -> rectPlus
		} else if (this.isLastChild(node)){
			return this.defaults.endPlus;				//	Else if last child -> endPlus
   	} else return this.defaults.tiePlus;	// 	Else if fore child -> tiePlus
	}
}


treemenu.prototype.getNodeSymbol = function(node) {                             //>GetNodeSymbol
	if (!this.showIcons)  return this.defaults.minIcon;                            // No Symbols-> 'minIcon' (for IE)
	if (0==node.childs.length) {                                                   // No childs:
		if (node.iconOpen)  return node.iconOpen;                                    //   Use nodes  'iconOpen'
		else return this.defaults.iconItem;
	}                        														//   or default 'iconItem'
 	else if (node.isOpen) {                                                        // Open parent:
   		if (node.iconOpen) return node.iconOpen;                                    //   Use nodes  'iconOpen'
   		else return this.defaults.iconOpen;
	}                        													//   or default 'iconOpen'
	else {                                                                         // Closed parent:
   		if (node.iconClose) return node.iconClose;                                   //   Use nodes  'iconClose'
   		else return this.defaults.iconClose;
	}
}                      															//   or default 'iconClose'


// --------------- Load ----------------
//---------------LoadSelected
treemenu.prototype.loadSelected = function() {
	this.loadNode(this.selected);
}

treemenu.prototype.loadNode = function(id) {                                    //>LoadNode by ID into it's target frame
 if (id<0) return;                                                              // Only nodes with id>=0
 if (this.nodes[id].target=='hide') return;                                     // Only nodes with no hidden target
 for (var i=0; i<parent.frames.length; i++) {                                   // Loop: Frames in frameset
   if (parent.frames[i].name==this.nodes[id].target) {                          //   Target-frame of the selected node
     parent.frames[i].location.href = this.nodes[id].url;                       //   -> Reference to the node to load
     break; } } }                                                               //      Break the loop and return

                                                                                // ----------- Pick / Select -----------
treemenu.prototype.pick = function(id) {                                        //>Pick a node by id
 var node = this.nodes[id];                                                     // Picked node
 if (node.url) {                                                                // Nodes with URL (->no href to toggle)
   if      (node.indent==0       && this.showIcons==false) this.toggle(id);     // -> Toggle top node without icon
   else if (node.childs.length>0 && node.isOpen==false)    this.toggle(id); }   //    Else: open closed parent node
 this.select(id); }                                                             // Select node by ID & unselect previous
// document.location.reload(); }

treemenu.prototype.select = function(id) {                                      //>Select a node by a given ID
 if (!this.nodes[id].url) return;                                               // Only for a node with url:
 if (this.selected >= 0) {                                                      // Deselect selected Html-node:
   node = document.getElementById(this.name + 'Node_' + this.selected);         //   Get selected Html-node by id
   name = this.getNodeTextClass(this.nodes[this.selected],-1);                  //   ClassName for unselected
   if (node && name) node.className = name;                                     //   Unselect previous selected node
   this.selected  = -1;  }                                                      //   Invalidate this.selected
 node = document.getElementById(this.name + 'Node_' + id);                      // Select Html-node:
 name = this.getNodeTextClass(this.nodes[id], id);                              //   ClassName for selected
 if (node && name) node.className = name;                                       //     Selected previous unselected node
 this.selected  = id;                                                           //     Set this.selected value to id
 this.openAncestors(id);                                                        //     Open the nodes ancestors
 this.setCookies(this.expire); }                                                //     Set cookies

treemenu.prototype.openAncestors = function(id) {                               //>OpenAncestors of the node with id
 if (id<0) return;                                                              // Only valid nodes with ID>=0
 var ancestor = this.nodes[id].parent;                                          // Ancestor is parent node;
 while(ancestor.indent>=0) {                                                    // Loop: Ancestors
   if (!ancestor.isOpen) { ancestor.isOpen=true;  this.updateNode(ancestor); }  //   Open and update ancestor
   ancestor = ancestor.parent;   } }                                            //   Parent of ancestor  }

treemenu.prototype.selectPath = function(path) {                                //>SelectPath  (for page registration)
 path = this.pathWithSlash(path);                                               // Ensure path with slash '/'
 if (this.selected>=0) {                                                        // A node ist already selected:
   var url = this.pathWithSlash(this.nodes[this.selected].url);                 //   URL of the selected node
   if (url==path) return;  }                                                    //   URL already selected -> return
 for (id=0; id<this.nodes.length; id++) {                                       // Loop to search node:
   var url = this.pathWithSlash(this.nodes[id].url);                            //   Node path with slash '/'
   if (url && url==path) { this.select(id);    break; } } }                     //   Equal path -> select node by id

treemenu.prototype.pathWithSlash = function(path) {                             //>PathWithSlash
 var parts = path.split("\\");                                                  // Split path at '\' into string-array
 var str   = parts[0];                                                          // Write first part to 'str'
 for (i=1; i<parts.length; i++) str = str + '/' + parts[i];                     // Add next parts divided by '/'
 return str; }                                                                  // Return path with '/' instead of '\'

                                                                                // ---------- Toggle / Update ----------
treemenu.prototype.toggle = function(id) {                                      //>Toggle a node by id
 if (this.nodes[id].childs.length==0) return;                                   // Only for parent nodes
 this.nodes[id].isOpen = !this.nodes[id].isOpen;                                // Toggle node-status (open or close)
 this.updateNode(this.nodes[id]);                                               // Update the node
 this.setCookies(this.expire); }                                                // Set cookies

treemenu.prototype.updateNode = function(node) {                                //>UpdateNode
 subTree = document.getElementById(this.name + 'SubTree_' + node.id);           // Get Html-element: SubTree
 tieUp   = document.getElementById(this.name + 'TieUp_'   + node.id);           //                   TieUpIcon
 symbol  = document.getElementById(this.name + 'Symbol_'  + node.id);           //                   NodeSymbol
 if (subTree) subTree.style.display = (node.isOpen) ? 'block' : 'none';         // Update Html-elem. SubTree
 if (tieUp)   tieUp.src   = this.getTieUpIcon(node);                            //                   TieUpIcon
 if (symbol)  symbol.src  = this.getNodeSymbol(node); }                         //                   NodeSymbol

                                                                                // ----------- IsLastChild -------------
treemenu.prototype.isLastChild = function(node) {                               //>IsLastChild (?)
 var parent = node.parent;                                                      // Parent of the node
 return ((node == parent.childs[parent.childs.length-1]) ? true : false); }     // Check for last child

                                                                                // --------- Level/Lines/Icons ---------
treemenu.prototype.level = function(level) {                                    //>Level to open/close menu
 for (id=0; id<this.nodes.length; id++) {                                       // Loop: nodes
   this.nodes[id].isOpen = (this.nodes[id].indent<level) ? true : false;        //   Open/close node depending on level
   this.updateNode(this.nodes[id]); }                                           //   Update the node
 this.setCookies(this.expire); }                                                // Set cookies

treemenu.prototype.lines = function(bool) {                                     //>Lines to be shown (?)
 if (this.showLines == bool) return;                                            // Nothing changed -> return
 this.showLines = bool;                                                         // Update 'showLines'
 var passLines = document.getElementsByName("passLine");                        // Get PassLines
 if (!passLines) return;                                                        // Existing passLines:
 for (i=0; i<passLines.length; i++) {                                           //  Loop: passLines
   passLines[i].src = (bool) ? this.defaults.passLine : this.defaults.empty; }  //   Update icon-source
 for (id=0; id<this.nodes.length; id++) {                                       // TieUpIcon for each node
   if (this.nodes[id].indent < 1) continue;                                     //   with indent >= 1
   var tieUp = document.getElementById(this.name + 'TieUp_' + id);              //   TieUpIcon of the node
   if (tieUp) tieUp.src = this.getTieUpIcon(this.nodes[id]);  }                 //   Update icon-source
 this.setCookies(this.expire); }                                                // Set cookies

treemenu.prototype.icons = function(bool) {                                     //>Icons to be shown (?)
 if (this.showIcons == bool) return;                                            // Nothing changed -> return
 this.showIcons = bool;                                                         // Set 'showIcons'-value
 for (id=0; id<this.nodes.length; id++) {                                       // Loop: nodes
   var icon  = this.getNodeSymbol(this.nodes[id]);                              //   Get node symbol
   var image = document.getElementById(this.name + 'Symbol_' + id)              //   Get Html-image by id
   if (image)  image.src = icon; }                                              //   Set image source to node symbol
 this.setCookies(this.expire); }                                                // Set cookies

                                                                                // -------------- Cookies --------------
treemenu.prototype.expiration = function(expire) {                              //>Expiration
 this.expire = expire;          this.setCookies(this.expire); }                 // Set/Save expiration period of cookies

treemenu.prototype.cookies = function(bool) {                                   //>Cookies to be used (?)
 if (bool) { this.useCookies = bool;  this.setCookies(this.expire);   }         // Use cookies -> Set cookies
 else      { this.setCookies(-1);     this.useCookies = bool;         } }       // No  cookies -> Clear existing cookies

treemenu.prototype.setCookies = function(expire) {                              //>SetCookies
 this.openNodes = '';                                                           // Initialize 'openNodes'-String
 for (i=0; i<this.nodes.length; i++)                                            // Loop: nodes
   this.openNodes += (this.nodes[i].isOpen) ? '1' : '0';                        //   Fill 'openNodes'-String
 this.setCookie("Open"+this.name, this.openNodes, expire);                           // Set cookie 'OpenNodes'
 this.setCookie("Expire"   , this.expire,    expire); }                         //            'Expire'

treemenu.prototype.readCookies = function() {                                   //>ReadCookies (as string!)
 var open   = this.getCookie("Open"+this.name);                                      //              'OpenNodes'
 var expire = this.getCookie("Expire");                                         //              'Expire'
 if (open)    this.openNodes = open;                                            //              'openNodes'
 if (expire)  this.expire    = expire;                                          //              'expire'
 if (open) this.useCookies = true;  }              // Cookies found -> useCookies is true

                                                                                // --------------- Cookie --------------
treemenu.prototype.setCookie = function(name, value, expire) {                  //>SetCookie by name and value
 if (!this.useCookies) return;                                                  // Only if cookies are to be used
 var exp = new Date();                                                          // Actual date
 var end = exp.getTime() + (expire * 24 * 60 * 60 * 1000);                      // In 'expire'-days (-1: -> invalidate)
 exp.setTime(end);                                                              // Expire time of cookes
 document.cookie =  name + '=' + value + '; expires=' + exp.toGMTString(); }    // Set cookie with expiration-date

treemenu.prototype.getCookie = function(name) {                                 //>GetCookie value (as string!)
 var cookies  = document.cookie;                                                // Cookies separated by ';'
 var posName  = cookies.indexOf(name + '=');                                    // Start position of 'name='
 if (posName == -1) return '';                                                  // Cookie not found -> Return ''
 var posValue = posName + name.length + 1;                                      // Start position of cookie-value
 var endValue = cookies.indexOf(';',posValue);                                  // End position of cookie value at ';'
 if (endValue !=-1) return cookies.substring(posValue, endValue);               // ';' -> Return substring as value
 return cookies.substring(posValue); }                                          // Else-> Return rest of line as value

