/*
	JavaScript Function Library
	
	Version 4.0
	
	(c)2001-2003 by Digiscribe Inc.
	
	Revision: 10/05/2003

*/


//function to confirm some request
function doConfirm(request, target_url, params)
{
	if(confirm(request))
	{
		document.location=target_url+escape(params);
	}
	
}

//function to set focus to a form field
function SetFocus(frm_name, frm_obj)
{
	eval("document."+frm_name+"."+frm_obj+".focus()");
}



//check for any pattern without regular experessions
function matchPattern(data, patternString)
{
	var numStr=patternString;
	var thisChar;
	var counter=0;

	for(var i=0;i<data.length;i++)
	{
		thisChar=data.substring(i,i+1)
		if(numStr.indexOf(thisChar)!=-1)
		{
			counter++;
		}
	}

	if(counter==data.length)
	{
		return true;
	}
	else
	{ 
		return false;
	}
}



//check for alphanumeric chars and underscore in strings
function CheckValidChars(str)
{
	//regular expression setup (global scope)
	var re = new RegExp("[A-Za-z0-9_]*","ig");
   	var arr=re.exec(str);
   	
   	if (arr[0].length!=str.length) //compare main match to the length of string
   		return false;
   	else
   		return true;
   	
}

//checks for numeric string via RegExp
function CheckNumeric(str)
{
	//regular expression setup (global scope)
	var re = new RegExp("[0-9]*","ig");
   	var arr=re.exec(str);
   	
   	if (arr[0].length!=str.length) //compare main match to the length of string
   		return false;
   	else
   		return true;
}

//checks for numeric string via RegExp
function CheckNumeric(str)
{
	//regular expression setup (global scope)
	var re = new RegExp("[0-9]*","ig");
   	var arr=re.exec(str);
   	
   	if (arr[0].length!=str.length) //compare main match to the length of string
   		return false;
   	else
   		return true;
}

//checks for numeric string via RegExp
function CheckNumericFloat(str)
{
	//regular expression setup (global scope)
	var re = new RegExp("[0-9.]*","ig");
   	var arr=re.exec(str);
   	
   	if (arr[0].length!=str.length) //compare main match to the length of string
   		return false;
   	else
   		return true;
}

//opens new window
function goWin(url, w, h)
{
	if (navigator.appName.indexOf("Explorer") >= 0) 
	{
		var wndHandle=window.open(url,"gWin1"," width="+w.toString()+", height="+h.toString()+", scrollbars=yes, toolbar=no, menubar=no, history=no, resizable");
	}
   	else 
   	{
      		var wndHandle=window.open(url,"gWin1","height="+h.toString()+",width="+w.toString()+",resizable,scrollbars=yes");
         }
}

