function closeYoutube () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#youtubetop').fadeOut();
        document.getElementById('youtubetopcontent').style.display='none';
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('youtubetop').style.display='none';
        document.getElementById('youtubetopcontent').style.display='none';    
    }
}

function openYoutube () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#youtubetop').fadeIn();
        jq('#youtubetopcontent').fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('youtubetop').style.display='block';
        document.getElementById('youtubetopcontent').style.display='block';    
    }
}

function closeYoutubeLeft () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#youtubeLightviewLeft').fadeOut();
        document.getElementById('youtubeLightviewLeftContent').style.display='none';
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('youtubeLightviewLeft').style.display='none';
        document.getElementById('youtubeLightviewLeftContent').style.display='none';
    }
}

function openYoutubeLeft () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#youtubeLightviewLeft').fadeIn();
        jq('#youtubeLightviewLeftContent').fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('youtubeLightviewLeft').style.display='block';
        document.getElementById('youtubeLightviewLeftContent').style.display='block';
    }
}

function closeYoutubeRight () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#youtubeLightviewRight').fadeOut();
        document.getElementById('youtubeLightviewRightContent').style.display='none';
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('youtubeLightviewRight').style.display='none';
        document.getElementById('youtubeLightviewRightContent').style.display='none';
    }
}

function openYoutubeRight () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#youtubeLightviewRight').fadeIn();
        jq('#youtubeLightviewRightContent').fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('youtubeLightviewRight').style.display='block';
        document.getElementById('youtubeLightviewRightContent').style.display='block';
    }
}

function displayYoutubeTop(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    youtubeId = 'statementyoutubetop-' + index
    youtubeIdContent = 'statementyoutubetopContent-' + index
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#' + youtubeId).fadeIn();
        jq('#' + youtubeIdContent).fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById(youtubeId).style.display='block';
        document.getElementById(youtubeIdContent).style.display='block';    
    }
}

function hideYoutubeTop(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    youtubeId = 'statementyoutubetop-' + index;
    youtubeIdContent = 'statementyoutubetopContent-' + index;
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#' + youtubeId).fadeOut();
        jq('#' + youtubeIdContent).fadeOut();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById(youtubeId).style.display='none';
        document.getElementById(youtubeIdContent).style.display='none';    
    }
}

function displayYoutubeDefault(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    youtubeId = 'statementyoutubedefault-' + index
    youtubeIdContent = 'statementyoutubedefaultContent-' + index
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#' + youtubeId).fadeIn();
        jq('#' + youtubeIdContent).fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById(youtubeId).style.display='block';
        document.getElementById(youtubeIdContent).style.display='block';    
    }
}

function hideYoutubeDefault(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    youtubeId = 'statementyoutubedefault-' + index
    youtubeIdContent = 'statementyoutubedefaultContent-' + index
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#' + youtubeId).fadeOut();
        jq('#' + youtubeIdContent).fadeOut();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById(youtubeId).style.display='none';
        document.getElementById(youtubeIdContent).style.display='none';    
    }
}

function openFlickrLeft () {
    document.getElementById('youtubeLightviewLeft').style.display='block';
    document.getElementById('youtubeLightviewLeftContent').style.width='500px';
}

function closeFlickrLeft () {
    document.getElementById('youtubeLightviewLeft').style.display='none';
    document.getElementById('youtubeLightviewLeftContent').style.width='0';
}

function openFlickrRight () {
    document.getElementById('youtubeLightviewRight').style.display='block';
    document.getElementById('youtubeLightviewRightContent').style.width='500px';
}

function closeFlickrRight () {
    document.getElementById('youtubeLightviewRight').style.display='none';
    document.getElementById('youtubeLightviewRightContent').style.width='0';
}

function displayFlickrTop(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    youtubeId = 'statementyoutubetop-' + index
    youtubeIdContent = 'statementyoutubetopContent-' + index
    document.getElementById(youtubeId).style.display='block';
    document.getElementById(youtubeIdContent).style.width='500px';    
}

function hideFlickrTop(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    youtubeId = 'statementyoutubetop-' + index;
    youtubeIdContent = 'statementyoutubetopContent-' + index;
    document.getElementById(youtubeId).style.display='none';
    document.getElementById(youtubeIdContent).style.width='0';    
}

function displayFLV(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    flvId = 'statementFlv-' + index;
    flvIdContent = 'statementFlvContent-' + index;
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#' + flvId).fadeIn();
        jq('#' + flvIdContent).fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById(flvId).style.display='block';
        document.getElementById(flvIdContent).style.display='block';    
    }
}

function hideFLV(obj) {
    var args = obj.className.split('-');
    var index = args[1];
    flvId = 'statementFlv-' + index;
    flvIdContent = 'statementFlvContent-' + index;
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#' + flvId).fadeOut();
        jq('#' + flvIdContent).fadeOut();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById(flvId).style.display='none';
        document.getElementById(flvIdContent).style.display='none';    
    }
}

function openFLVLeft () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#flvLightviewLeft').fadeIn();
        jq('#flvLightviewLeftContent').fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('flvLightviewLeft').style.display='block';
        document.getElementById('flvLightviewLeftContent').style.display='block';
    }
}

function closeFLVLeft () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#flvLightviewLeft').fadeOut();
        document.getElementById('flvLightviewLeftContent').style.display='none';
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('flvLightviewLeft').style.display='none';
        document.getElementById('flvLightviewLeftContent').style.display='none';
    }
}

function openFLVRight () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#flvLightviewRight').fadeIn();
        jq('#flvLightviewRightContent').fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('flvLightviewRight').style.display='block';
        document.getElementById('flvLightviewRightContent').style.display='block';
    }
}

function closeFLVRight () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#flvLightviewRight').fadeOut();
        document.getElementById('flvLightviewRightContent').style.display='none';
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('flvLightviewRight').style.display='none';
        document.getElementById('flvLightviewRightContent').style.display='none';
    }
}

function openFLV () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#flvtop').fadeIn();
        jq('#flvtopcontent').fadeIn();
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('flvtop').style.display='block';
        document.getElementById('flvtopcontent').style.display='block';    
    }
}

function closeFLV () {
    if (navigator.appName.indexOf("Explorer") == -1) {
        jq('#flvtop').fadeOut();
        document.getElementById('flvtopcontent').style.display='none';
    }
    if (navigator.appName.indexOf("Explorer") != -1) {
        document.getElementById('flvtop').style.display='none';
        document.getElementById('flvtopcontent').style.display='none';    
    }
}

function animateSlider() {
    jq('#sliderwrapper').animate({left: '-=499'},
                                 function () {
                                    wrapperObj = document.getElementById('sliderwrapper');
                                    children = jq('#sliderwrapper').children();
                                    firstChildId = children[0].id
                                    jq('#'+firstChildId).appendTo('#sliderwrapper');
                                    document.getElementById('sliderwrapper').style.left='0';
                                 }
                                 ); 
}

function fotostreckeForward(obj, lenBatches) {
    indexNext = parseInt(document.getElementById('imageRepeatNum').firstChild.nodeValue)
    if (indexNext <= lenBatches) {
        indexNext = indexNext + 1;
    }
    
    if (indexNext == lenBatches && indexNext > lenBatches) {
        indexNext = indexNext % lenBatches;
    }
    
    if (indexNext > lenBatches) {
        indexNext = (indexNext % lenBatches);
    }
    
    document.getElementById('imageRepeatNum').firstChild.nodeValue = indexNext;
       
    jq('#fotostreckewrapper').animate({left: '-=350'}, 1,
                                 function () {
                                    wrapperObj = document.getElementById('fotostreckewrapper');
                                    children = jq('#fotostreckewrapper').children();
                                    firstChildId = children[0].id
                                    jq('#'+firstChildId).appendTo('#fotostreckewrapper');
                                    document.getElementById('fotostreckewrapper').style.left='0';
                                 }
                                 ); 
}

function fotostreckeBack(obj, lenBatches) {
    indexPrevious = parseInt(document.getElementById('imageRepeatNum').firstChild.nodeValue)
    
    
    
    if (indexPrevious != 1) {
        indexPrevious = indexPrevious - 1
        document.getElementById('imageRepeatNum').firstChild.nodeValue = indexPrevious;
    } else {
        indexPrevious = lenBatches
    }
    
    document.getElementById('imageRepeatNum').firstChild.nodeValue = indexPrevious;
        
    jq('#fotostreckewrapper').animate({left: '+=350'}, 1,
                                 function () {
                                    wrapperObj = document.getElementById('fotostreckewrapper');
                                    children = jq('#fotostreckewrapper').children();
                                    lenChildren = children.length;
                                    lastChildId = children[lenChildren-1].id
                                    jq('#'+lastChildId).prependTo('#fotostreckewrapper');
                                    document.getElementById('fotostreckewrapper').style.left='0';
                                 }
                                 ); 
}

function setPreviewCSS() {
    document.getElementById('content-views').style.display='none'; 
    jq('.contentActions').css('display','none');
    jq('.documentContent').css('border','none');
    //jq('.documentContent').css('margin-top', -10); 
}

jq(document).ready(function(){
    jq('#edit_form_startDate_0_year').change(function() {
        var value = jq('#edit_form_startDate_0_year').find('option:selected').val();
        jq("#edit_form_endDate_1_year option[value=" + value + "]").attr('selected',true);
    });
    jq('#edit_form_startDate_0_month').change(function() {
        var value = jq('#edit_form_startDate_0_month').find('option:selected').val();
        jq("#edit_form_endDate_1_month option[value=" + value + "]").attr('selected',true);
    });
    jq('#edit_form_startDate_0_day').change(function() {
        var value = jq('#edit_form_startDate_0_day').find('option:selected').val();
        jq("#edit_form_endDate_1_day option[value=" + value + "]").attr('selected',true);
    });
    //jq('#edit_form_startDate_0_hour').change(function() {
    //    var value = jq('#edit_form_startDate_0_hour').find('option:selected').val();
    //    jq("#edit_form_endDate_1_hour option[value=" + value + "]").attr('selected',true);
    //});
    //jq('#edit_form_startDate_0_minute').change(function() {
    //    var value = jq('#edit_form_startDate_0_minute').find('option:selected').val();
    //    jq("#edit_form_endDate_1_minute option[value=" + value + "]").attr('selected',true);
    //});
});






