String.prototype.isArgument=function()
{
	return /^([a-zA-Z]){1,}=([0-9]){1,}$/.test(this);
};

/*
call this function just work like window.open(url,name,feature);
however, for IE5.0+, it will open a showModelessDialog window;
and For Gecko(Mozilla or Netscape), the child window will stay on top focus untill user close it.
programmed by hedger
hedger@yahoo-inc.com
http://www.hedgerwow.com/360/dhtml/dialog_window/dialog_window.htm

Customized for ELCA by Paul Mendez
*/

function modal(url,feature)
{
	dialog(url,'',feature,true);
	return false;
}

function dialog(url,name,feature,isModal)
{
 if(url==null){return false;}
 if(name==null){name='';}

 if(window.showModelessDialog)
 {
	if(feature==null){
		feature='';
	}else{
		feature=feature.replace(
				/top/i, 'dialogTop').replace(
				/left/i, 'dialogLeft').replace(
				/height/i, 'dialogHeight').replace(
				/width/i, 'dialogWidth').replace(
				/dialogdialog/gi, 'dialog').replace(
				/,/g, ';');
	}

	if(window.ModelessDialog ==null){window.ModelessDialog = new Object() ; }
	if(name!='')
	{
		if(window.ModelessDialog[name]!=null && !window.ModelessDialog[name].closed )
		{
			window.ModelessDialog[name].focus();
			return window.ModelessDialog[name];
		}
	}

	if(isModal)
	{
		window.showModalDialog(url,window,feature);
		return false;
	}
	else
	{
		window.ModelessDialog[name] = window.showModelessDialog(url,window,feature);
		return window.ModelessDialog[name];
	}
 }
 else
 {
	if(feature==null){
		feature='';
	}else{
		feature=feature.replace(
				/dialog/gi, '').replace(
				/:/g, '=').replace(
				/;/g, ',');
	}

	if(document.getBoxObjectFor)
	{

		if(isModal)
		{
			var Modal = window.open(url,name,'modal=1,' + feature);
			var ModalFocus = function()
			{
				if(!Modal.closed){Modal.focus();}
				else{Modal =null;window.removeEventListener(ModalFocus,'focus');ModalFocus = null; }
			};
			window.addEventListener( 'focus',ModalFocus, false );
			return false;
		}
		else
		{
			return window.open(url,name,feature);
		}
	}
	else
	{
		 return window.open(url,name,feature);
	}
 }
 return null;
}
