// browser detect var isNav, isIE ; if ( parseInt( navigator.appVersion ) < 4 ) { window.top.close() ; } else { isNav = ( navigator.appName == "Netscape" ) ; isIE = ( navigator.appName.indexOf( "Microsoft" ) != -1 ) ; if ( isNav ) { document.captureEvents( Event.MOUSEDOWN | Event.LOAD | Event.UNLOAD ) ; } else if (isIE == false ) { window.top.close ; } } // security related functions // we want to disable right click to secure our source code // in IE 4/5 a simple alert can be sidestepped using the keyboard whilst keeping // the right mouse button down. This is more robust // Netscape is easier to deal with // amended Feb to deal with DOM browsers function noRightClick( e ) { if ( window.event ) e = event ; if ( document.getElementById ) { // DOM browsers document.oncontextmenu = function() { e.returnValue = false ; return false ; } ; } else if ( isIE ) { // IE4 if ( event.button == 2 || event.button == 3 ) { do { window.status = "" ; } while ( showModalDialog( "//EatKeysPage", 0, "dialogWidth:280px; dialogHeight:180px; center:yes;" ) != true ) return false ; } } else if ( isNav ) { // NN4 if ( e.which == 2 || e.which == 3 ) { return false ; } } } document.onmousedown = noRightClick ; // redirects to safe place unless called from appropriate URL function whereCalledFrom( from ) { var s = document.forms[0].HTTP_Referer.value ; var i = s.lastIndexOf( "/" ) + 1 ; if ( s.substr(i).toLowerCase().split("?")[0] == from.toLowerCase() ) { // called from legal place so OK } else { // not called from menu so go to database default opening location.href = "" ; } } // Application Control issues // open in a new window function openDoc( URL, win, features ) { if (URL=="") return false ; var newwin ; if (win=="") win="_" ; if (features=="") { features="menubar,toolbar,resizable,scrollbars,height=500,width=750" } if ( document.forms[0].name == "_Test" ) { // override hard coded figures for OpenNoteURL in test questions if ( screen.width==800 ) features = "resizable,height=440,width=600,top=10,left=1" ; if ( screen.width>800 ) features = "resizable,height=500,width=770,top=80,left=220" ; } newwin = window.open( URL, win, features ) newwin.focus() ; } // allows display of radio & checkbox but refuse edit function noEdit( obj ) { var r = eval ( "document.forms[0].elements." + obj.name ) ; for ( var i=0 ; i max ) { obj.focus() ; alert( "Integer in " + obj.name + " must lie between " + min + " and " + max ) ; return false ; } else { return true ; } } } // refuse to leave unless we have a reasonable entry function checkMandatoryField( fieldName, minLen ) { var obj = eval( "document.forms[0].elements." + fieldName ) ; if ( obj.value.length 0) document.images[i].src = expand.src ; else if (document.images[i].src.indexOf('collapse.gif') > 0) document.images[i].src = collapse.src ; } } } } function retargetLinks( target ) { var i, nullcount, tmp ; nullcount = 1; while (nullcount) { nullcount = 0 ; for (i = 0; i < document.links.length; i++) { if (document.links[i].href == "" ) { nullcount++ ; } else { if ( document.links[i].href.indexOf('?OpenDocument') > 0) { // this is the link we want to modify document.links[i].target = target ; } } } } } // used to put a custom label at the top of a view column // needs a javascript hidden labels field on the form with embedded view function doLabel( col ) { var obj = eval( "document.forms[0].labels" ) ; if ( obj ) { var tmp = eval( "document.forms[0].labels.value.split(',')[" + col + "]" ) ; document.write( "
" + tmp + "
" ) ; } }