function setLimit(limit)
{
    currentUrl = document.location.href;
    if( currentUrl.indexOf('&limit=') != -1 )
	document.location.href = currentUrl.replace( /&limit=[0-9]{2}/i , '&limit=' + limit );
    else
	document.location.href = document.location.href + '&limit=' + limit;
}

function setSort(sort)
{
    currentUrl = document.location.href;
    if( currentUrl.indexOf('&sort=') != -1 )
	document.location.href = currentUrl.replace( /&sort=.*?(&|$)/i , '&sort=' + sort + '$1' );
    else
	document.location.href = document.location.href + '&sort=' + sort;
}

function orderBy(orderUrl, orderType)
{
    if (orderUrl.indexOf("?") == -1)
        window.location = orderUrl+'?o='+orderType;
    else
        window.location = orderUrl+'&o='+orderType;
}

function viewInline( id, latitude, longitude, htmlText, viewMap )
{
    if( $( "#jobInline" + id ).css('display') == 'block')
    {
		$( "#jobInline" + id ).hide();

		if( viewMap == 'True' ) {
			$( "#mapOutLine" + id ).hide();
		}
	}
    else
    {
		$( "#jobInline" + id ).show();

		if( GBrowserIsCompatible() && viewMap == 'True' ) {
		    $( "#mapOutLine" + id ).show();

		    var map_div = document.getElementById( 'map' + id );
		    var map = new GMap2( map_div, {size:new GSize(320,200)} );

		    map.addControl( new GLargeMapControl() );
		    map.setCenter( new GLatLng( 0,0 ), 0 );

		    var markerpt = new GPoint( longitude, latitude );
		    var marker = new GMarker( markerpt );
			var bounds = new GLatLngBounds();
		    GEvent.addListener( marker, "click", function() { marker.openInfoWindowHtml( htmlText ); });

		    var point = new GLatLng( latitude, longitude );
		    bounds.extend( point );

		    map.addOverlay( marker );

		    // Set the center and zoom.
		    if( map.getBoundsZoomLevel( bounds ) < 14 )
		    {
		        map.setZoom( map.getBoundsZoomLevel( bounds ) );
		    }
		    else
		    {
		        map.setZoom( 14 );
		    }
	    
		    map.setCenter( bounds.getCenter() );
		}
	}
	return false;
}

