function updateChartXml(chartId,chartDiv,url) {
	
	var chartObj = getChartFromId(chartId);

	chartObj.setDataURL(url);
	//chartObj.render(chartDiv);
}

function gotourl(view) {
	var kat = document.getElementById('kat').value;
	window.location = "kat,"+kat+","+view; 
}


function parseInput(inValue)
{
    if (typeof inValue == "string")
    {
        var rv = inValue.replace(',', '.');
        rv = rv.replace(/ /g, '');
        if (isDecimalFloat(rv))
        {
            rv = parseFloat(rv);
        }
        else
        {
            rv = '';
        }
    }
    else if (typeof inValue == "number")
    {
        rv = inValue;
    }
    return rv;
}


function isDecimalFloat(txt)
{
    var validChars = '0123456789';
    var isNumber = 1;
    var onlyOneDot = 1;
    var len = txt.length;

    if (len == 0)
    {
        isNumber = 0;
    }

    for (var i = 0; (i < len) && (isNumber); i++)
    {
        var c = txt.charAt(i);
        if (c == '.')
        {
            if (onlyOneDot)
            {
                onlyOneDot = 0;
            }
            else
            {
                isNumber = 0;
            }
        }
        else if (c == '-')
        {
            if (i > 0)
            {
                isNumber = 0;
            }
        }
        else if (validChars.indexOf(c) == -1)
        {
            isNumber = 0;
        }
        else
        {
            onlyOneMinus = 0;
        }
    }
    return isNumber;
}

function roundToZloty(inValue)
{
    return Math.floor(inValue + 0.5);
}

function roundToGroszy(inValue)
{
    return Math.floor((inValue * 100) + 0.5)*0.01;
}

function toString100Groszy(inValue)
{
    return inValue.toFixed(2);
}


function roundToDecimals(inValue, decimals)
{
    if (decimals == 0) {
        return Math.round(inValue);
    } else {
        var p = Math.pow(10, decimals);
        return Math.round(p * inValue)/p;
    }
}

/**
 * Klasa do ukrywania/pokazywania elementow list
 */
function SHList(active){
    this._active = active;
    document.getElementById(active).style.display = 'block';
}

SHList.prototype._active;

SHList.prototype.setVisible = function(id){

    document.getElementById(this._active).style.display = 'none';
    
    document.getElementById(id).style.display = 'block';
    
    this._active = id;
    
}



function goToWizSP(type) {
	var view = 'wizytowka_stopy_procentowe.html';

	var currency = '';
	if ('libor' == type) {
		currency = document.getElementById('currency').value;
	}
	var type = document.getElementById('type').value;
	var period = document.getElementById('period').value;

	var val2 = document.getElementById("val");
	var i = val2.selectedIndex;
	var val = val2.options[i].value;


	var from = document.getElementById('from').value;
	var to = document.getElementById('to').value;

	if ('libor' == type) {
		if ('' != from && '' == to) {
			window.location = "currency,"+currency+",period,"+period+",type,"+type+",val,"+val+",from,"+from+","+view; 
		} else if ('' != from && '' != to) {
			window.location = "currency,"+currency+",period,"+period+",type,"+type+",val,"+val+",from,"+from+",to,"+to+","+view; 
		} else {		
			window.location = "currency,"+currency+",period,"+period+",type,"+type+",val,"+val+","+view; 
		}
	} else {
		if ('' != from && '' == to) {
			window.location = "period,"+period+",type,"+type+",val,"+val+",from,"+from+","+view; 
		} else if ('' != from && '' != to) {
			window.location = "period,"+period+",type,"+type+",val,"+val+",from,"+from+",to,"+to+","+view; 
		} else {		
			window.location = "period,"+period+",type,"+type+",val,"+val+","+view; 
		}	
	}
}

