function enableButton() {	return true  }function isFileTypeExist(f){	for (var i=0; i<f.length; i++) {		thisEl=f.elements[i];		thisElType=thisEl.type.toLowerCase();		if (thisElType== "file")			return true;		}	return false;	}function insertSubmitedValues(subNames,subValues,f) {	notTypes=[ "submit","reset","button","file","application/x-shockwave-flash"];		for (var i=0; i<f.length; i++) {		thisEl=f.elements[i];		thisElType=thisEl.type.toLowerCase();		foundElName=subNames.indexOf(thisEl.name);		if (!notTypes.isMember(thisElType))			if (foundElName>-1) {				setValue(thisEl,unescape(subValues[foundElName]));				if (thisElType=="textarea") {					thisEl.style.overflow = 'visible' // ie bug					while (thisEl.scrollHeight > thisEl.offsetHeight)						thisEl.rows++;					}				 }		}	}function setValue(thisEl,thisValue){	switch(thisEl.type.toLowerCase()) {		case "select-one":			for (var j=0;j<thisEl.length;j++)				 thisEl.options[j].selected= (thisValue.indexOf(thisEl.options[j].value)>-1) ? true : false;			break;		case "select-multiple":			thisValueArray=thisValue.split(";")			for (var j=0;j<thisEl.length;j++)				thisEl.options[j].selected= (thisValueArray.indexOf(thisEl.options[j].value)>-1) ? true : false;			break;		case "checkbox": 			thisValueArray=thisValue.split(";")			thisEl.checked=false;			if (thisValueArray.indexOf(thisEl.value)>-1)				thisEl.click();			break;		case "radio": 			thisEl.checked=false;			if (thisValue.indexOf(thisEl.value)>-1)				thisEl.click();			break;		default :			thisEl.value=thisValue;			break;				}	}function checkvalues(fieldnames, eFormOption, f) {	fnVector=(fieldnames)? fieldnames.toLowerCase().split(","):"";		lgsByScript=(navigator.userLanguage)?  navigator.userLanguage : navigator.language;	lg=(f.language) ? f.language.value : lgsByScript;	if (lg=="no"){		errorMsg="M\u00E5 fylles ut!";		errorMail="Epost adresse mangler eller er feil skrevet!";		}	else if (lg=="sv"){		errorMsg=	"M\u00E5ste fyllas i!";		errorMail="E-post adress saknas eller \u00E4r felskrivet!";		}	else if (lg=="da"){		errorMsg=	"Skal udfyldes!";		errorMail="E-mail adresse mangler eller er skrevet forkert!";		}	else if (lg=="fi"){		errorMsg=	"Ole hyv\u00E4 ja t\u00E4yt\u00E4!";		errorMail="S\u00E4hk\u00F6postiosoite puuttuu tai on virheellinen!";		}	else if (lg=="lt"){		errorMsg=	"Pra\u0161ome u\u017Epildyti!";		errorMail="Nenurodytas el. pa\u0161to adresas arba jis neteisingas!";		}	else if (lg=="lv"){		errorMsg=	"L\u016Bdzu, aizpildiet!";		errorMail="Nav nor\u0101d\u012Bta vai ir nepareiza e-pasta adrese!";		}	else if (lg=="et"){		errorMsg=	"Palun t\u00E4ida \u00E4ra!";		errorMail="Meiliaadress puudub v\u00F5i on vigane!";		}	else if (lg=="ru"){		errorMsg=	"\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435!";		errorMail="\u0410\u0434\u0440\u0435\u0441 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u044B \u043D\u0435 \u0432\u0432\u0435\u0434\u0435\u043D \u0438\u043B\u0438 \u0432\u0432\u0435\u0434\u0435\u043D \u043D\u0435\u0432\u0435\u0440\u043D\u043E!";		}	else {		errorMsg=	"Please fill out!";		errorMail="Email adress is missing or invalid!";		}	for (var i=0; i<f.length; i++) {			j=0;			while(j<fnVector.length) {				if (f.elements[i].name.toLowerCase()=="principal") {					pos=f.principal.value.indexOf('@',0);					if (	(f.elements[i].name.toLowerCase()==fnVector[j] & f.elements[i].value=="") | 						(f.principal.value!="" & (pos==(-1) | f.principal.value.indexOf('.',pos)==(-1))) ) {						alert(errorMail);						if (f.principal.type.toLowerCase()!="hidden")							f.principal.focus();						return false						}					}				else if (f.elements[i].name.toLowerCase()==fnVector[j]) {					if (f.elements[i].value==""){						alert(f.elements[i].name+":\n"+errorMsg);						f.elements[i].focus();						return false						}					}				j++;				}		}			if (eFormOption=="StoreInDatabase")		fillvaluesDatabase(f)		else		fillvaluesEmail(f)			return true;	}function fillvaluesDatabase(f) {	nl=escape("\u00A1");	notTypes=[ "submit","reset","button","file","application/x-shockwave-flash"];	notNames=["body","subject","return_url","mayread_respons","language" ];	// file name hentes fra fileupload designelemnet i domino	dominoFileUploadName="";	if (isFileTypeExist(document.eform)) {		dominoFileUploadName=document.getElementById("FileUpLoadDomino").name		document.getElementById("divid").innerHTML=""; 		}//	dominoFileUploadName="%%File.c12572280004b38b.e08e482cd99b9218c12572280003fdf9.$Body.0.D8C";	f.body.value=getStrBody(nl,notTypes,notNames,f,dominoFileUploadName);	f.action="/ifcmtool/eform.nsf/database?CreateDocument";	f.method="post";	f.encoding="multipart/form-data"	return true			}function fillvaluesEmail(f) {	nl="\n\n";	notTypes=[ "submit","reset","button","file","application/x-shockwave-flash"];	notNames=["body","subject","return_url","mayread_respons","language","sendto","copyto","blindcopyto" ];	// file name hentes fra fileupload designelemnet i domino	dominoFileUploadName="";	if (isFileTypeExist(document.eform)) {		dominoFileUploadName=document.getElementById("FileUpLoadDomino").name		document.getElementById("divid").innerHTML=""; 		}	//dominoFileUploadName="%%File.c12572280004b38b.3fdc390d6a697dbfc1257228000019b1.$Body.0.108E";	f.body.value=getStrBody(nl,notTypes,notNames,f,dominoFileUploadName);	f.action="/ifcmtool/eform.nsf/email?CreateDocument";	f.method="post";	f.encoding="multipart/form-data"	return true	}function getStrBody(nl,notTypes,notNames,f,dominoFileUploadName){	strBody="fromurl="+document.location.href;	getAllNames=[];	getAllValues=[];	for (var i=0; i<f.length; i++) {		thisEl=f.elements[i];		thisElType=thisEl.type.toLowerCase();				if (thisElType== "file") 			thisEl.name=dominoFileUploadName;					if (!notTypes.isMember(thisElType))			if (!notNames.isMember(thisEl.name.toLowerCase())){				getAllNames[getAllNames.length]=thisEl.name;				getAllValues[getAllValues.length]=getValue(thisEl);				}		}	uniqueNames=getAllNames.unique();	for (var j=0; j<uniqueNames.length; j++) {		thisValue=[];		for (var k=0; k<getAllNames.length; k++) {			if (uniqueNames[j]==getAllNames[k])				thisValue[thisValue.length]=getAllValues[k];			}		strBody+=nl+uniqueNames[j]+"="+trim(thisValue).join(";");		}	return strBody;	}function getValue(thisEl){	switch(thisEl.type.toLowerCase()) {		case "select-one":			return thisEl.options[thisEl.selectedIndex].value;			break;		case "select-multiple":			getChecked=[];			for(var j=0;j<thisEl.length;j++)				if(thisEl.options[j].selected)					getChecked[getChecked.length]=thisEl.options[j].value;				return getChecked.join(";");			break;		case "checkbox": 			if (thisEl.checked) 				return thisEl.value;			else				return "";			break;		case "radio": 			if (thisEl.checked) 				return thisEl.value;			else				return "";			break;		default :			return thisEl.value;			break;				}	}function trim(a){	var tmp=new Array();	for(j=0;j<a.length;j++)		if(a[j]!='')			tmp[tmp.length]=a[j];	a.length=tmp.length;	for(j=0;j<tmp.length;j++)		a[j]=tmp[j];	return a;}Array.prototype.indexOf = function(str,ignoreCase) {	// return the index of the first instance of str in the array	// else -1 if not a member	// if a string array can take a flag to request case match	// if (ignoreCase) then 'StringA' is considered the same as 'sTrinGa'	var tmp ;	if (typeof(str)=="string" && ignoreCase) {		str = str.toLowerCase() ;		}	for (var i=0; i<this.length; i++) {		if (typeof(str)=="string" && ignoreCase) {			tmp=this[i].toLowerCase() ;			} 		else {			tmp=this[i] ;			}		if (tmp==str) 			return i ;		}		return -1 ;	}Array.prototype.isMember = function(str,ignoreCase) {		return this.indexOf(str,ignoreCase) > -1 ;		}Array.prototype.unique = function(ignoreCase) {	// creates a unique array	// empty arrays are always unique !	if (this.length==0) 		return this ;		// default to respect case	// if (ignoreCase) then 'StringA' is considered the same as 'sTrinGa'		if (arguments.length==0) 		ignoreCase = false ;		var newList = new Array(this[0]) ;	var found,tmp1,tmp2 ;	for (var i=0; i<this.length; i++) {		if (!newList.isMember(this[i],ignoreCase)) 			newList.push(this[i]) ;		}	return newList ;}
