﻿// JScript File

function MaxWindow()
{
	if (window != top) top.location.href = location.href;
	
	window.moveTo(0,0);
	if (document.all)
	{
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById)
	{
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
		{
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}

function IntOnly(evt)
{
	evt = (evt) ? evt : event;
	var keycode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
	var evtControl = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	
	if (keycode == 13)
	{
		
		return true;
	}
	if (keycode < 48 || keycode > 57)
	{
	
		return false;
	}
	

}

function Tab(currentField, nextField)
{
    // Determine if the current field's max length has been reached.

    if (currentField.value.length == currentField.maxLength)
    {
          // Retreive the next field in the tab sequence, and give it the focus.

        document.getElementById(nextField).focus();
    }
}

function ConfirmDeletion()
{
	var agree = confirm("Are you sure you want to delete?");
	if(agree)
		
	return true;
	
	else 
	
	return false; 
}


function ToggleDiv(DivName, Anchor ) 
{ 
     
       var intIndex = 0;
      
       
       var rename = "";
       
      if (DivName.indexOf('plus') !=-1)
      {
  
           
            document.getElementById(DivName).style.display = 'block';
           
            intIndex = DivName.indexOf('plus');
             
             //rename div with minus at the end
             
             rename = DivName.substring(0, intIndex) + 'minus';
             
             //window.alert(rename);
             
            document.getElementById(DivName).setAttribute('id', rename );
            
             document.getElementById(Anchor).setAttribute("href", "JavaScript:ToggleDiv('" + rename + "', '" +  Anchor + "');" );
      }
//      else
//      {

//           
//            document.getElementById(DivName).style.display = 'none';
//            
//             
//             intIndex = DivName.indexOf('minus');
//             
//             //rename div with minus at the end
//             
//             rename = DivName.substring(0, intIndex) + 'plus';
//             
//             //window.alert(rename);
//             
//            document.getElementById(DivName).setAttribute('id', rename );
//            
//           document.getElementById(Anchor).setAttribute("href", "JavaScript:ToggleDiv('" + rename + "', '" +  Anchor + "');" );

//      }
}

