
	var NS = ( navigator.appName=="Netscape" ) ? true : false;
	var IE = ( navigator.appName=="Microsoft Internet Explorer" ) ? true : false;

    function externalLinks()
    {
	    if (!document.getElementsByTagName) return;
	    var anchors = document.getElementsByTagName("a");
	    for (var i=0; i<anchors.length; i++) {
	        var anchor = anchors[i];
	        if ( anchor.getAttribute("href") && anchor.getAttribute("rel") == "external" ) {
	            anchor.target = "_blank";
	        }
	    }
	}
	
	function ieupdate()
	{
		var objs = document.getElementsByClassName('DynActiveX');
		for ( var i = objs.length - 1; i >= 0; i-- ) {
		    if ( objs[i].outerHTML ) { 
				objs[i].outerHTML = objs[i].innerHTML.replace( /<![^>]+>/gi, '' );
		    }
		}		
	}
	
    function popUpWin( url, width, height, name)
    {
    	name = name ? name : 'popup';
        var settings = "toolbar=no,"
                     + "location=no,"
                     + "directories=no,"
                     + "status=no,"
                     + "menubar=no,"
                     + "scrollbars=no,"
                     + "resizable=no,"
                     + "width=" + ( width ? width : 100 ) + ","
                     + "height=" + ( height ? height : 100 );
        str = name + "Obj = window.open( '" + url + "', '" + name + "', '" + settings + "' )";

        eval( str );
        eval( "var objRef = " + name + "Obj" );

        if( objRef ) {
            objRef.focus();
        }

        return false;
    }

	function fitWindowToPic() {				
     	var img = document.getElementsByTagName( 'img' )[0];
     	img.onload = function() {
	     	var wWidth = (NS)?window.innerWidth:document.body.clientWidth;
	     	var wHeight = (NS)?window.innerHeight:document.body.clientHeight;
	       	window.resizeBy(img.width  - wWidth, img.height - wHeight); 
	       	window.focus();
     	}
	}; 
        
    function isArray(obj) {
       if (obj.constructor.toString().indexOf("Array") == -1)
          return false;
       else
          return true;
    }
    
    function in_array( needle, haystack )
    {
        var i = 0;
        while ( needle != haystack[i] && i < haystack.length ) {
            i++;
        }
        if ( needle == haystack[i] ) {
            return true;
        } else {
            return false;
        }
    }
    
    function strtr( text, fromChars, toChars )
    {
        for ( var i = 0; i < fromChars.length; i++ ) {
            text = text.replace( fromChars.charAt(i), toChars.charAt(i) );
        }
        return text
    }
    
    function str_pad ( input, pad_length , pad_string , pad_type )
    {
        /*
            pad_type values
            0 - left
            1 - right
            2 - both
        */
        input = "" + input;
        var inputLen = input.length;
        var padStrLen = pad_string.length;
        var spaces = ( pad_length - inputLen );
        var j = 0;
        var output;
    
        if ( inputLen < pad_length ) {
            output = input;
            for ( var i = 0; i < spaces ; i += padStrLen ) {
                output = pad_string + output + pad_string;
            }
            switch ( pad_type ) {
                case 0:
                    output = output.substr( ( i - inputLen ), pad_length );
                    break;
                case 1:
                    output = output.substr( i, pad_length );
                    break;
                case 2:
                    var start = Math.ceil( ( output.length - pad_length )/2 );
                    output = output.substr( start , pad_length );
                    break;
            }
        } else {
            output = input;
        }
    
        return output;
    }
    
    function round( num, scale ) {
        if ( scale == undefined ) {
            scale = 3;
        }
        var shift = Math.pow( 10, scale );
        return ( Math.round( num * shift ) / shift );
    }
    
    function formatNumber( szam ) {
        var szamStr = "" + szam;
        if ( szamStr > 0 ) {
            var out;
            var strLen = szamStr.length;
            var strMod = strLen % 3 ;
            strMod = ( strMod > 0 ? strMod : 3 );
            out = szamStr.substr( 0, strMod );
            for ( var i = strMod; i < strLen; i+=3 ) {
                out += ' ' + szamStr.substr( i, 3 );
            }
            return out;
        } else {
            return '0';
        }
    }
   