
function selectAll(theField)
{
	var tempval = eval("document."+theField)
	tempval.focus( )
	tempval.select( )
}

function popUp( URL, w, h )
{
     var winl = (screen.width - w) / 2;
     var wint = (screen.height - h) / 2;
     winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',resizable=1,scrollbars=1,statusbar,menubar=1';
     
     window.open(URL, '', winprops);
}

function SelectAll( )
{
	for( var i=0; i<document.form.elements.length; i++ )
	{
		var e = document.form.elements[i];
		e.checked = true;
	}
}

function DeselectAll( )
{
	for( var i=0; i<document.form.elements.length; i++ )
	{
		var e = document.form.elements[i];
   		e.checked = false;
	}
}

function highlight( checkbox, currbgcolor )
{
	if (document.getElementById)
	{
    	var tr  = document.getElementById("row" + checkbox.value);
		var ctr = document.getElementById("child" + checkbox.value);
   	}
	else
	{
      	return;
   	}
   	
	if(tr.style)
	{
    	if (checkbox.checked)
		{
        	tr.style.backgroundColor = "#DDDDDD";
			ctr.style.backgroundColor = "#DDDDDD";
      	}
		else
		{
         	tr.style.backgroundColor = currbgcolor;
			ctr.style.backgroundColor = currbgcolor;
      	}
   	}
}

function rsshighlight( checkbox, currbgcolor )
{
	if (document.getElementById)
	{
    	var tr  = document.getElementById("row" + checkbox.value );
   	}
	else
	{
      	return;
   	}
   	
	if(tr.style)
	{
    	if (checkbox.checked)
		{
        	tr.style.backgroundColor = "#DDDDDD";
      	}
		else
		{
         	tr.style.backgroundColor = currbgcolor;
      	}
   	}
}

function templatehighlight( checkbox, currbgcolor )
{
	if (document.getElementById)
	{
    	var tr  = document.getElementById("child" + checkbox.value );
   	}
	else
	{
      	return;
   	}
   	
	if(tr.style)
	{
    	if (checkbox.checked)
		{
        	tr.style.backgroundColor = "#DDDDDD";
      	}
		else
		{
         	tr.style.backgroundColor = currbgcolor;
      	}
   	}
}

function createWindow( u, n, w, h, r )
{
	args   = 'width='+w+',height='+h+',status,resizable=yes,scrollbars=yes';
	remote = window.open( u, n, args );
        
	if( remote != null )
	{
    	if( remote.opener == null )
		{
            remote.opener = self ;
        }
    }
		
    if( r == 1 )
	{
		return remote;
	}
}

var attw = null;
var drww = null;

function Attach( url )
{
	if( !attw || attw.closed )
	{
		attw = createWindow( url,  'attachwin', 600, 385, 1) ;
	}
	attw.focus( );
}

function deleteConfirm( url )
{
	var x = confirm("Are you sure you want to delete?")
	if( x )
	{
		window.location.href = url;
	}
}

function open_table_window( srcElement, page, width, height ) 
{	
	if( srcElement.className == "disabled" )
	{
		return;	
	}
	get = window.open( page, "get", "width=" + width + ", height=" + height + ",status=no,left="+((screen.width/2)-220)+",top="+((screen.height/2)-220)+"\"");
	get.focus();
}

function mOvr( src, clrOver )
{ 
	if( !src.contains( event.fromElement ) ) 
	{
		src.bgColor = clrOver; 
	}
}

function mOut( src, clrIn ) 
{ 
	if( !src.contains( event.toElement ) ) 
	{  
		src.bgColor = clrIn; 
	}
}

function textCounter( field, countfield, maxlimit )
{
    if( field.value.length > maxlimit ) 
    {
    	field.value = field.value.substring( 0, maxlimit );
    }
    else
    {
    	countfield.value = maxlimit - field.value.length;
    }
}

function MM_jumpMenu( targ, selObj, restore )
{ 	//v3.0
	eval( targ+".location = '"+selObj.options[selObj.selectedIndex].value+"'" );
	
	if( restore )
	{
		selObj.selectedIndex = 0;
	}
}

function MM_findObj( n, d )
{ 	//v4.01
	var p,i,x;
	
	if( !d ) d = document;
	
	if( ( p = n.indexOf("?") ) > 0 && parent.frames.length )
	{
    	d = parent.frames[n.substring(p+1)].document;
		n = n.substring( 0, p );
	}
  
  	if( !(x=d[n]) && d.all ) x = d.all[n]; 
	
	for( i=0; !x && i < d.forms.length; i++ )
	{
		x = d.forms[i][n];
	}
  	
	for( i=0; !x && d.layers && i < d.layers.length; i++ )
	{
		x = MM_findObj( n, d.layers[i].document );
	}
	
  	if( !x && d.getElementById ) 
	{
		x = d.getElementById( n );
		return x;
	}
}

function MM_jumpMenuGo( selName, targ, restore )
{ 	//v3.0
  	var selObj = MM_findObj( selName ); 
	
	if( selObj )
	{
		MM_jumpMenu( targ, selObj, restore );
	}
}
