jq(document).ready(function() {
		   
  jq('body').addClass('hasjs');
  jq('body').find('div#formfield-form-text, div#formfield-form-quote').parents('body').addClass('portletTemplate');
  
	// fonts replacement rules
	Cufon('h1')('#homenews h2')('#homepage h3')('div.bnpPortlet h2')('ul#countrynav a');
  
  // trackers
  jq('a').not("[@onclick]").each(function() {
  
    var a = jq(this);
    var href = a.attr('href');
   
    if (href && (href.match(/^http/)) && (!href.match(document.domain))) 
    {
      a.click(function() {
        href = href.replace('http://',''); // cleanup for nice GA reports
        pageTracker._trackPageview('/outgoing/' + href);
      });
    }
    else if (a.parents("ul.documents").length>0) 
    {
      var urlpart = href.split("/").pop();
      if (urlpart)      
        a.click(function() {pageTracker._trackPageview('/downloads/' + urlpart);});
    }     
  });
  
  // accessibility
  jq("ul#portal-globalnav a").each(function(index) {jq(this).attr({accesskey:index+1});})
  jq("li#siteaction-accessibility a").attr({accesskey:7});
  jq("li#siteaction-terms-and-conditions a").attr({accesskey:8});  
  jq("li#siteaction-legal-notice a").attr({accesskey:9});  
  
  // confirmation for deleting items
  jq("input[name=folder_delete:method]").addClass('allowMultiSubmit');
  jq("input[name=folder_delete:method]").click(function() {return confirm('Do you really want to remove selected items?');});
  
});
