	function isInteger(s)
	{   var i;
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		if (s=="0")
		{
			return false;
		}
		// All characters are numbers.
		return true;
	}

	//############  update triple ref Sellect box ###############

function inpSelect(vField,vVal){
	for (var i = 0; i < vField.options.length; i++){
		if (vField.options[i].value==vVal)
		{
			vField.options[i].selected = true;
		}
	}
}

function updateTripleRef(vRef1,vRef2,vRef3,vField,vVal,vList){
	for (var i=0; i<vList.length; i++){
		if (vList[i].id==vVal)
		{
			vRef1.value = vList[i].ref;
			vRef1.onchange();
			if (vRef2!=0){
				vRef2.value = vList[i].ref2;
				vRef2.onchange();
			}
			if (vRef3!=0){
				vRef3.value = vList[i].ref3;
				vRef3.onchange();
			}
			vField.value = vVal;
		}
	}
	this.value = vVal;
}

//############  update triple ref Sellect box ###############

function updateDubbleRef(vRef1,vRef2,vField,vVal,vList){
	updateTripleRef(vRef1,vRef2,0,vField,vVal,vList);
}

//############  Fill Sellect box ###############
// vInp = input field id of selectbox
// vRef = reference id
// vList = array of all elements to add
// vEmpty = add empty field as first item

function fillSelect(vInp,vRef,vList,vEmpty){
	fillSelectDubbleRef(vInp,vRef,0,vList,vEmpty);
}

function fillSelectDubbleRef(vInp,vRef1,vRef2,vList,vEmpty){
	fillSelectTripleRef(vInp,vRef1,vRef2,0,vList,vEmpty);
}

//############  Fill Sellect box Dubble Ref###############
// vInp = input field id of selectbox
// vRef1 = reference id 1
// vRef2 = reference id 2
// vList = array of all elements to add
// vEmpty = add empty field as first item

function fillSelectTripleRef(vInp,vRef1,vRef2,vRef3,vList,vEmpty){
	vInp.length = 0;
	if (vEmpty){
		vInp.length = 1;
		vInp.options[0].value= -1;
		vInp.options[0].text = '';
	}
	for (var i=0; i<vList.length; i++){
		var addField = false;
		if (vRef1==0){
			addField = true;		
		} else {
			if (vRef1==vList[i].ref){
				if (vRef2!='' && vRef2!=0){
					if (vRef2==vList[i].ref2){
						if (vRef3!='' && vRef3!=0){
							if (vRef3==vList[i].ref3){
								addField = true;
							}
						} else {
							addField = true;
						}
					}
				} else {
					if (vRef3!='' && vRef3!=0){
						if (vRef3==vList[i].ref3){
							addField = true;	
						}
					} else {
						addField = true;
					}
				}
			}
		}

		if (addField){
			var len = vInp.length;
			vInp.length = (len+1);
			vInp.options[len].value = vList[i].id;
			vInp.options[len].text = vList[i].text;
		}

	}
}