/**
 * This document only contains scripts that could/should be applied to any site
 */

var $j = jQuery.noConflict();

$j(document).ready(function() {
	
	/**
	 * Get rid of target="_blank"
	 * Do like this instead.. <a href="somewhere.asp" rel="external">Somewhere</a>
	 */
	$j('a[@rel="external"]').click(function() {
		return !window.open($j(this).attr('href'));
	});
	
	
	/**
	 * Fix to be able to use css attribute selector for <td headers="something"> in Intercrap Explorer 6
	 * 
	 * Example:
	 * Write like this in your main stylesheet: td[headers="something"]{some-attribute: some-value;}
	 * And then do a normal class in your ie6 stylesheet: td.something{some-attribute: some-value;}
	 */
	if($j.browser.msie && $j.browser.version.substr(0,3) == '6.0'){
		if(document.body.getElementsByTagName('td').length > 0){
			for(i = 0; i < document.body.getElementsByTagName('td').length; i++){
				var header = new String(document.body.getElementsByTagName('td')[i].getAttribute('headers'));
				if(header != ''){
					document.body.getElementsByTagName('td')[i].setAttribute('className', header);
				}
			}
		}
	}	
});