$(document).ready(function () { //HTML DOM document is ready

	//open links in a new window - rel=external
	$("a[rel=external]").attr("target","_blank").each(function(n) {
		$(this).attr("title") !='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';
	});
	
	// Metrics hash value - used to obtain metrics from vanity URLs
	if ((window.location.hash.substr(0,5)==="#ref_") && (typeof(s) != 'undefined')) {
	thisHash=window.location.hash.substr(5,window.location.hash.length-5);
	s.tl(true,'o','Referrer: ' + thisHash);
	}
	
	//table row rollover
	$("table.financial tbody tr").mouseover(function() {
		$(this).addClass("hover");
	}).mouseout(function() {
		$(this).removeClass("hover");
	});
	//table row rollover
	$("table.broker tbody tr").mouseover(function() {
		$(this).addClass("hover");
	}).mouseout(function() {
		$(this).removeClass("hover");
	});

	//img link
	$("a.roll").bind('mouseover focus', function(event) {
		$(this).find('img').attr("src", $(this).find('img').attr("src").split('_f1').join('_f2'))
	}).bind('mouseout blur', function(event) {/*mouseout*/
		$(this).find('img').attr("src", $(this).find('img').attr("src").split('_f2').join('_f1'))
	});
	
	//external form
	$("form[class=external]").attr("target","_blank").each(function(n) {
		$(this).attr("title") !='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';
	});
	
	//form button rollovers
	$("form input.button").bind('mouseover focus', function(event) {
		$(this).addClass('button_f2');
	}).bind('mouseout blur', function(event) {
		$(this).removeClass('button_f2');
	});
	//search button
	$("form input.searchbtn").bind('mouseover focus', function(event) {
		$(this).addClass('searchbtn_f2');
	}).bind('mouseout blur', function(event) {
		$(this).removeClass('searchbtn_f2');
	});
	
	//Save button
	$("form input.button_save").bind('mouseover focus', function(event) {
		$(this).addClass('button_save_f2');
	}).bind('mouseout blur', function(event) {
		$(this).removeClass('button_save_f2');
	});
});

