$(document).ready(function(){
	var ct_client_reader = new JSONscriptRequest('http://auth.campaigntoolbox.org/reader-server.php?filler=filler');
	ct_client_reader.buildScriptTag();
	ct_client_reader.addScriptTag();
});
//
//$(document).ready(function(){
function ct_client_reader(json_data)
{
	// define variables
	var ct_height = 64;
	var ct_server = 'http://auth.campaigntoolbox.org/';
	var ct_background = 'ct_header.gif';
	// determine related domains
	var ct_domain1 = json_data.ct_domain1;
	// lower the whole body vertically by the expected height of the toolbox navigation
	////$('body').css({'margin-top':ct_height + 'px'});
	// apply background-position shift
	////$(cl_background_selector).css({'background-position':cl_background_position});
	// prepend the toolbox navigation html to the body
	$('body').prepend('\
<div style="background-image:url(' + ct_server + ct_background + ');background-repeat:no-repeat;background-position:center;background-color:' + cl_background_color + ';width:100%;height:64px;">\
<div style="width:773px;height:64px;margin-left:auto;margin-right:auto;">\
\
<div style="color:black;height:54px;padding-top:10px;padding-left:190px;">\
\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://' + ct_domain1 + '/" title="Campaign ToolBox | Home" ><img src="' + ct_server + 'ct_home.gif" alt="Campaign ToolBox | Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://training.campaigntoolbox.org" title="Training Home"><img src="' + ct_server + 'ct_training.gif" alt="Training Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://templates.campaigntoolbox.org" title="Templates Home"><img src="' + ct_server + 'ct_templates.gif" alt="Templates Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="javascript:void(0)" title="Coming soon. Check back in a week."><img src="' + ct_server + 'ct_printing.gif" alt="Coming soon. Check back in a week." /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://' + ct_domain1 + '/" title="Website Home"><img src="' + ct_server + 'ct_website.gif" alt="Website Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://' + ct_domain1 + '/civicrm/mailing/browse/unscheduled&reset=1&scheduled=false" title="Email Home"><img src="' + ct_server + 'ct_email.gif" alt="Email Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://' + ct_domain1 + '/civicrm/dashboard" title="Contacts Home"><img src="' + ct_server + 'ct_contacts.gif" alt="Contacts Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="http://' + ct_domain1 + '/civicrm/admin&reset=1" title="Admin Home"><img src="' + ct_server + 'ct_admin.gif" alt="Admin Home" /></a></div>\
<div style="float:left;margin-right:15px;"><a class="campaigntoolbox_link" href="mailto:support@campaigntoolbox.org" title="Help Home"><img src="' + ct_server + 'ct_help.gif" alt="Help Home" /></a></div>\
\
</div>\
\
</div>\
</div>\
');
	// cycle through the just created links and check if any points to the currect location
	// if yes, change its graphic to the On type
	$('.campaigntoolbox_link').each(function(){
		if(this.href == location.href)
			{
				$(this).children().attr('src', $(this).children().attr('src') + '.on.gif');
			}
	});
}
//});
