PageSourceSearch

https://www.theroyalarticles.com/js.php%3Ff=formUtil

js theroyalarticles.com collected 2026-09-24 23:38:42 UTC 20,791 bytes, 799 lines download raw bytes

1	var req;
2	var td = null;
3	var ret = "";
4	var url = 'http://www.theroyalarticles.com/remote.php';
5	var counter =0;
6	var xml = '';
7	var what ='';
8	function DoCallback(data)
9	{
10		// branch for native XMLHttpRequest object
11		if (window.XMLHttpRequest) {
12			req = new XMLHttpRequest();
13			req.onreadystatechange = processReqChange;
14			req.open('POST', url, true);
15			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
16			req.send(data);
17		// branch for IE/Windows ActiveX version
18		} else if (window.ActiveXObject) {
19			req = new ActiveXObject('Microsoft.XMLHTTP')
20			if (req) {
21				req.onreadystatechange = processReqChange;
22				req.open('POST', url, true);
23				req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
24				req.send(data);
25			}
26		}
27	}
28
29	function processReqChange() {
30		// only if req shows 'loaded'
31		if (req.readyState == 4) {
32			// only if 'OK'
33			if (req.status == 200) {
34				 eval(what);
35			} else {
36				alert('There was a problem retrieving the XML data:\n' +
37					req.responseText);
38			}
39		}
40	}
41
42function clearFont()
43{
44	code = wysiwyg.getHTMLContent();
45	code = code.replace(/<font([^>])*face="([^"]*)"/gi,"<font $1");
46	code = code.replace(/<([\w]+) style="([^"]*)font-family:[^;"]*[;]?([^"]*)"/gi, "<$1 style=\"$2 $3\"");
47	code = code.replace(/<([\w]+) style=" "/gi, "<$1 ");
48	wysiwyg.writeHTMLContent(code);
49
50}
51
52function reloadCaptchaImg(){
53	window.location.reload();
54}
55
56function CheckAdvancedSearchForm()
57{
58	if(document.getElementById("AQuery").value == "")
59	{
60		alert("Please enter your search query.");
61		document.getElementById("AQuery").focus();
62		return false;
63	}
64
65	if(document.getElementById("searchArticles").checked == false && document.getElementById("searchComments").checked == false && document.getElementById("searchBlogs").checked == false && document.getElementById("searchPages").checked == false && document.getElementById("searchNews").checked == false)
66	{
67		alert("Please select a search area.");
68
69		return false;
70	}
71
72	if(document.getElementById("searchAuthor").checked == false && document.getElementById("searchContentBody").checked == false && document.getElementById("searchTitle").checked == false)
73	{
74		alert("Please select a search field.");
75
76		return false;
77	}
78
79
80
81	return true;
82}
83function swapComment(){
84	if(document.getElementById("addCommentBox").checked == true){
85	document.getElementById("commentField").style.display = "";	
86	}else{
87		document.getElementById("commentField").style.display = "none";	
88	}
89	return true;
90}
91function SwitchField(ArticleType)
92{
93	articleType = ArticleType;
94
95	switch(ArticleType)
96	{
97		case 0: // Article
98		{
99			document.getElementById("FileRow").style.display = "";
100			document.getElementById("ArticleURLRow").style.display = "none";
101			break;
102		}
103		case 1: // Summary Only
104		{
105			document.getElementById("FileRow").style.display = "none";
106			document.getElementById("ArticleURLRow").style.display = "none";
107			break;
108		}
109		case 2: // Link
110		{
111			document.getElementById("FileRow").style.display = "none";
112			document.getElementById("ArticleURLRow").style.display = "";
113			break;
114		}
115	}
116}
117
118function CheckUsernameExists(){
119	if(document.getElementById('Username').value.length > 0){
120		what = "CheckUsernameReturn(req.responseXML)";
121		DoCallback("w=CheckUsername" + "&Username=" + document.getElementById('Username').value	);
122		return true;
123	}else{
124		alert('Please enter a username to check its availability.');
125	}
126}
127
128
129function CheckLength(textarea) {
130	var MaxLength = 500;
131
132	biolen = textarea.value.length;
133
134	if (biolen > MaxLength) {
135		textarea.value = textarea.value.substr(0, MaxLength);
136		return;
137	}
138
139	var RemainingLength = (MaxLength - biolen);
140	limitcheck = 'You can type another ' + RemainingLength + ' characters into your biography.';
141	document.getElementById('biolength').innerHTML = limitcheck;
142}
143
144function CheckUsernameReturn(returned){
145		
146		// get the status of the ajax response
147		// our getXMLData function relies on a global variable called 'xml'
148		// so we just put the response into that.
149		xml = returned.documentElement;
150		var status = getXMLData('status');
151
152		if(status == 1){
153			// user account was successfully create
154			document.getElementById("UsernameCheck").innerHTML =  getXMLData('message');
155			return true;
156			
157		}else{
158			document.getElementById("UsernameCheck").innerHTML = 'There was an error checking that username.';
159			return false;
160		}
161
162}
163
164function CheckSubmitArticleForm()
165{
166	if(document.getElementById("Title").value == "")
167	{
168		alert("Please enter an article title.");
169		document.getElementById("Title").focus();
170		return false;
171	}
172
173	if(document.getElementById("Summary").value == "")
174	{
175		alert("Please enter a summary.");
176		document.getElementById("Summary").focus();
177		return false;
178	}
179
180	if(document.getElementById("ACategories").selectedIndex == -1)
181	{
182		alert("Please select a category.");
183		document.getElementById("ACategories").focus();
184		return false;
185	}
186
187	
188	return true;
189}
190
191
192function CheckSubmitBlogForm(){
193	
194	if(document.getElementById("Title").value == "")
195	{
196		alert("Please enter a title");
197		document.getElementById("Title").focus();
198		return false;
199	}
200
201	if(wysiwyg.getHTMLContent() == "&nbsp;" || wysiwyg.getHTMLContent() == "<br/>" || wysiwyg.getHTMLContent() == "<br/> " || wysiwyg.getHTMLContent() == "" || wysiwyg.getHTMLContent() == "&nbsp;<br/>" || wysiwyg.getHTMLContent() == "<br/>&nbsp;")
202	{
203		alert('Please enter some content for your blog post');
204		return false;
205	}
206}
207
208function CheckSubmitArticleForm2()
209{
210
211	atype = document.getElementById('ArticleType');
212	articleType = atype.options[atype.selectedIndex].value;
213	
214	if(document.getElementById("Title").value == "")
215	{
216		alert("Please enter an article title.");
217		document.getElementById("Title").focus();
218		return false;
219	}
220
221	if(document.getElementById("Summary").value == "")
222	{
223		alert("Please enter a summary.");
224		document.getElementById("Summary").focus();
225		return false;
226	}
227
228	if(document.getElementById("ACategories").selectedIndex == -1)
229	{
230		alert("Please select a category.");
231		document.getElementById("ACategories").focus();
232		return false;
233	}
234
235	if(articleType == 1) // full article
236	{
237		if(document.getElementById("PageTitle").value == "")
238		{
239			alert("You need to insert a both an article title and a page title.");
240			document.getElementById("PageTitle").focus();
241			return false;
242		}
243
244		if(wysiwyg.getHTMLContent() == "&nbsp;" || wysiwyg.getHTMLContent() == "<br/>" || wysiwyg.getHTMLContent() == "" || wysiwyg.getHTMLContent() == "&nbsp;<br/>")
245		{
246			alert('Please enter some content for the article into the editor.');
247			return false;
248		}
249
250	}
251
252	return true;
253}
254function CheckLoginForm()
255{
256	if(document.getElementById("Username").value == "")
257	{
258		alert("Please enter your username.");
259		document.getElementById("Username").focus();
260		return false;
261	}
262
263	if(document.getElementById("Password").value == "")
264	{
265		alert("Please enter your password.");
266		document.getElementById("Password").focus();
267		return false;
268	}
269
270	return true;
271}
272
273function CheckAuthorForm()
274{
275	
276
277	if(document.getElementById("Username").value == "")
278	{
279		alert("Please enter your username.");
280		document.getElementById("Username").focus();
281		return false;
282	}
283
284	if(document.getElementById("Password").value == "")
285	{
286		alert("Please enter your password.");
287		document.getElementById("Password").focus();
288		return false;
289	}
290
291	if(document.getElementById("Password").value != document.getElementById("PasswordConfirm").value)
292	{
293		alert("Your passwords don't match.");
294		document.getElementById("Password").focus();
295		document.getElementById("Password").select();
296		return false;
297	}
298
299	if(document.getElementById("FirstName").value == "")
300	{
301		alert("Please enter your first name.");
302		document.getElementById("FirstName").focus();
303		return false;
304	}
305
306	if(document.getElementById("LastName").value == "")
307	{
308		alert("Please enter your last name.");
309		document.getElementById("LastName").focus();
310		return false;
311	}
312
313	if(document.getElementById("Email2").value == "")
314	{
315		alert("Please enter your email address.");
316		document.getElementById("Email2").focus();
317		return false;
318	}
319	
320	if(document.getElementById("Email2").value.indexOf('.') == -1 || document.getElementById("Email2").value.indexOf('@') == -1)
321			{
322				alert('This email address is not valid.');
323				document.getElementById("Email2").focus();
324				document.getElementById("Email2").select();
325				return false;
326			}
327
328	if(document.getElementById("Biography").value == "")
329	{
330		alert("Please enter your biography.");
331		document.getElementById("Biography").focus();
332		return false;
333	}
334
335	return true;
336}
337
338
339function CheckUserForm()
340{
341	if(document.getElementById("Username").value == "")
342	{
343		alert("Please enter your username.");
344		document.getElementById("Username").focus();
345		return false;
346	}
347
348	if(document.getElementById("Password").value == "")
349	{
350		alert("Please enter your password.");
351		document.getElementById("Password").focus();
352		return false;
353	}
354
355	if(document.getElementById("Password").value != document.getElementById("PasswordConfirm").value)
356	{
357		alert("Your passwords don't match.");
358		document.getElementById("Password").focus();
359		document.getElementById("Password").select();
360		return false;
361	}
362
363	if(document.getElementById("FirstName").value == "")
364	{
365		alert("Please enter your first name.");
366		document.getElementById("FirstName").focus();
367		return false;
368	}
369
370	if(document.getElementById("LastName").value == "")
371	{
372		alert("Please enter your last name.");
373		document.getElementById("LastName").focus();
374		return false;
375	}
376
377	if(document.getElementById("Email2").value == "")
378	{
379		alert("Please enter your email address.");
380		document.getElementById("Email2").focus();
381		return false;
382	}
383	
384	if(document.getElementById("Email2").value.indexOf('.') == -1 || document.getElementById("Email2").value.indexOf('@') == -1)
385	{
386		alert('This email address is not valid.');
387		document.getElementById("Email2").focus();
388		document.getElementById("Email2").select();
389		return false;
390	}
391
392	
393	return true;
394}
395
396function UserAccountReturn(returned){
397		
398		// get the status of the ajax response
399		// our getXMLData function relies on a global variable called 'xml'
400		// so we just put the response into that.
401		xml = returned.documentElement;
402		var status = getXMLData('status');
403
404		if(status == 1){
405			// user account was successfully create
406			document.getElementById("custom").value = getXMLData('usertoken');
407			document.getElementById("UserForm").submit();
408			return true;
409			
410		}else{
411			var message = getXMLData('message');
412			alert(message);
413			return false;
414		}
415
416}
417
418function isdefined(variable)
419{
420    return eval('(typeof('+variable+') != "undefined");');
421}
422
423function getXMLData(name){
424	// we rely on a global variable called 'xml'
425	if(isdefined('xml')){
426		return xml.getElementsByTagName(name)[0].firstChild.data;
427	}else{
428		return '';
429	}
430}
431
432function emailToFriend(ArticleLink)
433{
434	var t = (screen.availHeight/2) - (485/2);
435	var l = (screen.availWidth/2) - (605/2);
436	var emailWin = window.open(ArticleLink+"/articleemail", "emailWin", "scrollbars=yes,toolbar=1,statusbar=0,width=605,height=485,top="+t+",left="+l);
437}
438
439function CheckArticleCommentForm()
440{
441	if(document.getElementById('ArticleRating_3')){
442		var sel = false;
443		var ok = false;
444
445		for(i = 1; i < 6; i++)
446		{
447			eval("sel = document.getElementById('ArticleRating_"+i+"').checked;");
448
449			if(sel)
450			ok = true;
451		}
452
453		if(!ok){
454			alert("Please select a rating for this article.");
455			return false;
456		}
457	}
458
459	if(document.getElementById('ArticleComment')){
460		if(document.getElementById('ArticleComment').value.length < 3){
461			alert('Please enter a comment.');
462			return false;
463		}
464	}
465
466	if('1' == '1'){
467		if(document.getElementById('FromEmail').value.length < 3){
468			alert('Please enter your email address. It will not be published anywhere on the site.');
469			return false;
470		}
471	}
472
473	if('1' == '1'){
474		if(document.getElementById('FromName').value.length < 3){
475			alert('Please enter your name.');
476			return false;
477		}
478	}
479
480
481	return true;
482}
483
484
485function CheckBlogCommentForm()
486{
487	if(document.getElementById('ArticleComment')){
488		if(document.getElementById('ArticleComment').value.length < 3){
489			alert('Please enter a comment.');
490			return false;
491		}
492	}
493
494	if('1' == '1'){
495		if(document.getElementById('FromEmail').value.length < 3){
496			alert('Please enter your email address. It will not be published anywhere on the site.');
497			return false;
498		}
499	}
500
501	if('1' == '1'){
502		if(document.getElementById('FromName').value.length < 3){
503			alert('Please enter your name.');
504			return false;
505		}
506	}
507
508
509	return true;
510}
511
512function CheckArticleCommentForm1()
513{
514	var sel = false;
515	var ok = false;
516
517	for(i = 1; i < 6; i++)
518	{
519		eval("sel = document.getElementById('ArticleRating_"+i+"').checked;");
520
521		if(sel)
522		ok = true;
523	}
524
525	if(ok)
526	{
527		if(document.getElementById("addCommentBox").checked == 1){
528			if(document.getElementById("ArticleComment").value == "")
529			{
530				alert("Please enter a comment.");
531				document.getElementById("ArticleComment").focus();
532				return false;
533			}
534			else
535			{
536				return true;
537			}
538		}
539		
540	}
541	else
542	{
543		alert("Please select a rating for this article.");
544		return false;
545	}
546}
547
548function CheckArticleCommentForm2()
549{
550	var sel = false;
551	var ok = false;
552
553
554		if(document.getElementById("ArticleComment").value == "")
555		{
556			alert("Please enter a comment.");
557			document.getElementById("addCommentBox").checked = true;
558			swapComment();
559			document.getElementById("ArticleComment").focus();
560			return false;
561		}
562		else
563		{
564			return true;
565		}
566	
567}
568
569function CheckEmailForm(frm)
570{
571	if(frm.YourName.value == "")
572	{
573		alert("Please enter your name.");
574		frm.YourName.focus();
575		return false;
576	}
577
578	if(frm.YourEmail.value == "")
579	{
580		alert("Please enter your email address.");
581		frm.YourEmail.focus();
582		return false;
583	}
584
585	if(frm.YourEmail.value.indexOf(".") == -1 || frm.YourEmail.value.indexOf("@") == -1)
586	{
587		alert("Your email address is invalid.");
588		frm.YourEmail.focus();
589		return false;
590	}
591
592	if(frm.FriendsName.value == "")
593	{
594		alert("Please enter your friend\'s name.");
595		frm.FriendsName.focus();
596		return false;
597	}
598
599	if(frm.FriendsEmail.value == "")
600	{
601		alert("Please enter your friend\'s email address.");
602		frm.FriendsEmail.focus();
603		return false;
604	}
605
606	if(frm.FriendsEmail.value.indexOf(".") == -1 || frm.FriendsEmail.value.indexOf("@") == -1)
607	{
608		alert("Your friend\'s email address is invalid.");
609		frm.FriendsEmail.focus();
610		return false;
611	}
612
613	frm.Message.disabled = false;
614
615	return true;
616}
617
618function CheckEditArticleForm() {
619	
620}
621
622var CurrentReplyBox = 0;
623
624function ReplyToComment(id){
625	if(id > 0){
626		if(CurrentReplyBox == 0){
627			// we're moving from the default position to a comment
628			document.getElementById('ReplyToComment'+id).innerHTML = document.getElementById('SubmitCommentForm').innerHTML;
629			$('#ReplyToComment'+id).show("normal");
630			$('#SubmitCommentForm').hide("normal");
631			document.getElementById('SubmitCommentForm').innerHTML = '';
632		//	document.getElementById('commentReplyRow').style.display = '';
633			document.getElementById('ReplyToCommentLink'+id).style.display = 'none';
634			document.getElementById('CancelReplyLink'+id).style.display = '';
635			document.getElementById('CommentParentID').value = id;
636		} else {
637			// we're moving from one comment to another
638			document.getElementById('ReplyToComment'+id).innerHTML = document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML;
639			$('#ReplyToComment'+id).show("normal");
640			$('#ReplyToComment'+CurrentReplyBox).hide("normal");
641			document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML = '';
642			//document.getElementById('commentReplyRow').style.display = '';
643
644			document.getElementById('ReplyToCommentLink'+CurrentReplyBox).style.display = '';
645			document.getElementById('CancelReplyLink'+CurrentReplyBox).style.display = 'none';
646
647			document.getElementById('ReplyToCommentLink'+id).style.display = 'none';
648			document.getElementById('CancelReplyLink'+id).style.display = '';
649			document.getElementById('CommentParentID').value = id;
650		}
651		
652	} else {
653		// we are cancelling a reply
654		document.getElementById('SubmitCommentForm').innerHTML = document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML;
655		$('#SubmitCommentForm').show("slow");
656		$('#ReplyToComment'+CurrentReplyBox).hide("slow");
657		document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML = '';
658		//document.getElementById('commentReplyRow').style.display = 'none';
659		document.getElementById('ReplyToCommentLink'+CurrentReplyBox).style.display = '';
660		document.getElementById('CancelReplyLink'+CurrentReplyBox).style.display = 'none';
661		document.getElementById('CommentParentID').value = 0;
662
663	}
664	CurrentReplyBox = id;
665}
666
667
668function LoadUploadedImage(){
669	var FeatureImageThumbnailName = document.getElementById('FeatureImageThumbnailName').value;
670	var FeatureImageName = document.getElementById('FeatureImageName').value;
671	document.getElementById('FeatureImageFrame').src = 'http://www.theroyalarticles.com/remote.php?w=ArticleImageForm';
672	document.getElementById('FeatureImageFrame').style.display = 'none';
673	document.getElementById('FeatureImagePreview').src = 'http://www.theroyalarticles.com/content_images/'+FeatureImageThumbnailName;
674	document.getElementById('FullImageLink').href = 'http://www.theroyalarticles.com/content_images/'+FeatureImageName;
675	document.getElementById('FeatureImageOptions').style.display = '';
676}
677
678function ArticleImageToggle(onlyEnabled){
679	var list = new Array;
680	list[0] = 'artimage_url_row';
681	list[1] = 'artimage_file_row';
682
683	if(onlyEnabled == 'artimage_file_row'){
684		document.getElementById('FeatureImageFrame').style.display = '';
685	}
686
687	if(onlyEnabled == 'artimage_file_row1'){
688		document.getElementById('FeatureImageFrame').style.display = 'none';
689		onlyEnabled = 'artimage_file_row';
690	}
691	
692	for(i=0;i<list.length;i++){
693		if(onlyEnabled == list[i]){
694			document.getElementById(onlyEnabled).style.display = '';
695		}else{
696			document.getElementById(list[i]).style.display = 'none';
697		}
698	}
699}
700
701
702function PodcastToggle(onlyEnabled){
703	var list = new Array;
704	list[0] = 'podcast_url_row';
705	list[1] = 'podcast_file_row';
706	
707	for(i=0;i<list.length;i++){
708		if(onlyEnabled == list[i]){
709			document.getElementById(onlyEnabled).style.display = '';
710		}else{
711			document.getElementById(list[i]).style.display = 'none';
712		}
713	}
714}
715
716function checkWhat(){
717	if(document.getElementById('searchWhat').value == "searchArticles"){
718		document.getElementById('catDiv').style.display = '';
719	}else{
720		document.getElementById('catDiv').style.display = 'none';
721	}
722	return true;
723}
724
725function CheckSmallSearchForm()
726{
727	if (document.getElementById('Query').value == '')
728	{
729		alert('Please enter a search query.');
730		document.getElementById('Query').focus();
731		document.getElementById('Query').select();
732		return false;
733	}
734	else
735	{
736		return true;
737	}
738}
739
740
741function CheckChangeStyle(object){
742	if(DesignMode.enabled == false){
743		object.style.backgroundColor="#FFFFCC";
744		object.style.cursor="text";
745	}
746}
747
748function CheckCatAuthForm()
749{
750	if(document.getElementById("catAuthPass").value == "")
751	{
752		alert("Please enter a password.");
753		document.getElementById("catAuthPass").focus();
754		return false;
755	}
756
757	return true;
758}
759
760function CheckArtAuthForm()
761{
762	if(document.getElementById("artAuthPass").value == "")
763	{
764		alert("Please enter a password.");
765		document.getElementById("artAuthPass").focus();
766		return false;
767	}
768
769	return true;
770}
771
772
773
774function CheckNewsletterForm(){
775	if($('#newsletter_first_name').val() == '') {
776		alert('You forgot to enter your first name.');
777		$('#newsletter_first_name').focus();
778		return false;
779	}
780
781	if($('#newsletter_email').val().indexOf('@') == -1 || $('#newsletter_email').val().indexOf('.') == -1) {
782		alert('Please enter a valid email address, such as [email protected]');
783		$('#newsletter_email').focus();
784		$('#newsletter_email').select();
785		return false;
786	}
787
788	return true;
789}
790
791function ValidateForm(callback) {
792	returnValue = callback();
793	if(window.event) {
794		window.event.returnValue = returnValue;
795	}
796	else {
797		return returnValue;
798	}
799}

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.