    function show_spanish_video()
    {
        if(document.getElementById('video_player') && document.getElementById('video_player_back'))
        {
            //get width and height from the content block
            var width = getStyle('video_player_back','width');
            width = parseInt(width);
            var height = getStyle('video_player_back','height');
            height = parseInt(height) - 32;

            loadVideoPlayer(12, width, height, 'true','none'); //12 =- spanish video id
        }
        else // in case the site is espcially slow, keep trying
        {
			setTimeout("show_spanish_video()",300);
        }
    }

    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(){
        $('#textsearchlink').html('<a href="http://www.visitahoustontexas.com/espanol/visitantes/Eventos_Anuales">Más Eventos</a>');
        // Multimedia Section
        $("#photosLink a").click( function() {
            $('#photosLinkImg').attr("src", "images/spanish/photosTabOn.gif");
            $('#videosLinkImg').attr("src", "images/spanish/videosTabOff.gif");
            $('#multimediaContainer').text('Loading...').load('load.php?page=left_column_multimeda_photos&category=Top.Content.Espanol.Visitantes');
        });
        $("#videosLink a").click( function() {
            $('#photosLinkImg').attr("src", "images/spanish/photosTabOff.gif");
            $('#videosLinkImg').attr("src", "images/spanish/videosTabOn.gif");
            $('#multimediaContainer').text('Loading...').load('load.php?page=left_column_multimeda_videos&category=Top.Content.Espanol.Visitantes');
            setTimeout("show_spanish_video()",300);
        });
        // News And Events Section
        $("#newsLink a").click( function() {
            $('#newsLinkImg').attr("src", "images/spanish/newsTabOn.gif");
            $('#eventsLinkImg').attr("src", "images/spanish/eventsTabOff.gif");
            $('#textsearchlink').html('<a href="http://www.visitahoustontexas.com/espanol/prensa/press_releases.php">Más Notas</a>');
            $('#newsEventsIframe').text('Loading...').load('shared/home.items.browse.php?type=News&offset=0');
            $('#newsEventsPaginationContainer').addClass('show');
        });

        $("#eventsLink a").click( function() {
            $('#newsLinkImg').attr("src", "images/spanish/newsTabOff.gif");
            $('#eventsLinkImg').attr("src", "images/spanish/eventsTabOn.gif");
            $('#textsearchlink').html('<a href="http://www.visitahoustontexas.com/espanol/visitantes/Eventos_Anuales">Más Eventos</a>');
            $('#newsEventsIframe').text('Loading...').load('shared/load.php?page=home_events&category=Top.Content.Espanol.Visitantes');
			$('#newsEventsPaginationContainer').addClass('hidden');
        });
        // 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' );
        } );
    });


function getStyle(id, style) {
   if(!document.getElementById) return;

   el = document.getElementById(id);

     var value = el.style[toCamelCase(style)];

    if(!value)
        if(document.defaultView)
            value = document.defaultView.
                 getComputedStyle(el, "").getPropertyValue(style);

        else if(el.currentStyle)
            value = el.currentStyle[toCamelCase(style)];

     return value;
}

function setStyle(objId, style, value) {
    document.getElementById(objId).style[style] = value;
}

function toCamelCase( sInput ) {
    var oStringList = sInput.split('-');
    if(oStringList.length == 1)
        return oStringList[0];
    var ret = sInput.indexOf("-") == 0 ?
       oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
    for(var i = 1, len = oStringList.length; i < len; i++){
        var s = oStringList[i];
        ret += s.charAt(0).toUpperCase() + s.substring(1)
    }
    return ret;
}

function newWindow(curr) 
{
		currWindow = window.open(curr, 'CurrConverter', 'width=460,height=310');
		currWindow.focus;
}
