    function rotateItems ( strDirection )
    {
        // get the values for type, month and year
        var strType = $( '#newsEventsType' ).val ();
        var intMonth = $( '#newsEventsMonth' ).val ();
        var intYear = $( '#newsEventsYear' ).val ();
		var offset = $( '#newsEventsOffset' ).val ();
		offset = parseInt(offset);

		if (!offset)
		{
			offset = 0;
		}

        // now check we got valid data
        if ( !strType )
        {
            // if we didn't get a valid type, then default to 'Events'
            strType = 'Events';
        }

        // create a date object - we will use it for date calculations a couple of lines down
        // it'll default to the current timestamp
        var objDate = new Date ();

        // we didn't get a valid month
        if ( !intMonth )
        {
            // then default to the current month
            // javascript months go from 0 to 11, so we need to make that + 1 to get the current month
            intMonth = objDate.getMonth () + 1;
        }

        // we didn't get a valid year
        if ( !intYear )
        {
            // then default to the previous year
            intYear = objDate.getYear ();
        }

        // if we're going backwards
        if ( 'prev' == strDirection )
        {
        	//make offset + 6
			offset = offset + 6;

            // if the current month is 1 (i.e. january), then we'll switch that to 12 (december)
            // and decrease the year by one as well (i.e. go to last month of the previous year)
            if (  intMonth <= '1' )
            {
                intMonth = 12;
                --intYear;
            }
            // if it's any other month, then just decrease it and be done with it
            else
            {
                --intMonth;
            }
        }
        // if we're going forward
        else
        {
			offset = offset - 6;
			if (offset < 0)
			{
				offset = 0;
			}


            // we're good, carry on
            // if the given month == 12 (december), then we increase the year and switch back to january
            if ( intMonth == '12' )
            {
                intMonth = 1;
                ++intYear;
            }
            // any other month? then just increment it
            else
            {
                ++intMonth;
            }
        }

        $('#newsEventsIframe').text('Loading...').load ( "shared/home.items.browse.php?type=" + strType + "&month=" + intMonth + "&year=" + intYear +"&offset=" + offset );

    }

    // Execute this method when then  dom is ready
    $(document).ready(function(){
        // Multimedia Section
        $("#photosLink a").click( function() {
            $('#photosLinkImg').attr("src", "images/photosTabOn.gif");
            $('#videosLinkImg').attr("src", "images/videosTabOff.gif");
            $('#multimediaContainer').text('Loading...').load('load.php?page=left_column_multimeda_photos&category=Top.Content.Home');
        });
        $("#videosLink a").click( function() {
            $('#photosLinkImg').attr("src", "images/photosTabOff.gif");
            $('#videosLinkImg').attr("src", "images/videosTabOn.gif");
            $('#multimediaContainer').text('Loading...').load('load.php?page=left_column_multimeda_videos&category=Top.Content.Home');
        });
        // News And Events Section
        $("#newsLink a").click( function() {
            $('#newsLinkImg').attr("src", "images/newsTabOn.gif");
            $('#eventsLinkImg').attr("src", "images/eventsTabOff.gif");
            $('#textsearchlink').html('<a href="http://www.visithoustontexas.com/media/press_releases.php">Search All News</a>');
            $('#newsEventsIframe').text('Loading...').load('shared/home.items.browse.php?type=News&offset=0');
        });
        $("#eventsLink a").click( function() {
            $('#newsLinkImg').attr("src", "images/newsTabOff.gif");
            $('#eventsLinkImg').attr("src", "images/eventsTabOn.gif");
            $('#textsearchlink').html('<a href="http://www.visithoustontexas.com/vistors/events.php">Search All Events</a>');
            $('#newsEventsIframe').text('Loading...').load('shared/home.items.browse.php?type=Events&month=05&year=2008');
        });
        // these functions control the previous/next arrows at the bottom of the news/events box
        $( "#eventNewsPrevArrow a" ).click ( function ( ) {
            rotateItems ( 'prev' );
        } );
        $( "#eventNewsNextArrow a" ).click ( function ( ) {
            rotateItems ( 'next' );
        } );
    });
