// 2010.02.26 KJD: Document created
$( document ).ready( function(){
	
	// 2010.02.27 KJD: Update font sizes
	$( 'font' ).each(function(){
		if( $( this ).attr( 'size' ) >= 3 )
		{
			$( this ).css({'font-size': parseInt( $( this ).attr( 'size' ) ) * 5 + 'px' });
			// Does this conversion: font[size='7']{	font-size: 35px;}
		}
	});

	$( '.UpcomingEventList .EventListHeading, .UpcomingEventList .EventListItem,.UpcomingEventList .moreevents' ).each(function(){
		
		var thisLink = $( this ).attr('rel');
		$( this ).click(function(){
			redirectTo( thisLink );
		});
	});
	
	// 2010.03.02 KJD: redirect on state select
	$( '.stateselect' ).change(function(){
		var thisState = $( this ).val();
		redirectTo( '/index.php?stateid=' + thisState );
	});
	
	// 2010.03.09 KJD: table header sort
	$( '.listingtable th' ).each(function(){
		$( this ).click(function(){
		
// $thisfilename?stateid=$stateid&cityid=$cityid&linktype=$linktype&sorttype=$sorttype&statskip=1&sortby=name
		
			redirectTo( thisfilename + '?stateid=' + stateid + '&cityid=' + cityid + '&sortby=' + $( this ).attr( 'class' ) + '&linktype=' + linktype );
		});
	});
	
	
	// 2010.03.07 KJD: highlight the rows
	$( '.citylink:even, .listingtable TR:even' )
		.addClass('hightlightRow');
	
});

// 2010.05.02 KJD: Page number, from the php
function PageNumber(idnumber)
{
	$( "form[name='searchform']" )
		.val( idnumber )
		.submit();

	/*
	searchform.startat.value = idnumber;
	searchform.submit(); */
}

// 2010.02.26 KJD: browser fixing of location.href
function redirectTo( thisUrl )
{
	location.href= thisUrl;

	if( $.browser.msie )
	{
		window.event.returnValue = false;
		return false;
	}
}
