PageSourceSearch

https://parentsportal.scot/assets/script/frmUtils.js?v=2.7

js parentsportal.scot collected 2026-10-01 16:25:02 UTC 12,185 bytes, 415 lines download raw bytes

1//
2// These two functions 'disableBackground()' & 'enableBackground()'
3// requires following <div> element available on the html/jsp page
4// 
5// <div id="fadeBackground" class="fade_background"></div>
6// 
7// Also the 'fade_background' css class should be available.
8// example css class. 
9//
10//.fade_background{
11//	display: none;
12//	position: absolute;
13//	top: 0%;
14//	left: 0%;
15//	width: 100%;
16//	height: 100%;
17//	background-color: gray;
18//	z-index:1001;
19//	-moz-opacity: 0.5;
20//	opacity:.50;
21//	filter: alpha(opacity=50);
22//}
23//
24// Note: We need to keep z-index a higher value so that this div is
25// above all other elements in the jsp/html page
26
27// show the 'fadeBackground' div so that all other 
28// elements are not accesible
29
30function disableBackground()
31{
32	// display the fadeBackground
33	window.parent.document.getElementById('fadeBackground').style.display='block';
34	if(window.mlrunShim == true)
35	{
36		var st =  window.parent.document.documentElement.scrollTop;
37		var sh =  window.parent.document.documentElement.scrollHeight;
38		var ch =  window.parent.document.documentElement.clientHeight;
39		/*window.parent.document.getElementById('fadeBackground').style.height = Math.max(st + ch, sh);*/
40		/*window.parent.document.getElementById('frmContent').disabled=true;*/
41	}
42	else
43	{
44		changePosition();
45	}
46
47	if (this.addEventListener)
48    {
49		this.addEventListener("scroll", changePosition, false);
50    }
51    else if (this.attachEvent)
52    {
53    	this.detachEvent("onscroll", changePosition);
54    	this.attachEvent("onscroll", changePosition);
55    }
56}
57
58// Hide the 'fadeBackground' div so that all other 
59// elements are now accesible
60function enableBackground()
61{
62	if (this.removeEventListener)
63    {
64		this.removeEventListener("scroll", changePosition, false);
65    }
66    else if (this.detachEvent)
67    {
68    	this.detachEvent("onscroll", changePosition);
69    }
70	// hide the fadeBackground	
71	window.parent.document.getElementById('fadeBackground').style.display='none';
72	/*window.parent.document.getElementById('frmContent').disabled=false;*/
73}
74
75function changePosition()
76{
77    /*var statusBar = window.parent.document.getElementById('statusbar');
78    var statusbarheight = 100;
79    var screenheight = screen.height;
80    var screenwidth = screen.width;
81    var sl = window.pageXOffset || window.parent.document.body.scrollLeft || window.parent.document.documentElement.scrollLeft;
82    sl =  sl ? sl : 0;
83    if(screenwidth > sl)
84    {
85        window.parent.document.getElementById('fadeBackground').style.left = sl + 'px';
86    }
87    var st = window.pageYOffset || window.parent.document.body.scrollTop || window.parent.document.documentElement.scrollTop;
88    st =  st ? st : 0;
89   
90    if(screenheight > st)
91    {
92        window.parent.document.getElementById('fadeBackground').style.top = st + 'px';
93    }
94    var ch = window.parent.document.documentElement.clientHeight;
95    statusBar.style.top = (st + ((ch - statusbarheight)/2))+'px';*/
96}
97
98function opacity(id, opacStart, opacEnd, millisec) { 
99    //speed for each frame 
100    var speed = Math.round(millisec / 100); 
101    var timer = 1;
102    var ostep  = 1;
103
104    //determine the direction for the blending, if start and end are the same nothing happens 
105    if(opacStart > opacEnd) { 
106    	ostep  = Math.round((opacStart - opacEnd)/speed);
107        for(i = opacStart; i >= opacEnd; i=i-ostep) { 
108            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
109            timer++; 
110        } 
111    } else if(opacStart < opacEnd) { 
112    	ostep  = Math.round((opacEnd - opacStart)/speed);
113        for(i = opacStart; i <= opacEnd; i=i+ostep){ 
114            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
115            timer++; 
116        } 
117    } 
118}
119
120//change the opacity for different browsers 
121function changeOpac(opacity, id) { 
122    var object = window.parent.document.getElementById(id).style; 
123    object.opacity = (opacity / 100); 
124    object.MozOpacity = (opacity / 100); 
125    object.KhtmlOpacity = (opacity / 100); 
126    object.filter = "alpha(opacity=" + opacity + ")"; 
127} 
128
129// Move From hdiits/web/web-inf/jsp/core/model.jsp.
130
131function provideProperHeight()
132{	
133	  document.write("<style>#content{height:635px;}</style>");
134	  document.write("<style>DIV.tabcontentstyle{height:596px;}</style>");
135	  document.write("<style>DIV.tabcontent{height:554px;}</style>");
136
137	  var ua, s, i;
138	  var maxX,maxY;
139	  this.isIE    = false;  // Internet Explorer
140	  this.isNS    = false;  // Netscape
141	  this.version = null;
142	
143	  ua = navigator.userAgent;
144	  s = "MSIE";
145	  
146	  if ((i = ua.indexOf(s)) >= 0)
147	  {
148	    this.isIE = true;
149	    this.version = parseFloat(ua.substr(i + s.length));
150	   	
151	    var maxHeight;	
152	   	var d1 = 635/834;
153		var d2 = 596/834;
154		var d3 = 554/834;   
155	    if (this.version==7)
156	    {        		
157	    	maxHeightContent = (screen.availHeight)*d1;    		
158	    	maxHeightTabcontentstyle = (screen.availHeight)*d2;
159	    	maxHeightTabcontent = (screen.availHeight)*d3;	    	   
160		
161//			document.write("<style>#content{height:"+maxHeightContent+"px;}</style>");
162//		  	document.write("<style>DIV.tabcontentstyle{height:"+maxHeightTabcontentstyle+"px;}</style>");
163//		  	document.write("<style>DIV.tabcontent{height:"+maxHeightTabcontent+"px;}</style>");	    
164		  	document.write("<style>#content{height:"+maxHeightContent+"px;min-height: 450px;height:auto !important;}</style>");
165		  	document.write("<style>DIV.tabcontentstyle{height:"+maxHeightTabcontentstyle+"px;min-height: 450px;height:auto !important;}</style>");
166		  	document.write("<style>DIV.tabcontent{height:"+maxHeightTabcontent+"px;min-height: 450px;height:auto !important;}</style>");	    		
167	    }
168	    else if(this.version==6)
169	    {           
170	    	maxHeightContent = (screen.availHeight)*d1;    		
171	    	maxHeightTabcontentstyle = (screen.availHeight)*d2;
172	    	maxHeightTabcontent = (screen.availHeight)*d3;	  		    	
173			document.write("<style>#content{height:635px;}</style>");
174		  	document.write("<style>DIV.tabcontentstyle{height:596px;}</style>");
175		  	document.write("<style>DIV.tabcontent{height:554px;}</style>");	    		
176	    	 		
177//			document.write("<style>#content{height:"+maxHeightContent+"px;}</style>");
178//		  	document.write("<style>DIV.tabcontentstyle{height:"+maxHeightTabcontentstyle+"px;}</style>");
179//		  	document.write("<style>DIV.tabcontent{height:"+maxHeightTabcontent+"px;}</style>");	    		
180	    }
181	  }
182}	
183
184//To disable right click on page --- starts
185	//var message="Event not allowed";
186	function clickIE4()
187	{
188		if (event.button==2)
189		{
190			//alert(message);
191			return false;
192		}
193	}
194	function clickNS4(e)
195	{
196		if (document.layers||document.getElementById&&!document.all)
197		{
198			if (e.which==2||e.which==3)
199			{
200				//alert(message);
201				return false;
202			}
203		}
204	}
205// To disable right click on page --- ends	
206
207
208// Move From hdiits/web/web-inf/jsp/core/messagePage.jsp
209function submitMessageForm()
210{
211//var varUrl = "hdiits.htm?"+document.getElementById("msgAction").value;
212var varUrl = document.getElementById("msgAction").value;
213showProgressbar();
214document.forms[0].action=varUrl;
215document.forms[0].submit();
216}
217
218
219//START OF : 202414
220//FUNCTION RELATED TO ATTACHED ONLOAD EVENT OF WINDOW.
221var onLoadAttachedEvents = new Array();
222//if flag = true check in onload event list and add if not prsent
223//flag = false add in onload event
224function addWindowOnloadEvent (eventName,flag)
225{
226	//var t1 = new Browser();
227//	alert (t1.isIE);
228//	alert (t1.isMozilla );
229//	alert ("onLoadAttachEvents LENGTH :"+onLoadAttachedEvents.length)	;
230	//alert ("EVENTNAME :"+eventName);
231	if (flag )
232	{
233		for(var index=0; index<onLoadAttachedEvents.length; index++) 
234		{
235//			alert ("onLoadAttachedEvents [index] :" +onLoadAttachedEvents [index]);
236//			alert ("EVENTNAME.TOSTRING() :"+eventName.toString());
237			var mindex =  onLoadAttachedEvents .indexOf (eventName.toString());
238			if (mindex >= 0)
239//			if (onLoadAttachedEvents [index].indexOf(eventName.toString()) > 1);
240			{
241//				alert ("MATCH WITH LIST ");
242				return ;
243			}
244		}
245	}
246	onLoadAttachedEvents[onLoadAttachedEvents.length] = eventName.toString();
247	if (browserVars.type.ie)
248	{
249		window.attachEvent("onload",eventName);
250	}
251	else if (browserVars.type.moz)
252	{
253		addOnLoadEventMozilla (eventName); 
254	}
255	else
256	{
257		alert ("ADD BROWSER SUPPORT ONLOAD SCRIPT ");
258	}
259}
260function addOnLoadEventMozilla(func) 
261{
262	var oldonload = window.onload;
263	if (isFunction(func)) 
264	{
265		if (!isFunction(oldonload)) 
266		{
267		  window.onload = func;
268		}
269		else 
270		{
271		  window.onload = function() 
272		  		{
273				func();
274			  	oldonload();
275		  		};
276		}
277	} 
278	else 
279	{
280		if (isObject(func) && isFunction(func.onload)) 
281		{
282			// callback event?
283			window.onload = function() 
284			{
285				if (isFunction(oldonload)) 
286				{
287					oldonload();
288				}
289				// onload des objektes aufrufen
290				func.onload();
291			};
292		}
293	}
294}
295
296function showAlertMsgForDWR (msg)
297{
298	alert (msg);
299}
300//END  OF : 202414 
301
302//function of frmKeyConfig.js
303/*document.attachEvent("onkeydown",disableEscapeKey);*/
304
305if(document.addEventListener)
306{
307	document.addEventListener("onkeydown", onKeyDownEvent, false);
308}
309else if(document.attachEvent)
310{
311	document.attachEvent("onkeydown",onKeyDownEvent);
312}
313
314/*function disableEscapeKey(){
315	if (event.keyCode==27) {
316		return false;
317	}	
318}
319*/
320
321function onKeyDownEvent(event)
322{
323	if (event.keyCode==27) {
324		return false;
325	}	
326	if ( (event.altKey) || ((event.keyCode == 8) &&  (event.srcElement.type != "text" &&
327		      event.srcElement.type != "textarea" &&
328		      event.srcElement.type != "password")) || 
329		      ((event.ctrlKey) && ((event.keyCode == 78) || (event.keyCode == 82)) ) ||		    	
330		      (event.keyCode == 116) ||  (event.keyCode == 122) || (event.keyCode == 114)) {
331		      event.keyCode = 0;
332		      event.returnValue = false;
333		      }
334}
335
336
337//from Preference.js
338
339function storePreferences(urlStr)
340{	
341	showProgressbar();
342	var hiddenDivCntObj = document.getElementById('divCount');
343	var paramStr = "";
344	if(hiddenDivCntObj != null && hiddenDivCntObj != 'undefined')
345	{	
346		var divCount = hiddenDivCntObj.value;	
347		var divName;
348		var divHiddenParaName;	
349		
350		paramStr = "&divCount="+divCount;		
351		for(var i = 0;i<divCount;i++)
352		{
353			divName = "homePageDiv_"+i;
354			divStatusParaName = "hpDiv_"+i;
355			var divObj = document.getElementById(divName);		
356			paramStr = paramStr+"&"+divStatusParaName+"="+divObj.style.display;
357		}
358		//alert("paramStr ---> "+paramStr);
359		storeMenuPreferences(paramStr);			
360	}
361	//document.forms[0].action = urlStr;
362	//document.forms[0].submit();
363	window.location.href=urlStr; 
364}
365
366
367	function storeMenuPreferences(paramStr)
368	{			
369		
370		try
371    	{   
372    	// Firefox, Opera 8.0+, Safari    
373    	
374    	xmlHttp=new XMLHttpRequest();    
375    	}
376		catch (e)
377		{    // Internet Explorer    
378			try
379      		{
380      			
381      		    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
382      		   
383      		}
384		    catch (e)
385		    {
386		          try
387        		  {                	      
388        		          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
389        		  }
390			      catch (e)
391			      {
392			              alert("Your browser does not support AJAX!");        
393			              return false;        
394			      }
395			 }
396    	}
397    	
398    	var contextPath = document.getElementById('projectContextPath').value;		  
399        var url = contextPath+"?actionFlag=manageUserPreferences&functionality=storeUserMenuPref"+paramStr;       
400        //alert(url);
401        xmlHttp.open("POST", encodeURI(url) , false);         
402        xmlHttp.onreadystatechange = function()
403        {        	
404        	if (xmlHttp.readyState == 4) 
405        	{  			  	
406				if (xmlHttp.status == 200) 
407				{
408					
409				}//end of if
410				
411			}
412        }
413        xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
414		xmlHttp.send(encodeURIComponent(null));	     
415	}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.