// JScript File

function bellsWhistles() {
   var offramp = '/hcp/system_pages/SiteExit.aspx?url=';
    $('a[rel="external"]').attr('href', function(concat) {
        return offramp + this.href;
        });  
        
    
    $('a[rel="external"]').wrap('<span class="nobr">');
    $('a[rel="external"]').append('<img src="/hcp/images/icons/external-link.png" alt="external link" class="linkimg" width="10" height="10" />'); 
    $('a[type="application/pdf"]').attr("target","_blank");
    $('a[type="application/pdf"]').after('<img src="/hcp/images/icons/pdf.png" alt="pdf link" class="linkimg" width="15" height="15" />');
	
    $('a[type="application/word"]').after('<img src="/hcp/images/icons/word-icon.png" alt="MS Word document" class="linkimg" />'); 
    //$('a.top').after('<img src="/hcp/images/widgets/to-top.png" alt="Back to top" class="linkimg" />');
    $('dl dt').append(':');
    $('fieldset label.req').prepend('<b>*</b>');
    $('fieldset p.req').prepend('<b>*</b>'); 
    $('table tbody tr:nth-child(odd)').addClass("zebra");
    
    $("#azandme img").hover(
             function()
             {
              this.src = this.src.replace("_off","_over");
             },
             function()
             {
              this.src = this.src.replace("_over","_off");
             }
            );
    $("a.trigger").click(function(){
				    var popID = $(this).attr("href");
				    var offset = $(this).offset();
				    
				    var posx = offset.left + $(this).width() - 50;
				    if(posx > 600){posx = "600px";}
				    else {posx = posx + "px";}
				    
				    var posy = offset.top - 170 + "px";
				    showPop(popID,posx,posy);
				    return false;
				});
    $("a.triggerNPI").click(function(){
				    var popID = $(this).attr("href");
				    var offset = $(this).offset();
				    
				    var posx = offset.left + $(this).width() - 50;
				    if(posx > 600){posx = "600px";}
				    else {posx = posx + "px";}
				    
				    var posy = offset.top - 170 + "px";
				    showPopNPI(popID,posx,posy);
				    return false;
				});
}



function ie6Fix() {
	
	$('#text table tr.zebra.last').addClass('zebralast');
	
	// add class to adjacent items
	var arrAdjacent = new Array(
		'#text h2 + .diagram'
	)
	jQuery.each(arrAdjacent, function(i) { $(arrAdjacent[i]).addClass('adjacent'); });
	
	/* add class to first items */
	var arrFirst = new Array(
		'#text table th:first-child',
		'#text table td:first-child'
	)
	jQuery.each(arrFirst, function(i) { $(arrFirst[i]).each(function(i) { $(this).addClass('first'); }); });
	
	/* add class to last items */
	var arrFirst = new Array(
		'#text table tr:last-child',
		'#text table th:last-child',
		'#text table td:last-child'
	)
	jQuery.each(arrFirst, function(i) { $(arrFirst[i]).each(function(i) { $(this).addClass('last'); }); });
	
}
