// JavaScript Document
/*
****************************************************************************************************************
****************************************************************************************************************
****** Author:		Kelton Joseph
****** Version:		2.1
****** Date:		June 12, 2005
****** License:     NOTICE: You may use this code for the sole purpose of www.antigua.gov.ag.
******              Use of this code for any other purpose requires the written permission of its 
******              author.  
******                                     
******              You may *NOT* re-distribute this code in any way except through its
******              use. That means, you can include it in your web site.  You
******              may not put the plain javascript up on your site for download or
******              include it in your javascript libraries for download. 
****************************************************************************************************************
****************************************************************************************************************
*/
<!--

		function trim (str) 
		{
  			if (str != null && str.length > 0)
			{
				while ( str.charAt(0) == ' ')
    					str = str.substring(1);
  				while ( str.charAt(str.length - 1) == ' ')
    					str = str.substring(0, str.length - 1);
  			}//if
			return  str;
		}//trim

		
		function isBlank(aString)
		{
			var result = true;
			if (aString != null)
			{
				aString = trim(aString);
				result = (aString.length < 1);
			}//if
			return result;
		}//isBlank
		
		
		function isEmpty(aString)
		{
			var result = true;
			if (aString != null)
			{
				aString = trim(aString);
				result = (aString.length < 1);
			}//if
			return result;
		}//isBlank		
		
		function isValidEmailAddress(emailAddress)
		{
			var result = false;
			var regexp = /^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
			
			if (!isBlank(emailAddress))
			{
				result = regexp.test(emailAddress);	
			}//if
		
			return result;
		}//isValidEmailAddress
		
		
		function isUrlValid(url)
		{
			var result = false;
			//var urlRegxp = 	(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$;


			
			//var urlRegxp = /^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;


			
			if (!isBlank(url))
			{		
				//result = urlRegxp.test(url);	
				result = true;
			}//if
	
		
			return result;
		}
		
		
		function getRadioGroupSelectedIndex(radioGroup)
		{
			var result = -1;
			var index = 0;
			var blnLoop = true;
			
			
			if (radioGroup == null)
				alert("radioGroup is not a valid RadioGroup");
			else
			{
				while (blnLoop && index < radioGroup.options.length)
				{
					blnLoop = radioGroup.options[index].checked ? false : true;
					index ++;
				}//while
			}//else
			return result;
		}
		


		function addToFavorites(urlAddress, pageName) 
		{ 
			if (window.external) 
			{ 
				window.external.AddFavorite(urlAddress, pageName);
			}//if
			else 
			{ 
				alert("Sorry! Your browser doesn't support this feature."); 
			}//else 
		}//addToFavorites


		function addToMyFavorites() 
		{ 
			//alert("bookmark");
			var urlAddress = window.location;  //"http://www.hypergurl.com/graphics.html"; 
			var pageName = "Free Graphics, Hypergurl"; 
			
			if (window.external) 
			{ 
				
				window.external.AddFavorite(urlAddress, pageName);
			}//if
			else 
			{ 
				alert("Sorry! Your browser doesn't support this feature."); 
			}//else 
		}//addToFavorites		

		
		function bookmarkCurrentPage()
		{

			addToMyFavorites();
			return false;
/*			
			var pageTitle = null;
			var objDoc = new WebDocument(); 
			var objTitle = objDoc.getElement("storyTitle");
			
			if ((objTitle != null) && (objTitle.innerText)) 
				pageTitle = objTitle.innerText;
			else
				pageTitle = window.title;
				
			addToFavorites(window.location, pageTitle);
			
			return false;
*/		
		}//bookmarkThisPage
-->