function URLCheck(theurl)
{
 var tomatch= /[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
 if (tomatch.test(theurl))
 {
 //window.alert("URL OK.");
 return true;
 }
 else
 {
 //window.alert("URL invalid. Try again.");
 return false; 
}
}

function CheckMail(x)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;
}

function IsNumeric(strString)
{
	var strValidChars = "0123456789.-";
	var strChar;
	var blnResult = true;

	 if (strString.length == 0) return false;

	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
	}
	return blnResult;
}

function OpenLink() 
{
   var l  = '';
   for (i = 0; i < arguments.length; i++) { 
      l = l + arguments[i];
   }
   if (l.charAt(0)=='#') l = l.substring(1,l.length);
     
   window.location.href=l;
}


function addToFavorites(name,site_url)
{
	/*alert(site_url);*/
	
	if ( navigator.appName != 'Microsoft Internet Explorer' ) 
	{ 
		window.sidebar.addPanel(name,site_url,""); 
	} 
	else
	{ 
		/*alert(site_url);*/
		window.external.AddFavorite(site_url,name); 
	}
	
}


function PopupImage(title,img,width,height) 
{
	w=open("",'image','width='+width+',height='+height+',toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+title+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src="+img+" border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}
