jQuery(document).ready(
	    function() 
	    {
	    	handleOneByOne();
	    }
	); 


function startReader( uuid, width, height, authenticate ) {

    uuids = uuid.split( "/" );
    uuid = uuids[uuids.length -1];
    // var theurl = '/MSIntegration/webScriptProxy?scripturl=de/alfa/getAudioUrl.xml&uuid=' + uuid + '&' + authenticate;
    var theurl = 'http://' + window.location.host + '/portalsuite/WebProxy?http://omecms-demo-fs/alfresco/service/de/alfa/getAudioUrl?uuid=' + uuid + '&guest=true';
    jQuery.ajax({
        url: theurl,
        type: 'GET',
        // dataType: 'xml',
        timeout: 2000,
        error: function(){

            alert( 'Die Audiodatei steht nicht zur Verf&uuml;gung. Bitte versuchen Sie es gleich noch einmal.' );
        },
        success: function(xml){

            var reader = document.getElementById( "reader" );
            if( reader ) {

                // var myfile = jQuery("url",xml).text() + "?" + authenticate.replace( "alf_", "" );
                var myfile = xml.replace("\n","").replace("\r","").replace("/d/d/","/gd/d/") + "?guest=true";
                var mycontent = "<embed class='article_reader' src='" + myfile + "' height='" + height + "' width='" + width + "' type='video/quicktime' pluginspace='http://www.apple.com/quicktime/download' autoplay='true' controller='true'></embed>";
                reader.innerHTML = mycontent;
            }
        }
    });
}

function printArticle( printArticleUrl, width, height )
{
        if ( window.name == "Printstory" )
        {
                window.print();
        }
        else
        {
                theUrl = document.URL;
                window.alert (theUrl);
                Ergebnis = theUrl.match(/^http:\/\/[^\/]*/);
                if ( Ergebnis[0] )
                {
                        theUrl = Ergebnis[0] + printArticleUrl ;
                }
                window.alert (theUrl);
                mywindow = window.open(theUrl, "Printstory", "width=780, height=600, left=100, top=200 scrollbars=yes");
                /* alert(mywindow.name); */
        }
}

function handleOneByOne() {
    jQuery("#onebyonenavigation").each( function(i) {

        jQuery("div.article_newsticker").each( function(i) {
        
            jQuery(this).css("display", "none");
        });
        /* $("#article_newsticker_1").css("display", "block"); */
        oboAction(0);
    });
}



function oboAction(offset) {
    var oldact = obo_actno;
    obo_actno = obo_actno + offset;
    
    jQuery("span.obo_info").html( obo_actno + " von " + obo_maxno );
    jQuery("#article_newsticker_" + oldact).css("display", "none");
    jQuery("#article_newsticker_" + obo_actno).css("display", "block");
    
    if (obo_actno == 1) jQuery("a.obo_back").css("visibility", "hidden");
    else jQuery("a.obo_back").css("visibility", "visible");

    if (obo_actno == obo_maxno) jQuery("a.obo_forward").css("visibility", "hidden");
    else jQuery("a.obo_forward").css("visibility", "visible");
}

