function setValue(res, divid) {clipper_AJAX.setValueToTargetID(unescape(res),divid,'html')}
//custom function

function clipper_AJAX(){}

clipper_AJAX.initHttpReq = function(){
//init a httpRequest based on browser

	//httpRequest object
	var req;
	
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}
	
	// branch for IE/Windows ActiveX version
	if(!req) {
		var activeXList = new Array("Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP")
        for(var i=0; i < activeXList.length && !req; i++){
            try{
                req = new ActiveXObject(activeXList[i]);
				 break;
            }catch (e){
				//try next in list
            }
        }
	}
	
	//if no req object created
	if(!req) {
		//alert("No HttpRequest handler could be created!");
		return false;
	}
	
	return req;

}

clipper_AJAX.sendHttpReq = function(url,async,callBackFunction){
//send a backend http request and set a return function
	
	//httpRequest object
	var req;
	
	//init httpReq
	req = clipper_AJAX.initHttpReq();
	
	if (req) {
	
		//if async set on ready 
		if (async==true) {
			req.onreadystatechange = function(){
				clipper_AJAX.receiveHttpReq(url,async,req,callBackFunction);
			}
		}
		
		//send request
		req.open("GET", url, async);
		req.send(null);
		
		//if not asyn return function
		if (async==false) {
			return clipper_AJAX.receiveHttpReq(url,async,req,callBackFunction);
		}
		
	} else {
	//if no req object created rise error	
		alert("No HttpRequest handler could be created!\n" + "Url:" + url + "");
		return false;
	}

}

clipper_AJAX.receiveHttpReq = function(url,async,res,callBackFunction) {
//handle onreadystatechange event of req object
//if response OK and ready, call callBackFunction
	
	//process res
	if (res.readyState == 4) {
	//if res shows "loaded"
		if (res.status == 200) {
		//if status OK	
			if (callBackFunction == '') {
			//in no callback function return res
				return res; 
			} else {
			//call callback function with res
				clipper_AJAX.returnCallBackFunction(res,callBackFunction);
			}
		 } else {
		//if not ok rise error
			alert("There was a problem receiving the data!\n" + "Url:" + url + "\n" + "Status:" + res.statusText);
			return false;
		 }
	}
}

clipper_AJAX.returnCallBackFunction = function(res,callBackFunction) {
//call callbackfunction with res and if defined add parameters in callback function
	
	//init
	var i;

	if (callBackFunction == '') {
	//if no callback function defined rise error
		alert("There was a problem processing the url data!\n" + "Error:No callBackFunction defined");
		return false;
	}
	
	i = callBackFunction.indexOf('(');
	if(i == -1) {
	//if only function name defined add res parameters
		callBackFunction = callBackFunction + "(res)";
	}
	
	i = callBackFunction.indexOf('(');
	if( eval('window.' + callBackFunction.substring(0,i)) ) {
	//if the callback function exist cal it
		eval(callBackFunction);
	} else {
	//if the calback function DONT exist, rise error 
		alert("There was a problem processing the url data!\n" + "Error:function " + callBackFunction + " not defined");
		return false;
	}

}

/*###################################################
Utility clipper.Ajax functions 
- Is used by some of the extended clipper.Ajax functions
- You can remove the ones you don't use
###################################################*/

clipper_AJAX.include = function(file) {
//include the field by add js include in header

	var script;
	var element;
	
	script = document.createElement('script');
	script.src = file;
	script.type = 'text/javascript';
	script.defer = true;
	
	element = document.getElementsByTagName('head');
	element.item(0).appendChild(script);

}

clipper_AJAX.setValueToTargetID = function(res,targetID,targetType) {
//Set value to targetID that can be html/field/function/var/alert/return
	
	//init
	var v;
	var tType;
	var tID;
	
	//set type & id
 	tType = targetType.toLowerCase();
	tID = targetID;
	
	//Set v
	if( typeof(res.responseText) != "undefined" ) {
	//if xml res get test	
		v = res.responseText;
	} else {
		v = res.toString();
	}

	//remove last char if "enter" 
	if (v.length > 0 && v.charCodeAt(v.length-1) == 10) {
		v = v.slice(0,-1);
	}

	//set ID after type
	if(tType == "html" || tType == "innerhtml") {
	//if inner html
		var element = document.getElementById(tID);
		if ( element != null ) {
			element.innerHTML = v;
		} else {
			alert("There was a problem setting the XML data!\n" + "Error:ID " + tID + " not found on document");
			return false;
		}
		
	} else if(tType == "field") {
	//if field
		var element = document.getElementById(tID);
		if ( element != null ) {
			element.value = v;
		} else {
			alert("There was a problem setting the XML data!\n" + "Error:Field " + tID + " not found on document");
			return false;
		}

	} else if(tType == "function") {
	//if function
		clipper_AJAX.returnCallBackFunction(v,tID);

	} else if(tType == "var") {
	//if var
		if( typeof( window[tID] ) != "undefined" ) { 
			eval(tID + "=" + "v");
		} else {
			alert("There was a problem setting the XML data!\n" + "Error:var " + tID + " not found on document");
			return false;
		}

	} else if(tType == "alert") {
	//if alert
		alert(v);
		
	} else if(tType == "return") {
	//if return
		return v;
					
	} else {
	//if no target type defined, rise errro
		alert("There was a problem setting the XML data!\n" + "Error:tType " + tType + " not supported");
		return false;
	}

}

clipper_AJAX.returnValuesInViewByColsNo = function(res,keyValue,keyColNo,returnColsNo,returnMaxEntries,callBackFunction) {
//return values for a notes xml view by cols no. in a callback function
	
	//init
	var resXML;
	var resVal;
	
	//Set res xml
	if( typeof(res.responseXML) == "undefined" ) {
		return false;
	}
	resXML = res.responseXML;
	
	//get values from xml view
	resVal = clipper_AJAX.GetValuesInXMLViewByColsNo(resXML,returnColsNo,returnMaxEntries);
	
	//return res val
	clipper_AJAX.returnCallBackFunction(resVal,callBackFunction);	
	
}

clipper_AJAX.GetValuesInXMLViewByColsNo = function(xmlDoc,sourceColsNo,sourceMaxEntries) { 
//Return cols values in xml view by sourceColsNo
//if sourceMaxEntries = 1 and sourceColsNo is one col number, a string is returned (value)
//if sourceMaxEntries = 1 and sourceColsNo is multi col numbers, a one dimensional string array is returned (row values)
//if sourceMaxEntries > 1 and sourceColsNo is one col number, a one dimensional string array is returned (col values)
//else a multi dimensional string array is returned (row & cols values)

	//init
	var itemsT;
	var itemT;
	var colsT;
	var colT;
	var colNoArray;
	var colNoT;
	var colArrayT;
	var valueArray;
	var maxEntries;
	
	//check for xml function
	if( typeof(xmlDoc) == "undefined" || typeof(xmlDoc.getElementsByTagName) == "undefined" ) {
		return false;
	}

	//split returnColsNo to array
	if (sourceColsNo != "") {
		colNoArray = sourceColsNo.split(',')
	}
	
	//set max entries
	if (sourceMaxEntries == "" ) {
		maxEntries = 0;
	} else {
		maxEntries = parseInt(sourceMaxEntries);
	}


	//get view items
	itemsT = xmlDoc.getElementsByTagName("viewentry");
	if (itemsT.length == 0 ) {
	//if no item in view, return empty string	
		return "";
	}
	
	//init value array
	valueArray = new Array();
	
	//process all items in view
	for (var i = 0; i < itemsT.length; i++) {
	
		//init
		colArrayT = new Array();
		
		//get source text items
		itemT = itemsT[i];
		colsT = itemT.getElementsByTagName("text");
		
		//get text items values by source col no
		if (sourceColsNo != "") {
		//if returnColsNo defined
						
			//get all source cols values
			for (var j = 0; j < colNoArray.length; j++) {
				
				//init
				colT = "";
				colNoT = parseInt(colNoArray[j]);
				
				//get colT value if defined
				if( typeof(colsT[colNoT]) != "undefined") {
					if (colsT[colNoT].hasChildNodes() ) {
						colT = colsT[colNoT].childNodes[0].nodeValue;
					}
				} else {
					alert("There was a problem processing the xml view!\n" + "Error:Col. No. " + colNoT + " not defined in xml view");
					return false;
				}
				
				//append col value to array
				colArrayT[j] = colT;
				
			}//end for j
		
		} else {
		//if no returnColsNo defined, return all cols values	
			
			//get all cols values
			for (var k = 0; k < colsT.length; k++) {
				//init
				colT = "";
				
				//get col value i defined
				if (colsT[k].hasChildNodes() ) {
					colT = colsT[k].childNodes[0].nodeValue;
				}

				//append col value to array
				colArrayT[k] = colT;

			}//end for k
			
		}
		
		//append col array 
		if (maxEntries == 1 && sourceColsNo != "" && colNoArray.length == 1 ) {
			//if max entry is one and only one col to return, return the one value
			return colArrayT[0];
			
		} else if (maxEntries == 1) {
			//if max entry is one, return one dimensional array
			return colArrayT;
		
		} else if (sourceColsNo != "" && colNoArray.length == 1) {
			//if only one col, set one dimensional array
			valueArray[i] = colArrayT[0];
			
		} else {
			//if max entry > 1 and multi cols, set dimensional array
			valueArray[i] = colArrayT;
			
		}
		
		
	}//end for i

	//return valueArray
	return valueArray;

}

clipper_AJAX.addOptionsToSelectByArray = function(sourceArray,sortValuesByTitle,targetID,addMethod,defaultValues) {
//append array values to targetID as select options
	
	//init
	var TitleArray = new Array();
	var ValueArray = new Array();
	
	if(!clipper_AJAX.isArray(sourceArray)) {
	//if sourceArray not an array, return false
		return false
	}

	//Split array in 2
	clipper_AJAX.splitArrayInTo(sourceArray,TitleArray,ValueArray);

	//remove any double values
	clipper_AJAX.uniqSelect(TitleArray,ValueArray);
	
	//sort values if set
	if(sortValuesByTitle == true || sortValuesByTitle == "true") {
		clipper_AJAX.sortSelect(TitleArray,ValueArray);
	}
	
	//add values to select field	
	clipper_AJAX.addOptionsToSelect(TitleArray,ValueArray,targetID,addMethod,defaultValues);

}

clipper_AJAX.addOptionsToSelect = function(TitleArray,ValueArray,targetID,addMethod,defaultValues) {
//add option title & values to select field and set default values to selected

	//init
	var j;
	var addM = addMethod.toLowerCase();
	var selectedArray = "";	
	
	//get select object
	select = document.getElementById(targetID);
	if ( select == null ) {
		alert("There was a problem appending the XML data!\n" + "Error:targetID " + targetID + " not found on document");
		return false;
	}

	//set default select values if defined
	if( defaultValues != "undefined" && defaultValues != "") {
		//split sting to array fro multi support
		selectedArray = defaultValues.split(",");
		//trim array values
		trimArray(selectedArray);
	}
	
	//set start option by addMethod
	if(addM == "append" || addM == "") {
		//if append or no option
		j = select.length;
	} else if(addM == "replace") {
		//if replace
		j = 0;
	} else if(addM == "keepfirst") {
		//if keepfirst
		j = 1;
	} else {
		//if number
		j = parseInt(addM);
	}
	
	//add options to targetID select
	for (var i = 0; i < TitleArray.length; i++) {
		select.options[j] = new Option(TitleArray[i], ValueArray[i]);
		if ( selectedArray.length != 0 && clipper_AJAX.isInArray(selectedArray,ValueArray[i]) ) {
			//if in selectedArray set it to selected
			select.options[j].selected = true;
		}
		j++;
	}
	
	//remove leftovers
	while (select.length > j ){
		select.remove(j);		
	}
	
}

clipper_AJAX.uniqSelect = function(TitleArray,ValueArray) {
//remove any double values in Arrays

	//init
	var ValueAT = new Array();
	var TitleAT = new Array();
	var j = 0;
	
	//create temp uniq array pair
	for (var i = 0; i < ValueArray.length; i++) {
		
		if( !clipper_AJAX.isInArray(ValueAT,ValueArray[i]) ) {
			ValueAT[j] = ValueArray[i];
			TitleAT[j] = TitleArray[i];
			j++;
		}
		
	}

	//append temp array to target
	for (var k = 0; k < ValueAT.length; k++) {
		ValueArray[k] = ValueAT[k];
		TitleArray[k] = TitleAT[k];
	}

	//remove left overs
	ValueArray.splice(k,ValueArray.length -k +1);
	TitleArray.splice(k,TitleArray.length -k +1);
	
}

clipper_AJAX.sortSelect = function(TitleArray,ValueArray) {
//sort Array pair by TitleArray

	//init
	var TitleT;
	var ValueT;
	var flag;
	
	//loop through array pair, and sort it
	for (var i=0;i<TitleArray.length;i++) {
		flag=false;	
		for (var j=TitleArray.length-1;j>=i;j--) {
			if (TitleArray[j-1]>TitleArray[j]) {
			
				TitleT=TitleArray[j-1];
				ValueT = ValueArray[j-1];
				
				TitleArray[j-1]=TitleArray[j];
				ValueArray[j-1]=ValueArray[j];
				
				TitleArray[j]=TitleT;
				ValueArray[j]=ValueT;
				
				flag=true;
			}
		}
		if (flag==false) 
			return ; 	 
	}

}

clipper_AJAX.splitArrayInTo = function(sourceArray,TitleArray,ValueArray) {
//split dbl sourceArray in a two pair array
	
	//loop through sourceArray and add two pair arrays
	for (var i=0 ; i<sourceArray.length ; i++) {
		TitleArray[i] = sourceArray[i][0];
		ValueArray[i] = sourceArray[i][1];
	}
	
}

clipper_AJAX.getRandomNo = function() {
//return random number 

	return Math.round(Math.random()*10000);
	
}

clipper_AJAX.isArray = function(v) {
//return true if v is array

     return v && typeof v === 'object' && typeof v.length === 'number' && !(v.propertyIsEnumerable('length'));
	 
}

clipper_AJAX.isInArray = function(ArrayT,ValueT) {
//check if a value is in array

//loop thru Array and return true if value is in array
	for (var i = 0; i < ArrayT.length; i++) {
		if (ArrayT[i] == ValueT) {
			return true
		}
	}
	return false;
	
}	

function trimString(str) {
//remove whitespaces in from start and end string

	if( typeof(str) != 'string' || str == '') {
		return '';
	}
	
	while(str.charAt(0)==' ')
		str=str.substring(1,str.length);
	while(str.charAt(str.length-1)==' ')
		str=str.substring(0,str.length-1);
	return str;
}

function trimArray(arr) {
//remove whitespaces in all elements in array

	for (var i = 0; i < arr.length; i++) {
		arr[i] = trimString(arr[i]);
	}

}


/*###################################################
Basic clipper.Ajax functions
- Basic Ajax functions to send a http request and reserve the response
###################################################*/

clipper_AJAX.getHttpReq = function(url){
//make a sync http request and return the response obj

	var res;

	res = clipper_AJAX.sendHttpReq(url,false,'');
	
	return res;
	
}

clipper_AJAX.getHttpReqText = function(url){
//make a sync http request and return the response text

	var res;
	var resText;
	
	res = clipper_AJAX.sendHttpReq(url,false,'');
	if( typeof(res.responseText) != "undefined" ) {
		resText = res.responseText;
	} else {
		resText = "";
	}

	return resText;
	
}

clipper_AJAX.getHttpReqXML = function(url){
//make a sync http request and return the response XML

	var res;
	var resXML;
	
	res = clipper_AJAX.sendHttpReq(url,false,'');
	if( typeof(res.responseXML) != "undefined" ) {
		resXML = res.responseXML;
	} else {
		resXML = "";
	}
	
	return resXML;
	
}

clipper_AJAX.callHttpReq = function(url,callBackFunction){
//make an async http request and call a return function with the response obj

	clipper_AJAX.sendHttpReq(url,true,callBackFunction);
	
}

/*###################################################
Advanced clipper.Ajax functions
- Advanced Ajax functions with automatic processing of the response object
###################################################*/

clipper_AJAX.callHttpReqAdv = function(sourceUrl,addRandom,asyncRequest,targetID,targetType) {
//###
//###Dec: 	Dynamic get and set a http req text to targetID.  
//###
//###Pre: 	All values must be defined! 
//###
//###		sourceUrl = 	Source url to the source url e.g. "../../GetHeader?OpenAgent"
//###		addRandom = 	If a random number to url should be added to avoid browser cashe e.g. true
//###		asyncRequest = 	If the request should be async or not (true/false) e.g. true			
//###		targetID = 	The name/ID of the target id/field/div etc. e.g. "Header"
//###		targetType = 	The target id type for setting the xml text (html/field/function/var/alert) e.g. html
//###				If function the function must be the format function(string)
//###
//###		e.g. clipper_AJAX.callHttpReqAdv("../../GetHeader?OpenAgent","Header", "html",true,true);
//###
//###Post: 	Set return http res text value to targetID
//###
	
	//set url
	var url = sourceUrl;
	
	//add random number to url to avoid browser cache problems, if set
	if (addRandom == true || addRandom == "true") {
		url = url + "&rdn=" + clipper_AJAX.getRandomNo().toString();
	}
	
	//send http request with call back function with text parameters
	clipper_AJAX.sendHttpReq(url,asyncRequest,'clipper_AJAX.setValueToTargetID(res,"' + targetID + '","' + targetType + '")');
	
}

/*###################################################
Notes @Formula clipper.Ajax functions
- Notes @Formula AJAX functions with the same syntax as you know from @Formula
###################################################*/

clipper_AJAX.dbColumn = function(server,dbPath,viewName,columnNumber,dontCache,callBackFunction) {
//###
//###Dec: 	Returns a column of values from a view or folder in a Domino database. 
//###
//###Pre: 	All values must be defined! 
//###
//###		server = 		the server url/dns name is current server leave empty e.g. "http://www.clipper-group.com"
//###		dbPath = 		the database filepath or replica ID e.g. "/quickplace/test/main.nsf"
//###		viewName = 		the view name e.g. "movies"
//###		ColNo = 		The view coloums numbers to return e.g. "2"	
//###		dontCache = 		If no cache a random number is added to the url to avoid browser cache (true/false) e.g. true
//###		callBackFunction = 	The call back function to call for returning data e.g. "processMovieList"
//###					The callback function must be the format function(value)
//###
//###		e.g. clipper_AJAX.dbColumn("","QuickPlace/test/main.nsf","movie","2",true,"processMovieList")
//###
//###Post: 	return view cols values in callBackFunction a one dimensional string array is returned (col values)
//###
	
	//init
	var url;
	
	//add server, dbPath & ViewName
	if(server != "") {
		url = server + "/" + dbPath + "/" + viewName;
	} else {
		url = dbPath + "/" + viewName;
	}
		
	//send http request by function clipper_AJAX.lookUpValuesInViewByColsNo
	clipper_AJAX.lookUpValuesInViewByColsNo(url,"","",columnNumber,"",dontCache,callBackFunction);
	
}

clipper_AJAX.dbLookup = function(server,dbPath,viewName,key,columnNumber,dontCache,callBackFunction) { 
//###
//###Dec: 	Given a key value, looks in the specified view (or folder) and finds all documents 
//###		containing the key value in the first sorted column within the view in a Domino database.
//###		Returns the text contents of the specified column in the view.
//###
//###Pre: 	All values must be defined! 
//###
//###		server = 		the server url/dns name is current server leave empty e.g. "http://www.clipper-group.com"
//###		dbPath = 		the database filepath or replica ID e.g. "/quickplace/test/main.nsf"
//###		viewName = 		the view name e.g. "movies"
//###		key = 			the key value to match the first sorted colunm within the view e.g. "Starwars 1"
//###		ColNo = 		The view columns numbers to return e.g. "2"	
//###		dontCache = 		If no cache a random number is added to the url to avoid browser cashe (true/false) e.g. true
//###		callBackFunction = 	The call back function to call for returning data e.g. "processMovieList"
//###					The callback function must be the format function(value)
//###
//###		e.g. clipper_AJAX.dbLookup("","QuickPlace/test/main.nsf","movie","Starwars 1","2",true,"processMovieList")
//###
//###Post: 	return view cols values in callBackFunction a one dimensional string array is return (col values)
//###
	
	//init
	var url;
	
	//add server, dbPath & ViewName
	if(server != "") {
		url = server + "/" + dbPath + "/" + viewName;
	} else {
		url = dbPath + "/" + viewName;
	}
	
	//send http request by function clipper_AJAX.lookUpValuesInViewByColsNo
	clipper_AJAX.lookUpValuesInViewByColsNo(url,key,"",columnNumber,"",dontCache,callBackFunction);
	
}

/*###################################################
Advance Domino/QuickPlace clipper.Ajax functions
- Domino/QuickPlace functions for retriving values for a notes view/folder
###################################################*/

clipper_AJAX.lookUpValuesInViewByColsNo = function(viewUrl,keyValue,keyColNo,returnColsNo,returnMaxEntries,addRandom,callBackFunction) {
//###
//###Dec: 	Dynamic get and return columns from a domino view by ReadViewEntries url xml call.  
//###
//###Pre: 	All values must be defined! 
//###
//###		viewUrl = 		view url to the source view DONT add ?OpenView/?ReadViewEntries e.g. "../../Movies"
//###		keyValue = 		The value to match in the view leave empty if no key e.g. "Starwars 1"	
//###		keyColNo = 		The view col number for the key to match if not the default view sort e.g. "2" 
//###					Specify a KeyColNo can give lower performance, caused by the domino server resorting the view before returning it.   
//###					The specified column must have enabled "Click on column header to sort".
//###		returnColsNo = 		The view columns numbers to return e.g. "3,4"	
//###		returnMaxEntries = 	Max entries to return, specify "" or 0 for no limit e.g. "10"	
//###		addRandom = 		If a random number to url should be added to avoid browser cache (true/false) e.g. true
//###		callBackFunction = 	The call back function to call for returning data e.g. "processMovieList"
//###					The callback function must be the format function(value)
//###
//###		e.g. clipper_AJAX.lookUpValuesInViewByColsNo("../../Movies","Starwars 1","","2,3","",true,true,"processMovieList")
//###
//###Post: 	return view cols values in callBackFunction
//### 		sourceMaxEntries = 1 and sourceColsNo is on col number, a string is return (value)
//###		sourceMaxEntries = 1 and sourceColsNo is multi col numbers, a on dimensional string array is return (row values)
//###		sourceMaxEntries > 1 and sourceColsNo is on col number, a on dimensional string array is return (col values)
//###		else a multi dimensional string array is return (row & cols values)
//###

	//set url
	var url = viewUrl;
	
	//add ReadViewEntries and PreFormat to view url
	url = url + "?ReadViewEntries&PreFormat";

	//add sort col 
	if (keyColNo != "") {
		url = url + "&ResortAscending=" + keyColNo.toString(); 
	}

	//add start and end key 
	if (keyValue != "") {
		url = url + "&StartKey=" + keyValue; 
		url = url + "&UntilKey=" + keyValue + "!"; 
	}

	//add count key
	if (returnMaxEntries != "" && returnMaxEntries.toString() != "0") {
		url = url + "&count=" + returnMaxEntries.toString();
	} else {
		url = url + "&count=9999";
	}

	//add random number to url to avoid browser cashe problems, if set
	if (addRandom == true || addRandom == "true") {
		url = url + "&rdn=" + clipper_AJAX.getRandomNo().toString();
	}

	//send http request with call back function with text parmeters
	clipper_AJAX.sendHttpReq(url,true,'clipper_AJAX.returnValuesInViewByColsNo(res,"' + keyValue + '","' + keyColNo + '","' + returnColsNo + '","' + returnMaxEntries + '","' + callBackFunction + '")' );


}

clipper_AJAX.lookUpValueInViewByColNo = function(viewUrl,keyValue,keyColNo,returnColNo,addRandom,targetID,targetType) {
//###
//###Dec: 	Dynamic get and return columns from a domino view by ReadViewEntries url xml call.  
//###
//###Pre: 	All values must be defined! 
//###
//###		viewUrl = 	view url to the source view DONT add ?OpenView/?ReadViewEntries e.g. "../../Movies"
//###		keyValue = 	The value to match in the view, leave empty to get first entry in view e.g. "Starwars 1"	
//###		keyColNo = 	The view col number for the key to match if not the default view sort  e.g. "2" 
//###				Specify a KeyColNo can give lower performance caused by the domino server resorting the view before returning it.   
//###		returnColsNo = 	The view columns numbers to return e.g. "3,4"	
//###		addRandom = 	If a random number to url should be added to avoid browser cache (true/false) e.g. true
//###		targetID = 	The name/ID of the target id/field/div etv. e.g. "Header"
//###		targetType = 	The target id type for setting the xml text (html/field/function/var/alert) e.g. html
//###				If function the function must be the format function(string)
//###
//###		e.g. clipper_AJAX.lookUpValueInViewByColNo("../../Movies","Starwars 1","","2,3","",true,true,"movieList","html")
//###
//###Post: 	Set return http res text value to targetID
//###

	//send http request by function clipper_AJAX.lookUpValuesInViewByColsNo
	clipper_AJAX.lookUpValuesInViewByColsNo(viewUrl,keyValue,keyColNo,returnColNo,"1",addRandom,"clipper_AJAX.setValueToTargetID(res,'" + targetID + "','" + targetType + "')" );

}

clipper_AJAX.addOptionsToSelectByViewColNo = function(viewUrl,keyValue,keyColNo,colTitleNo,colValueNo,sortValuesByTitle,addRandom,targetID,addMethod,defaultValues) {
//###
//###Dec: 	Dynamic get and return columns from a domino view by ReadViewEntries url xml call.  
//###
//###Pre: 	All values must be defined! 
//###
//###		viewUrl = 		View url to the source view DONT add ?OpenView/?ReadViewEntries e.g. "../../Movies"
//###		keyValue = 		The value to match in the view, leave empty if no key e.g. "Starwars 1"	
//###		keyColNo = 		The view col number for the key to match if not the default view sort  e.g. "2" 
//###					Specify a KeyColNo can give lower performance caused by the domino server have to resort the view before returning it.   
//###		colTitleNo = 		The view col no containing option title e.g. "2"
//###		colValueNo = 		The view col no containing option value, set to same as colTitleNo if same e.g. "3"
//###		sortValuesByTitle = 	Should the options title be sorted e.g. true 
//###		addRandom = 		If a random number to url should be added to avoid browser cache (true/false) e.g. true
//###		targetID = 		the ID of the target select field  e.g. "Movie"
//###		addMethod = 		the method the options should be added (append,replace,keepfirst,No) e.g. "append"
//###		defaultValues = 	the defaultvalues to be default selected multi values separated by comma e.g. "Starwars 1,Starwars 2"
//###
//###		e.g. clipper_AJAX.addOptionsToSelectByViewColNo("../../Movies","","","2","3",true,true,"SelectMovie","append")
//###
//###Post: 	Append found colTitleNo/colValueNo options to targetID select
//###

	//init
	var returnColNo;
	
	//set returnColNo by colTitleNo & colValueNo
	if (colValueNo != "") {
		returnColNo = colTitleNo.toString() + "," + colValueNo.toString();
	} else {
		returnColNo = colTitleNo.toString();
	}
	
	//send http request by function clipper_AJAX.lookUpValuesInViewByColsNo
	clipper_AJAX.lookUpValuesInViewByColsNo(viewUrl,keyValue,keyColNo,returnColNo,"",addRandom,"clipper_AJAX.addOptionsToSelectByArray(res,'" + sortValuesByTitle + "','" + targetID + "','" + addMethod + "','" + defaultValues + "')" );
	
}