var qsParm = new Array();
function analyzeQS()
{
    var query = window.location.search.substring(1);
    var parms = query.split('&');
    for (var i=0; i<parms.length; i++) 
    {
        var pos = parms[i].indexOf('=');
        if (pos > 0) 
        {
            var key = parms[i].substring(0,pos);
            var val = parms[i].substring(pos+1);
            qsParm[key] = val;
        }
    }
}

function test()
{
	window.alert("test");
}
 
function getBillingLink()
{	
	qsParm['AgntID'] = '';
	qsParm['Lang'] = '';
	qsParm['TransID'] = '';
	qsParm['payment_status'] = '';
	qsParm['invoice'] = '';
	analyzeQS();
	var obj = document.getElementById('billinglink');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID'];
	}	

	obj = document.getElementById('billingIFrame');
	if (obj != null) {
	    obj.src = obj.src + "&AgntID=" + qsParm['AgntID'];
	}

	obj = document.getElementById('freelink');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID']  + "&TransID=" + qsParm['TransID'];
	}

	obj = document.getElementById('freeIFrame');
	if (obj != null)
	    obj.src = obj.src + "&AgntID=" + qsParm['AgntID'] + "&TransID=" + qsParm['TransID'];

	obj = document.getElementById('finalIFrame');
	if (obj != null)
	    obj.src = obj.src + "&AgntID=" + qsParm['AgntID'] +  "&payment_status=" + qsParm['payment_status'] +  "&invoice=" + qsParm['invoice'];

	var obj = document.getElementById('billinglink1');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID'];
	}	
	var obj = document.getElementById('billinglink2');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID'];
	}	
	var obj = document.getElementById('billinglink3');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID'];
	}	
	var obj = document.getElementById('billinglink4');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID'];
	}	
	var obj = document.getElementById('billinglink5');
	if (obj != null) {
	    obj.href = obj.href + "AgntID=" + qsParm['AgntID'];
	}	
}
