/* -------------------------- FUNCTION TO DETECT IE6 -------------------------- */
function isIE6()
{
	var state = false;
	if($.browser.msie)
		state = true;
	
	if(state == true && $.browser.version > 6)
		state = false;
	
	if(state == false)
		return false;
	else
		return true;
}

/* -------------------------- FUNCTION TO DETECT IE7 -------------------------- */

function isIE7()
{
	var state = false;
	if($.browser.msie)
		state = true;
	
	if(state == true && $.browser.version < 7)
		state = false;
	
	if(state == false)
		return false;
	else
		return true;
}


function windowOnLoad ()
{
	// Sets the margin top value to 0 for the first object tag.
	$('#flashContent object:first-child').css('marginTop', 0);
}

$(document).ready (
	function ()
	{
		// Focus & blur events for the search field.	
		$('.fldSearch').focus(function () {	$(this).val(''); });
		$('.fldSearch').blur(function () {	if($(this).val() == '') $(this).val($(this).attr('alt')); });
		
		// Defins the background color for table rows.
		$('.table tr:odd').addClass('odd');
		
		// Defines the background color for even list nodes.
		$('.list li:odd').addClass('even');
		
		// Window on load function
		$(window).load(function () {windowOnLoad(); });
		
		// IE6 | Sets the align attribute to left for each first td in a table row.
		if(isIE6())
		{
			var $tr = $('.table tr');
			$('td:first', $tr).css('textAlign', 'left');	
		}
	}
);

$(window).load (
	function ()
	{
		// Close print window
		if($('#PrintClose').length > 0)
			$('#PrintClose').trigger('click');
	}
);

/* -------------------------- FUNCTION wopen ()  -------------------------- */
function wopen(url, name, w, h)
        {
          
		  w += 32;
          h += 96;
		  
          wleft = (screen.width - w) / 2;
          wtop = (screen.height - h) / 2;
		  
          if (wleft < 0) {
            w = screen.width;
            wleft = 0;
          }
          if (wtop < 0) {
            h = screen.height;
            wtop = 0;
          }
		  
          var win = window.open(url,
            name,
            'width=' + w + ', height=' + h + ', ' +
            'left=' + wleft + ', top=' + wtop + ', ' +
            'location=no, menubar=no, ' +
            'status=no, toolbar=no, scrollbars=yes, resizable=no');

          win.resizeTo(w, h);

          win.moveTo(wleft, wtop);
          win.focus();
        }