var j = jQuery.noConflict();
j(document).ready(function(){ 
						   
	extLinks();
	replaceHrTag();
	styleSecondCol();
		
	//$('#topimg').flash({
    //	swf: 'swf/fastfuels.swf',
    //	width: 862,
    //	height: 227
	//});	
	
	
	
	

	j(window).bind("load", function() { 				 
 		j('.smallboxes .bottombox').equalHeights;		 
 		j('#footer .inner').equalHeights;
	}); 
	
	j('img[@src$=png]').pngfix();

	var userAgent = navigator.userAgent.toLowerCase();
	// Is this a version of Safari?
	if(j.browser.safari){
		j('body').addClass('safari');
		// Add the version number
		userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
		userAgent = userAgent.substring(0,1);
		//$('body').addClass('safari' + userAgent);
	}
	j('.terms').hide();
    j('.slideterms').click(function () {
      if (j(".terms").is(":hidden")) {
        j(".terms").slideDown("slow");
      } else {
        j(".terms").slideUp("slow");
      }
    });
	
	
	
	// Hover emulation for IE 6.
  if (j.browser.msie && parseInt(jQuery.browser.version) == 6) {
   j('#navigation li').hover(function() {
      j(this).addClass('ieHover');
    }, function() {
      j(this).removeClass('ieHover');
    });
   
   
   j('#sidenavigation li').hover(function() {
      j(this).addClass('ieHover1');
    }, function() {
      j(this).removeClass('ieHover1');
    });
  }
  

});

function extLinks(){
	j('a[@rel*="external"]').click(function(){
		window.open(this.href);
		return false;
	});
}

function replaceHrTag(){	
	j("hr").wrap("<div class='divider2'></div>");
}

function StripeTable(){	// must include table plugin to use this function			
	j(".stripeMe tr").mouseover(function(){
		j(this).addClass("over");
	}).mouseout(function(){
		j(this).removeClass("over");
	});
	j(".stripeMe tr:even").addClass("alt");  
}

function styleSecondCol(){
    j('tr').each(function(){		  
		var count=1;
    	j('td').each(function(){
      		count++;
			//alert(count);
			if(count%2 != 0){ 
				j(this).addClass("txtright");
			}
    	})
    })
}


function addPrintLink(){
	// add print page link - since it can only work for JS, only add it for JS users
	j('#print') // create list item
    .addClass('print') //add relevant class to it
    .append('<a href="javascript:window.print();">Print this page</a>') //put in the link
    .insertBefore('li a.foo'); //add before the li item with link of class 'foo'
}


