if (location.href.indexOf("gadgets.asp") > 0) {
	//get suppid
	var suppreg = new RegExp("supid=[0-9]{1,9}");
	var suppid = $('input[name=gadgetHonorroll]').val().match(suppreg);
	suppid = suppid[0].split("=");
	suppid = suppid[1];
	$('img').each(function(){
       if ($(this).attr('src').indexOf("gadgetHonorrollSm.jpg") > 0) {
          $(this).parent().parent().parent().attr("id","gadgeTable");
          return;
       }
    });
    $('#gadgeTable tr:lt(3)').hide();	

	//horizontal badge
	var html = "<tr><td colspan=2>&nbsp;</td></tr>";
	html += "<tr><td><img src='http://www.kinteratools.com/ahanew/createbadge.php?eid="+$.url.param("ievent")+"&sid="+suppid+"&type=h' border=0/></td>";
	html += "<td><b>Horizontal Badge 1:</b><br />Copy the code below to your community page to display your badge. Clicking the badge will direct them to your home page.<br />";
	html += 'Embed: <input type="text" size="30" maxlength="7000" name="gadgetBAdge" onClick="this.select();" value="<a href=\'http://www.kintera.org/faf/donorReg/donorPledge.asp?ievent='+$.url.param("ievent")+'&supId='+suppid+'\'><img src=\'http://www.kinteratools.com/ahanew/createbadge.php?eid='+$.url.param("ievent")+'&sid='+suppid+'&type=h\' /></a>"/></td></tr>';
	$('#gadgeTable tr:last').after(html);
   
   	//vertical badge
	var html = "<tr><td colspan=2>&nbsp;</td></tr>";
	html += "<tr><td><img src='http://www.kinteratools.com/ahanew/createbadge.php?eid="+$.url.param("ievent")+"&sid="+suppid+"&type=v' border=0/></td>";
	html += "<td><b>Vertical Badge 1:</b><br />Copy the code below to your community page to display your badge. Clicking the badge will direct them to your home page.<br />";
	html += 'Embed: <input type="text" size="30" maxlength="7000" name="gadgetBAdge" onClick="this.select();" value="<a href=\'http://www.kintera.org/faf/donorReg/donorPledge.asp?ievent='+$.url.param("ievent")+'&supId='+suppid+'\'><img src=\'http://www.kinteratools.com/ahanew/createbadge.php?eid='+$.url.param("ievent")+'&sid='+suppid+'&type=v\' /></a>"/></td></tr>';
    $('#gadgeTable tr:last').after(html);
	
	//horizontal badge
	var html = "<tr><td colspan=2>&nbsp;</td></tr>";
	html += "<tr><td><img src='http://www.kinteratools.com/ahanew/createbadge.php?eid="+$.url.param("ievent")+"&sid="+suppid+"&type=h&image=2' border=0/></td>";
	html += "<td><b>Horizontal Badge 2:</b><br />Copy the code below to your community page to display your badge. Clicking the badge will direct them to your home page.<br />";
	html += 'Embed: <input type="text" size="30" maxlength="7000" name="gadgetBAdge" onClick="this.select();" value="<a href=\'http://www.kintera.org/faf/donorReg/donorPledge.asp?ievent='+$.url.param("ievent")+'&supId='+suppid+'\'><img src=\'http://www.kinteratools.com/ahanew/createbadge.php?eid='+$.url.param("ievent")+'&sid='+suppid+'&type=h&image=2\' /></a>"/></td></tr>';
	$('#gadgeTable tr:last').after(html);
   
   	//vertical badge
	var html = "<tr><td colspan=2>&nbsp;</td></tr>";
	html += "<tr><td><img src='http://www.kinteratools.com/ahanew/createbadge.php?eid="+$.url.param("ievent")+"&sid="+suppid+"&type=v&image=2' border=0/></td>";
	html += "<td><b>Vertical Badge 2:</b><br />Copy the code below to your community page to display your badge. Clicking the badge will direct them to your home page.<br />";
	html += 'Embed: <input type="text" size="30" maxlength="7000" name="gadgetBAdge" onClick="this.select();" value="<a href=\'http://www.kintera.org/faf/donorReg/donorPledge.asp?ievent='+$.url.param("ievent")+'&supId='+suppid+'\'><img src=\'http://www.kinteratools.com/ahanew/createbadge.php?eid='+$.url.param("ievent")+'&sid='+suppid+'&type=v&image=2\' /></a>"/></td></tr>';
    $('#gadgeTable tr:last').after(html);
	
	//horizontal badge
	var html = "<tr><td colspan=2>&nbsp;</td></tr>";
	html += "<tr><td><img src='http://www.kinteratools.com/ahanew/createbadge.php?eid="+$.url.param("ievent")+"&sid="+suppid+"&type=h&image=3' border=0/></td>";
	html += "<td><b>Horizontal Badge 3:</b><br />Copy the code below to your community page to display your badge. Clicking the badge will direct them to your home page.<br />";
	html += 'Embed: <input type="text" size="30" maxlength="7000" name="gadgetBAdge" onClick="this.select();" value="<a href=\'http://www.kintera.org/faf/donorReg/donorPledge.asp?ievent='+$.url.param("ievent")+'&supId='+suppid+'\'><img src=\'http://www.kinteratools.com/ahanew/createbadge.php?eid='+$.url.param("ievent")+'&sid='+suppid+'&type=h&image=3\' /></a>"/></td></tr>';
	$('#gadgeTable tr:last').after(html);
   
   	//vertical badge
	var html = "<tr><td colspan=2>&nbsp;</td></tr>";
	html += "<tr><td><img src='http://www.kinteratools.com/ahanew/createbadge.php?eid="+$.url.param("ievent")+"&sid="+suppid+"&type=v&image=3' border=0/></td>";
	html += "<td><b>Vertical Badge 3:</b><br />Copy the code below to your community page to display your badge. Clicking the badge will direct them to your home page.<br />";
	html += 'Embed: <input type="text" size="30" maxlength="7000" name="gadgetBAdge" onClick="this.select();" value="<a href=\'http://www.kintera.org/faf/donorReg/donorPledge.asp?ievent='+$.url.param("ievent")+'&supId='+suppid+'\'><img src=\'http://www.kinteratools.com/ahanew/createbadge.php?eid='+$.url.param("ievent")+'&sid='+suppid+'&type=v&image=3\' /></a>"/></td></tr>';
    $('#gadgeTable tr:last').after(html);
}

//get event name from home page and place into header on page - exclude home page (default.asp)
//if event has been deactivated then getting h2 will be null
$('.FAFOuterTable2 table:eq(2)').before("<span style='position:relative;width:600px;display:block' class='pagetitle'></span>");
var ptitle = document.title.split(" - ");
if (location.href.indexOf("default.asp") == -1) {
	$('.pagetitle').append("<span style='position:absolute;top:30px;left:120px;width:100%;color:#7ABD32;font-size:24px;font-weight:bold'>"+ptitle[0]+"</span>");
}
//$.get("/FAF/home/default.asp?ievent="+getUrlVal("ievent"),function(data){
//	if (($(data).find('h2').html() != null) && (location.href.indexOf("default.asp") == -1)) {
//		$('.pagetitle').append("<span style='position:absolute;top:30px;left:100px;width:100%;color:#7ABD32;font-size:24px;font-weight:bold'>"+$(data).find('h2').html()+"</span>");
//	}
//});

function getUrlVal( name ){
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "";
	else
		return results[1];
}