/////////////// OriA "Transformer" javascript library
/// 2005-12-11

// make sure we dont include this js twice:
if ((typeof(document.oriaRegisteredScripts)=='undefined') || (document.oriaRegisteredScripts.indexOf(v) != -1)){

	// create css style tag in header
//	var sty=document.createElement('style');
//	sty.type='text/css';
//	sty.innerHTML='starclass {cursor:hand;width:17px;height:19px;color:#7484A4;}';
//	var head=document.getElementsByTagName('head');
//	if (head.length){
//		head=head[0];
//		head.appendChild(sty);
//	}

    // return an getElementById or Name.
    // for those who are used to explorer, use all(v) instead of document.all
    function all(v){
        if (''+document.getElementById(v)=='null'||''+document.getElementById(v)=='undefined'){
            if (''+document.getElementsByName(v)[0]=='null'||''+document.getElementsByName(v)[0]=='undefined'){
                alert('all: '+v+' is not defined!');
                return null;
            }else{
                return document.getElementsByName(v)[0];
            }
        }else{
            return document.getElementById(v);
        }
    }

    // return true if property exists in an object
    function object_has(obj,prop){
		var i;
        for (i in obj) {
            if (i==prop) return 1;
        }
        return 0;
    }

	// limit an image widht/height without distorting it
	// use: <img src=bla.gif onLoad='limitImageWH(this,150,50);'> if you want to limit the image to max of 150x50
	function limitImageWH(img1,maxw,maxh){
		var rw,rh,w,h,hw,i,dd,img;

		// get out in case of no limitations
		if (maxw=='' && maxh=='') return;

		// two bugs in explorer 6.0:
		// 1. this script executes before the image is fully loaded.
		// 2. the img.complete flag is not set on IMG tags image objects.

		img=new Image;
		img.src=img1.src;

		// make sure img is fully loaded first:
		for (i=0;i<8888 && img.complete==0;i+=0.1);


		// try to fix the explorer bug - it sometimes executes this script before the image is fully loaded and before h/w are set
		for (i=0;i<36;i++){
			rw=img.width;
			rh=img.height;
			if (rw && rh){ // image is loaded and a size is received
				i=200; // exit loop
			} else {
				// image is not loaded - image has h,w of 0,0
				dd=img.src;
				for (dd=0;dd<226;dd+=0.01); // delay
			}
		}

		if (rh==0 || rw==0){ // image is still not loaded
			// alert(img.src+' rw='+rw+' rh='+rh); // for debug
			if (maxh!='' && maxh<999) img.height=maxh;
			if (maxw!='' && maxw<999) img.width=maxw;

		}else{ // all ok - start the normal method

			if (maxw=='') maxw=9999; // no limit
			if (maxh=='') maxh=9999; // no limit
			hw = rh/rw;   // height/width
			h=rh;          // height
			w=rw;          // width
			if (h>maxh){ // limit height?
				h=maxh;
				w=h/hw;
			}
			if (w>maxw){ // limit width?
				w=maxw;
				h=w*hw;
			}
			img.width=w;
			img.height=h;
			img1.width=w;
			img1.height=h;
		}
	}

    // trim the string from specified characters
    function strTrim(str,trimchars){
        while ((str.length>0) && (trimchars.indexOf(str.charAt(0))>=0)) str=str.substr(1);
        while ((str.length>0) && (trimchars.indexOf(str.charAt(str.length-1))>=0)) str=str.substr(0,str.length-1);
        return str;
    }

    // trim string
    function trim(str){
        return strTrim(str," \t\n\r\0");
    }

    // opens a new window with the html content of [content]
    function previewHtml(content,title){
	var w;
        w=window.open('','preview_window','width=400,height=400,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0');
        w.title=title;
        w.document.open();
        w.document.write(content);
        w.document.close();
        w.focus();
    }

    // opens a new window of advanced html editing -- using cuneAform
    function editHtml(fname,frmname) {
	if (frmname=='' || fname==''){
		alert('editHtml Error: no frm/fname ('+frmname+'.'+fname+')');
		return ; // exit on error
	}
	frm = document.forms[frmname];
	if (!frm) {
		alert('editHtml Error: frm not exists ('+frmname+'.'+fname+')');
		return ; // exit on error
	}
	field = frm.elements[fname];
	if (!field) {
		alert('editHtml Error: field not exists ('+frmname+'.'+fname+')');
		return ; // exit on error
	}
	var win;
	var w = screen.width-100;
	var h = screen.height-100;
	win = window.open("cuneaform/tfcuneaform.htm", "_blank", 'width=' + w + ',height=' + h + ',location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,left=5,top=5');
        win.tfhtml = field.value;
        // this would eval when clicking save. newhtml is the new html value to be saved.
        win.tfSave = "opener.document." + frmname + ".elements['" + fname + "'].value = newhtml; opener.curfrmSubmit('" + frmname + "','update');";
    }
    
    // show/hide an iframe
    // frame = iframe name. href = the location (src) of the iframe, when opened.
    // height = the height when opened. h = the height when closed.
    function subShowHide(frame,href,height,h){
       if (all(frame).src=='') {
            all(frame).src=href;
            all(frame).height=height;
            all(frame).focus();
         } else {
            all(frame).src='';
            all(frame).height=h;
         }
         //all(frame).height=height - all(frame).height;
    }

    // enlarge an iframe
    function subPlus(frame,howmuch){
       if (all(frame).src!=''){
          all(frame).height=howmuch + Math.round(all(frame).height);
          all(frame).focus();
       }
    }

    // return the index for an option in <select>, where its text == val. if not found returns -1.
    function selectText(select,val){
		var i,z;
        z=val.length;
        if (z==0) return -1;
        for (i=0;i<select.options.length;i++) {
            if (select.options[i].text.substr(0,z).toLowerCase()==val.toLowerCase()){
                select.selectedIndex=i;
                return i;
            }
        }
        return -1;
    }

    // return the index for an option in <select>, where its value == val
    function selectValue(select,value){
		var z,i;
        z=select.options.length;
        for (i=0;i<z;i++){
            if (select.options[i].value==value){
                select.selectedIndex=i;
                return i;
            }
        }
        select.value=value;
        return -1;
    }



    // return all the selected options in list as string of comma seperated values
    function listToString(list) {
		var s,u;
        s='';
        for (i=0;i<list.options.length;i++) {
            if (list.options.sw=='on') s=s+list.options[i].value+',';
        }
        return s;
    }

    // remove a char at location
    function removeCharAt(s,i){
        return s.substring(0,i)+s.substring(i+1,s.length);
    }

    // replace a char at location
    function replaceCharAt(s,i,c){
        return s.substring(0,i)+c+s.substring(i+1,s.length);
    }

    // check single character for is it a 0-9 digit
    function isNum(c){
        return (c<='9')&&(c>='0');
    }

    // set the flag field images by val
    function setflagfield(frm,fname,val){
		var i;
        document.forms[frm].elements[fname].value=val;
        for (i=0;i<document.images.length;i++){
            if (document.images[i].id.substr(0,fname.length+4)==fname+'_img'){
                if (document.images[i].v==val){  // this is the one set on
                    document.images[i].style.background='#F06060';
                }else{
                    document.images[i].style.background='';
                }
            }
        }
    }

    // fix a number - remove all none-number digits
    function fixnumber(v){
		var i;
        // remove non-legal chars
        for (i=0;i<v.length;){
            if( (v.charAt(i)>'9' || v.charAt(i)<'0')
             && (v.charAt(i)!='.')
             && (v.charAt(i)!='-' ||  i>0)
             && (v.charAt(i)!='+' ||  i>0)
             ){
                v=removeCharAt(v,i);
            }else{
                i++;
            }
        }
        // put 0 before . at pos 1  (.32 -> 0.32)
        if (v.charAt(0)=='.' ){
            v='0'+v;
        }
        // remove last .
        if (v.charAt(v.length)=='.'){
            v=v.substr(0,v.length-1);
        }
        // put 0 before . at pos 1 after -/+ (-.32 -> -0.32)
        if( (v.charAt(0)=='-' || v.charAt(0)=='+') && v.charAt(1)=='.'){
            v=v.charAt(0)+'0'+v.substr(1,v.length);
        }
        // delete -+ not at pos 1, and spare dots
        founddot=0;
        for (i=1;i<v.length;){
            if ((v.charAt(i)>'9' || v.charAt(i)<'0')){
                if (v.charAt(i)=='.') founddot++;
                if (v.charAt(i)!='.' || founddot>1){
                    v=removeCharAt(v,i);
                }else{
                    i++
                }
            }else{
                i++;
            }
        }
        // fix 0 after a lonely . - +
        if (v.charAt(v.length-1)=='.' || v.charAt(v.length-1)=='-' || v.charAt(v.length-1)=='+') v=v+'0';
        return v;
    }


    // fix year - also fix for 4 digit.
    function fixyear(v){
		var i;
        // remove non-numeric chars
        for (i=0;i<v.length;){
            if (v.charAt(i)>'9' || v.charAt(i)<'0'){
                v=removeCharAt(v,i);
            }else{
                i++;
            }
        }
        // truncate too big numbers
        if (v.length>4){
            v.length=4;
        }
        // fix 1 digit year:
        if (v.length==1){
            v='200'+v;
        }
        // fix 2 digit year:
        if (v.length==2){
            if (v.charAt(0)>'2'){
                v='19'+v;
            }else{
                v='20'+v;
            }
        }
        // fix 3 digit year:
        if (v.length==3){
            v='0'+v;
        }
        return v;
    }


    // fix a date - make month/day 2 chars, and year 4 chars
    function fixdate(v){
        // fix 1 digit year:
        if ((v.charAt(1)>'9' || v.charAt(1)<'0')
          && v.charAt(0)<='9' && v.charAt(0)>='0'){
                v='200'+v;
        }
        // fix 2 digit year:
        if ((v.charAt(2)>'9' || v.charAt(2)<'0')
          && v.charAt(0)<='9' && v.charAt(0)>='0'
          && v.charAt(1)<='9' && v.charAt(1)>='0'){
            if (v.charAt(0)>'2'){
                v='19'+v;
            }else{
                v='20'+v;
            }
        }
        // fix for year-only dates:
        if (v.length==4) v=v+'/00/00';

        // fix 1 digit month:
        if ((v.charAt(6)>'9' || v.charAt(6)<'0')
          && v.charAt(5)<='9' && v.charAt(5)>='0'){
                v=v.substr(0,4)+'/0'+v.substr(5,5);
        }
        // fix 1 digit day:
        if ((v.charAt(9)>'9' || v.charAt(9)<'0')
          && v.charAt(8)<='9' && v.charAt(8)>='0'){
                v=v.substr(0,7)+'/0'+v.substr(8,2);
        }

        // the date is not a fixes 10 digit date of YYYY/MM/DD :-D

        // fix / and numbers:
        if (v.charAt(0)>'3' || v.charAt(0)<'0') v=              'Y'+v.substr(1,9);
        if (v.charAt(1)>'9' || v.charAt(1)<'0') v=v.substr(0,1)+'Y'+v.substr(2,8);
        if (v.charAt(2)>'9' || v.charAt(2)<'0') v=v.substr(0,2)+'Y'+v.substr(3,7);
        if (v.charAt(3)>'9' || v.charAt(3)<'0') v=v.substr(0,3)+'Y'+v.substr(4,6);
        v=v.substr(0,4)+'/'+v.substr(5,7);
        if (v.charAt(5)>'1' || v.charAt(5)<'0') v=v.substr(0,5)+'M'+v.substr(6,4);
        if (v.charAt(6)>'9' || v.charAt(6)<'0') v=v.substr(0,6)+'M'+v.substr(7,3);
        v=v.substr(0,7)+'/'+v.substr(8,2);
        if (v.charAt(8)>'3' || v.charAt(8)<'0') v=v.substr(0,8)+'D'+v.substr(9,1);
        if (v.charAt(9)>'9' || v.charAt(9)<'0') v=v.substr(0,9)+'D';
        v.length=10;
        return v;
    }


    // fix a time string to hh:mm:ss
    function fixtime(v){ //@@ this function is not yet checked/debuged
        // fix 1 digit hour:
        if ((v.length<2 || v.charAt(1)>'9' || v.charAt(1)<'0')
          && v.charAt(0)<='9' && v.charAt(0)>='0'){
                v='0'+v;
        }
        if (v.length==2) return v+':00:00';
        // fix 1 digit minute:
        if ((v.length<5 || v.charAt(4)>'9' || v.charAt(4)<'0' )
          && v.charAt(3)<='9' && v.charAt(3)>='0'){
                v=v.substr(0,2)+':0'+v.substr(3);
        }

        // fix for no-seconds time:
        if (v.length==5) return v+':00';

        // fix 1 digit second:
        if ((v.length<8 || v.charAt(7)>'9' || v.charAt(7)<'0' )
          && v.charAt(6)<='9' && v.charAt(6)>='0'){
                v=v.substr(0,6)+':0'+v.substr(6);
        }

        // the time is now a fixes 8 digit (atleast) time of HH:MM:SS :-D

        // fix : and numbers:
        if (v.charAt(0)>'2' || v.charAt(0)<'0') v=replaceCharAt(v,0,'H');
        if (v.charAt(1)>'9' || v.charAt(1)<'0') v=replaceCharAt(v,1,'H');
                                                v=replaceCharAt(v,2,':');
        if (v.charAt(3)>'5' || v.charAt(5)<'0') v=replaceCharAt(v,3,'M');
        if (v.charAt(4)>'9' || v.charAt(6)<'0') v=replaceCharAt(v,4,'M');
                                                v=replaceCharAt(v,5,':');
        if (v.charAt(6)>'5' || v.charAt(8)<'0') v=replaceCharAt(v,6,'S');
        if (v.charAt(7)>'9' || v.charAt(9)<'0') v=replaceCharAt(v,7,'S');
        v.length=8;
        return v;
    }

    // fix a long date-time string
    function fixdatetime(v){ //@@ this function is not yet checked/debuged
		var cnt,i,valids,p,v1,v2;
        // find the third seperator position:
        valids='0123456789YyMmDdHhMmSs';  // valid chars - not seperators
        cnt=0;
        for(i=0;i<v.length;i++){
            if (valids.indexOf(v.charAt(i))<0){ // char not in valids
                cnt++; // count seperators
                if (cnt==3) p=i;
            }
        }
        if (p>=0){
            v1=fixdate(v.substr(0,p));
            v2=fixtime(v.substr(p+1));
            return ''+v1+' '+v2;
        }else{
            return fixdate(v)+' '+fixtime(' ');
        }
    }

    // fix phone. also updates 9 to 10 digit numbers.
    function fixphone(v){
    	return fixPhone(v);
    }
    function fixPhone(v){
	var k,i;
        // remove non-digit chars
	v=v.replace(/([^0-9])/g,'');
        if (v=='') return '';
        
	k=v.substr(0,2);
	if (k!='05' && k!='06' && k!='07'){
		if (k=='02' || k=='03' || k=='04' || k=='08' || k=='09'){
			v=v.substr(0,2)+'-'+v.substr(2);
		}
	}else{
		if (v.length==9){  // fix 9 to 10 digit phone number
		    k=v.substr(0,3);
			 if (k=='050') v='0505'+v.substr(3);
		    else if (k=='051') v='0507'+v.substr(3);
		    else if (k=='052') v='0522'+v.substr(3);
		    else if (k=='053') v='0523'+v.substr(3);
		    else if (k=='054') v='0544'+v.substr(3);
		    else if (k=='055') v='0545'+v.substr(3);
		    else if (k=='056') v='0506'+v.substr(3);
		    else if (k=='057') v='0577'+v.substr(3);
		    else if (k=='058') v='0528'+v.substr(3);
		    else if (k=='064') v='0524'+v.substr(3);
		    else if (k=='065') v='0525'+v.substr(3);
		    else if (k=='066') v='0546'+v.substr(3);
		    else if (k=='067') v='0547'+v.substr(3);
		    else if (k=='068') v='0508'+v.substr(3);
		}
		v=v.substr(0,3)+'-'+v.substr(3);
	}
        return v;
    }
    
    // validate phone. phone must include area code
    function validatePhone(v){
        // remove non-digit chars
	v=v.replace(/([^0-9])/g,'');
        if (v=='') return '';
	var k=v.substr(0,2);
	if (k=='02' || k=='03' || k=='04' || k=='08' || k=='09') return v.length==9;
	if (k=='05' || k=='07') return v.length==10;
	return false;
    }
    

    // set a new value to star fields
    function starset(frm,fname,val){
		if (frm=='' || fname=='' || val==''){
			alert('starset Error: no frm/fname/val ('+frm+'.'+fname+'='+val+')');
			return ; // exit on error
		}
        val=1*val;
        if (''+val=='NaN') val=0;
        if (val>10) val=10;
        if (val<0 ) val=0;
        document.forms[frm].elements[fname].value=val;
        starsel(frm,fname);
    }

    // put the star images accoarding to the value in fname
    function starsel(frm,fname){
		if (frm=='' || fname==''){
			alert('starsel Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var tmp,val;
        val=document.forms[frm].elements[fname].value;
        for (i=1;i<=10;i++){
            if (i<=val){
                tmp='icon/star.gif';
            }else{
                tmp='';
            }
            all(frm+'_'+fname+'_img'+i).background=tmp;
        }
    }

    // show file reupload input
    function fileUpOn(frm,fname,more){
		if (fname==''){
			alert('fileUpOn Error: no fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
        all(frm+'_'+fname+'_upoption').innerHTML='<input type=file name=\''+fname+'\'  '+more+'>';
    }
    // hide file reupload box
    function fileUpOff(frm,fname){
		if (fname==''){
			alert('fileUpOff Error: no fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
        all(frm+'_'+fname+'_upoption').innerHTML='';
    }

    // update xkeys input from the select.
    function updKeysFromSelect(frm,fname){
		if (frm=='' || fname==''){
			alert('updKeysFromSelect Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var f,s,value,i;
        f=document.forms[frm].elements[fname];
        s=document.forms[frm].elements[fname+'_select'];
        f.value='';
        for (i=0;i<s.options.length;i++){
            if (s.options[i].selected){
                f.value+=','+s.options[i].value;
            }
        }
    }

    // update xkeys input and its select
    function updKeysAndSelect(frm,fname,value){
		if (frm=='' || fname==''){
			alert('updKeysAndSelect Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var f,s,i;
        f=document.forms[frm].elements[fname];
        s=document.forms[frm].elements[fname+'_select'];
        f.value=value;
        value=','+value+',';
        for (i=0;i<s.options.length;i++){
            s.options[i].selected=value.indexOf(','+s.options[i].value+',')>=0;
        }
    }

    // update xkeys input from the checkboxes.
    function updKeysFromBoxes(frm,fname){
		if (frm=='' || fname==''){
			alert('updKeysFromBoxes Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var f,nam,val,elem,i;
        f=document.forms[frm].elements[fname];
        f.value='';
        elem=document.forms[frm].elements;
        for (i=0;i<elem.length;i++){
			nam=elem[i].name;
            if (nam.substr(0,fname.length+5)==fname+'_box_') { // this is one of our checkboxes
                if (elem[i].checked){
					val=nam.substr(fname.length+5,99);
					if (val=='') alert('updKeysFromBoxes Error: empty value in '+nam);
					f.value+=','+val;
				}
			}
		}
    }

    // updates xkeys and the boxes from value.
    function updKeysAndBoxes(frm,fname,value){
		if (frm=='' || fname==''){
			alert('updKeysAndBoxes Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var f,o,nam,val,elem,i;
        f=document.forms[frm].elements[fname];
        f.value=value;
        value=','+value+',';
        elem=document.forms[frm].elements;
        for (i=0;i<elem.length;i++){
			nam=elem[i].name;
            o=elem[i];
            if (nam.substr(0,fname.length+5)==fname+'_box_') { // this is one of our checkboxes
                val=o.value;
                if (val=='') val=nam.substr(fname.length+5);
                o.checked=value.indexOf(','+val+',')>=0;
            }
        }
    }

    // select an option in select by value
    function updSelect(frm,fname,value){
		if (frm=='' || fname==''){
			alert('updSelect Error: no frm/fname ('+frm+'.'+fname+')');
			return -1; // exit on error
		}
		var f,z,i;
        f=document.forms[frm].elements[fname];
        if (!object_has(f,'options')){
			alert('updSelect Error: f has no options ('+frm+'.'+fname+')');
			return -1;
		}
        z=f.options.length;
        for (i=0;i<z;i++){
            if (f.options[i].value==value){
                f.selectedIndex=i;
                return i;
            }
        }
        f.value=value;
        return -1;
    }

    // toggle options in a multi select (not working)
    function toggleMultiSelect(frm,fname,value){
		if (frm=='' || fname==''){
			alert('toggleMultiSelect Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var f,z,i;
        f=document.forms[frm].elements[fname];
        z=f.options.length;
        for (i=0;i<z;i++){
            if (f.options[i].value==value){
                f.options[i].selected=!f.options[i].selected;
            }
        }
    }

    // toggle options in a select (not working)
    function toggleKeysSelect(frm,fname,value){
		if (frm=='' || fname==''){
			alert('toggleKeysSelect Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var f,z,i;
        f=document.forms[frm].elements[fname];
        z=f.options.length;
        for (i=0;i<z;i++){
            if (f.options[i].value==value){
                f.options[i].selected=!f.options[i].selected;
            }
        }
    }

    // validate an email address
    function validateEmail(email){
        email=trim(email);
        if (email=='') return 1;
        if (email.indexOf(' ')>=0) return 0;  // space in middle
        if (email.indexOf('@')<1) return 0;  // no @
        if (email.indexOf('@')!=email.lastIndexOf('@')) return 0; // more than one @
        if (email.lastIndexOf('.')<email.indexOf('@')) return 0;  // no . after the @
        return 1;
    }

    // check that a password was entered the same way twice
    // the two password fields are fname and fname_validation.
    function validatePassword(frm,fname){
		if (frm=='' || fname==''){
			alert('validatePassword Error: no frm/fname ('+frm+'.'+fname+')');
			return 0; // exit on error
		}
		var p1,p2;
        p1=document.forms[frm].elements[fname];
        p2=document.forms[frm].elements[fname+'_validation'];
        if (p1.value!=p2.value) {
            p1.value='';
            p2.value='';
            p2.focus();
            return 0;
        }
        return 1;
    }

    // update fname as y-m-d accoarding to fname_sel_year,fname_sel_month,fname_sel_day
    function updateDate(frm,fname){ //@@ this function is not yet checked/debuged
		if (frm=='' || fname==''){
			alert('updateDate Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var val;
        val =document.forms[frm].elements[fname+'_sel_year' ].value+'-'
           + document.forms[frm].elements[fname+'_sel_month'].value+'-'
           + document.forms[frm].elements[fname+'_sel_day'  ].value;
        document.forms[frm].elements[fname].value=val;
    }

    // update a time field as h:m:s accoarding to fname_sel_hour,fname_sel_minute,fname_sel_second
    function updateTimes(frm,fname){ //@@ this function is not yet checked/debuged
		if (frm=='' || fname==''){
			alert('updateTimes Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var val;
        val =document.forms[frm].elements[fname+'_sel_hour'  ].value+':'
           + document.forms[frm].elements[fname+'_sel_minute'].value+':'
           + document.forms[frm].elements[fname+'_sel_second'].value;
        document.forms[frm].elements[fname].value=val;
    }

    // update a time field as h:m accoarding to fname_hour,fname_minute
    function updateTime(frm,fname){ //@@ this function is not yet checked/debuged
		if (frm=='' || fname==''){
			alert('updateTime Error: no frm/fname ('+frm+'.'+fname+')');
			return ; // exit on error
		}
		var val;
        val =document.forms[frm].elements[fname+'_sel_hour'  ].value+':'
           + document.forms[frm].elements[fname+'_sel_minute'].value;
        document.forms[frm].elements[fname].value=val;
    }


} // the big if that makes sure we do not include this js twice

