// **************************************************************************************************************
//  expertLogoV2open.js is the property of Round Table Group, Inc.   
// **************************************************************************************************************

// Function to tear the query string apart
function QSObject(querystring){ 

    //Create regular expression object to retrieve the qs part 
    var qsReg = new RegExp("[?][^#]*","i"); 
    hRef = querystring; 
    var qsMatch = hRef.match(qsReg); 

    //removes the question mark from the url 
    qsMatch = new String(qsMatch); 
    qsMatch = qsMatch.substr(1, qsMatch.length -1); 
 

    //split it up 
    var rootArr = qsMatch.split("&"); 

    for(i=0;i<rootArr.length;i++){ 
        var tempArr = rootArr[i].split("="); 

        if(tempArr.length ==2){ 
            tempArr[0] = tempArr[0]; 
            tempArr[1] = tempArr[1]; 
            this[tempArr[0]]= tempArr[1]; 
        } 

    } 

} 
 
// Fetch the "src" attribute passed in the script tag from the calling page
var scriptSrc = document.getElementById("rtgExpertLogoScript").src;

// Get query string object, which contains URL vars
qs = new QSObject(scriptSrc); 

// Set local vars for incoming data...if for some reason data didn't come in set vals to blank
var e = "";
var i = "";
var d = "";
var u = "";
var y = "";
var u = document.location.href;

// Find out if the vars were passed in...if they were, set the value to be passed
if(typeof(qs.ecp) !== 'undefined' ) {
	e = qs.ecp; 
}

if(typeof(qs.it) !== 'undefined' ) {
	i = qs.it;
}

if(typeof(qs.md) !== 'undefined' ) {
	d = unescape(qs.md);
}

if(typeof(qs.yr) !== 'undefined' ) {
	y = unescape(qs.yr);
}

if ( y.length == 0 && d.length == 0 ) {
	d = "Round Table Group";
}

var ci = "false";

if ( d.length > 0 ) {
	ci = "true";
}


// Generate the table that contains the image code. 
var rtgTableCode = '<table width="140" border="0" cellpadding="1" cellspacing="0" bordercolor="#123B64" bgcolor="#123B64">\n'
+ '    <tr>\n      <td height="110" align="center" valign="top">'
+ '<img src="http://www.roundtablegroup.com/track/webImages/expertLogo.cfm?ecp=' + e + '&it=' + i +'&ur=' + u + '&ci=' + ci +'&ed=' + d + '" alt="Round Table Group" /><br />\n';


// Write the table to the document.  
document.write(rtgTableCode);



