// -------------
//--- JQUERY ---
// -------------
$(document).ready(function () { //HTML DOM document is ready
	
//    $.ajaxSetup({
//        // Disable caching of AJAX responses */ 
//        cache: false
//    });


	//image rollover
	$("a.roll").live('mouseover focus', function(event) {
		$(this).find('img').attr("src", $(this).find('img').attr("src").split('_f1').join('_f2'))
	}).live('mouseout blur', function(event) {/*mouseout*/
		$(this).find('img').attr("src", $(this).find('img').attr("src").split('_f2').join('_f1'))
	});

	//image rollover
	$("a.rollbg, a.rollpngbg").live('mouseover focus', function(event) {
		$(this).css('background-image', $(this).css('background-image').split('_f1').join('_f2'));
	}).live('mouseout blur', function(event) {/*mouseout*/
		$(this).css('background-image', $(this).css('background-image').split('_f2').join('_f1'));
	});

	//link button rollover
	$("ul.linkbutton a span.linkbutton_content").live('mouseover focus', function(event) {
		$(this).css('text-decoration', 'underline');
	}).live('mouseout blur', function(event) {/*mouseout*/
		$(this).css('text-decoration', 'none');
	});
	
	//table row rollover
//	$.each(["table.financial tbody tr", "table.broker tbody tr","table.info:not(.nohover) tbody tr:not(.nohover)","table.newspanel tbody tr","table.news tbody tr"], function(index, value) { 
//  		$(value).live('mouseover mouseout', function() {
//			$(this).toggleClass("hover");
//		});
//	});

	//open links in a new window - rel=external
	// not working FF 3.6, jQuery 1.4.2 -- JJC
	/*$("a[rel=external]").live("hover focus", function() {
		if (typeof($(this).data("external")) === "undefined") {
			$(this)
				.attr("target","_blank")
				.data("external",1)
				.attr("title") !=='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';	
		}
	});*/
	
	$("a[rel=external]").each(function() {							   
		$(this).attr("target","_blank").attr("title") !=='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';
	});
	
//	//webcast popups
//	$("a[rel=webcast_popup]").live("hover focus", function() {
//		if (typeof($(this).data("external")) === "undefined") {
//			$(this)
//				.attr("target","_blank")
//				.data("external",1)
//				.attr("title") !=='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';	
//		}
//	}).live("click", function() {
//		window.open($(this).attr('href'), 'popup_window', 'width=750,height=580,location=1,resizable=1,status=0,scrollbars=1').focus();
//        return false;
//    });
//
//	$("a[rel=presentation_popup]").live("hover focus", function() {
//		if (typeof($(this).data("external")) === "undefined") {
//			$(this)
//				.attr("target","_blank")
//				.data("external",1)
//				.attr("title") !=='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';	
//		}
//	}).live("click", function() {
//		window.open($(this).attr('href'), 'popup_window', 'width=815,height=600,location=1,resizable=1,status=0,scrollbars=1').focus();
//        return false;
//    });

	//form button rollovers
	$("input.linkbutton").live("mouseover mouseout focus blur", function() {
		$(this).toggleClass("linkbutton_f2");
	});
	$("form button.submitbtn").live("mouseover mouseout focus blur", function() {
		$(this).toggleClass("submitbtn_f2");
	});
	$("form button.rightarrow, form input.rightarrow").live("mouseover mouseout focus blur", function() {
		$(this).toggleClass("rightarrow_f2");
	});
	$("form input.submit").live("mouseover mouseout focus blur", function() {
		$(this).toggleClass("button_f2");
	});
	$("form input.addbutton").live("mouseover mouseout focus blur", function() {
		$(this).toggleClass("addbutton_f2");
	});
	$("form input[type='image']").live('mouseover focus', function(event) {
		$(this).attr('src', $(this).attr('src').split('_f1').join('_f2'));
	}).live('mouseout blur', function(event) {/*mouseout*/
		$(this).attr('src', $(this).attr('src').split('_f2').join('_f1'));
	});
});	


//get page params for web mets
function getParameterByName(name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
	return "";
  else
	return results[1];
}


