// -------------
//--- JQUERY ---
// -------------
$(document).ready(function () { //HTML DOM document is ready

	//image rollover
	$("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'))
	});

	//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");
	});
	// Check All boxes
	$("#category_all").click(function() {
		var checked_status = this.checked;
		$("input[@name=category]").each(function()
		{
			this.checked = checked_status;
		});
	});	

	//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.';
	});
	
	//photoplayer - open in sized browser
	
	$('a[rel="photoplayer"]').click( function() {
		window.open($(this).attr('href'), 'player_window', 'width=810,height=780,location=0').focus();
        //window.open($(this).attr('href'),this,'width=800,height=700');
        return false;
    });
	
	$('a[rel="photoplayer"]').bind('mouseover focus', function(event) {
		$(this).attr("title","Opens in a new browser window.");
    });
	
	
	
	//form button rollovers
	$("form input.button").hover(highlight_btn,restore_btn);
	function highlight_btn(event) {$(this).addClass('button_f2');}
	function restore_btn(event) {$(this).removeClass('button_f2');}
	
	$("form input.submit").hover(highlight_btn2,restore_btn2);
	function highlight_btn2(event) {$(this).addClass('button_f2');}
	function restore_btn2(event) {$(this).removeClass('button_f2');}

	$("form input.submit").focus(highlight_btn2);
	$("form input.submit").blur(restore_btn2);
	function restore_btn2(event) {$(this).removeClass('button_f2');}




// --------------------------------------
// --- PRESENTATIONS POPUP ---
// --------------------------------------
var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=773,height=600';

function raw_popup(url, target, features) {
if (features ==""){
	theFeatures = _POPUP_FEATURES;
}else{
	theFeatures = features
}
var theWindow = window.open(url, target, theFeatures);
theWindow.focus();
return theWindow;
}

function link_popup(src, target, features) {
	return raw_popup(src, target, features);
}
});
