/***************************************************************************
 * 
 *   File                 : functions.js
 *
 *   Created              : Monday, 16 June, 2008
 *   Copyright            : (C) 2008 Comtrade Computers, Prishtina, Kosova
 *   Author               : Genc Doko, Software Sales & Engineering
 *   E-mail               : genc.doko@comtrade-ks.com
 *   Web                  : http://www.comtrade-ks.com/
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
 
 


function expand_category ( id )
{

	obj = document.getElementsByTagName ('TR');

	for ( i = 0; i < obj.length; i++ )
	{
		if ( obj[i].id == id )
		{
		
			if ( obj[i].style.display != 'none' )
			{
				obj[i].style.display = 'none';
			}
			else
			{
				obj[i].style.display = '';
			}
				
		}
		
	}
	
}




function collapse_category ( id )
{

	obj = document.getElementsByTagName ('TR');

	for ( i = 0; i < obj.length; i++ )
	{
		if ( obj[i].id == id )
		{
			obj[i].style.display = 'none';
		}
		
	}
	
}




function logout()
{

    if ( confirm ( "Are you sure you want to logout?" ) )
    {
        return true;
    }
    else
    {
        return false;
    }

}




function is_numeric ( string )
{

    var valid_chars = "0123456789.,";
    var is_number = true;
    var char;

    for ( i = 0; i < string.length && is_number == true; i++ ) 
	{ 

        char = string.charAt ( i );
		 
		if ( valid_chars.indexOf ( char ) == -1 ) 
		{
			is_number = false;
		}
		
	}
   
	return is_number;
   
}




function is_empty ( text_field )
{
   
    if ( ( text_field.value.length == 0 ) || ( text_field.value == null ) )
	{
		return true;
	}
	else
	{
		return false;
	}
  
}
