var abgcolor = '';
var live_sticker = 1;
var runs = 0;

// the CAalertcontent function generates the 
// alerts for a specific client
// pass an argument of 1 to display the content
function CAalertcontent() {
        if(live_sticker != 1) {
	    return;
	}
	if(arguments.length > 0) {
        if  (!document.CA_fontcontentcolor)
            document.CA_fontcontentcolor = '#000000';
		// this part is dynamically generated from the database
		document.write('<table width="95%" cellpadding="0" cellspacing="0"><tr><td height="5"> </td></tr>' +  	
    
		'</table>'); 
	}
}
// CAdrawbox allows for a user
// to simply include the javascript 
// and the function will draw a box on the page
function CAdrawbox(size, width, titlebarcolor, contentcolor, bordercolor, fonttitlecolor, fontcontentcolor, graphic) {
    runs++;
    // this prevents us from running this sticker multiple times on one page (see bz1384):
    if((live_sticker != 1) || (runs > 1)) {
	    return;
	}
	bgcolor = contentcolor;

	if(arguments.length == 1) {
		if(size == 'small') {
			width='150';
		} else if(size =='large') {
			width='300';
		}
	}

	if(!titlebarcolor) {
		if(!graphic) {
			var titlebarcolor='#666666';		
		}
		else {
	 		var titlebarcolor='#FFFFFF';
		}
	}

	
        if(!contentcolor) {
                var contentcolor='#ffffff';
        }

	if(!bordercolor) {
                var bordercolor='#FFFFFF';
        }
		
	if(!fonttitlecolor) {
		var fonttitlecolor='#FFFFFF';
	}

	if(!fontcontentcolor) {
                var fontcontentcolor="#000000";
        }
	
	if(size =='small' || size == 'standard') {
		var maintitle = '<span class="CAtitle"><font color="' + fonttitlecolor + '">&#187; Action Alerts &#171;</font></span>';
		var subtitle = '<span class="CAmediumbold"><font color="' + fontcontentcolor + '">Show Your Support for Music Education!</font></span><br />';
	} else if(size=='large' || size == 'custom') {
		var maintitle = '<span class="CAtitle"><font color="' + fonttitlecolor + '">Action Alerts</font></span>';
		var subtitle = '<span class="CAmediumbold"><font color="' + fontcontentcolor + '">Show Your Support for Music Education!</font></span><br />';
	}
	
	if(graphic) {
		maintitle = '<img src="'+graphic+'" border="0">';
	}

    if  (document.CA_sticker_style == null)
    {
    	document.write('<style>A.CAmediumbold:hover {color: red;}');
	    document.write('A.CAtitle:hover {color: red;}');
    	document.write('A.CAsmallnormal:hover {color: red;}');
	    document.write('A.CAsmalllink:hover {color: red;}');
    	document.write('.CAsmalllink{font-family: verdana,helvetica, geneva; font-size: 10px;}');
	    document.write('.CAtitle { font-family: verdana, helvetica, geneva; font-size: 12px; font-weight: bold; text-decoration: none; }');
    	document.write('.CAmediumbold {font-family: arial,helvetica, geneva; font-size: 12px; font-weight: bold; text-decoration: none;} ');
	    document.write('.CAsmallnormal {font-family: verdana,helvetica, geneva; font-size: 10px; text-decoration: none;}</style>');
        document.CA_sticker_style = 1;
    }

	document.write('<table border="0" cellpadding="0" cellspacing="0" bgcolor="'+bordercolor+'" width="'+width+'">'+
	'<tr>'+
	'<td>'+
		'<table border="0" cellpadding="0" cellspacing="2" width="'+width+'">'+
		'<tr>'+
		'<td bgcolor="'+titlebarcolor+'" align="center">'+
		/* '<a target="_new" href="http://capwiz.com/namm/">'+maintitle+'</a>'+ */
		'<a target="_new" href="http://www.namm.org/publicaffairs/action-alerts/support-music-education">'+maintitle+'</a>'+
		'</td>'+
		'</tr>');
		document.write('<tr>'+
		'<td bgcolor="'+contentcolor+'" align="center" valign="top">');
		document.write(subtitle);
        document.CA_fontcontentcolor = fontcontentcolor;
		// build and display alerts
		CAalertcontent(1);
		document.write('</td>'+
		
		'</tr>'+
		'</table>'+
	'</td>'+
	'</tr>'+
	'</table>');
}
    