$(document).ready(function()
{
 // create tabs logic for content
 var TabsArray = new Array('tab-1','tab-2','tab-3','tab-4');

 for (var i = 1; i < TabsArray.length; i++) {
        $('#'+TabsArray[i]).hide();
        }

 // $('#tabscontent div').hide(); // hides all divs - unfortunately also good ones
 // $('#tabscontent div:first').show(); // Show the first div
 $('#tabs ul li a').click(
          function() //When any link is clicked
          {
           $('#tabs ul li').removeClass('active'); // Remove active class from all links
           $(this).parent().addClass('active'); // Set clicked link class to active
           var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
           //var currentnewTab = currentTab.replace(/\?/g, "#");
           //currentTab = currentnewTab.replace(/=true/g, "");
           //$('#tabscontent div').hide(); // Hide all divs
           for (i = 0; i < TabsArray.length; i++) {
                if ( currentTab != '#'+TabsArray[i] ) {
                        $('#'+TabsArray[i]).hide();

                } else {
                        $(currentTab).show();
                }
           }
           return false;
          });
 // create lightbox logic
 $('#gallery a').lightBox();
 $('a[@rel*=lightbox]').lightBox();
 $('img[@rel*=lightbox]').lightBox();

});

function showMyVideos2(data) {
  // show youtube videos
  var feed = data.feed;
  var entries = feed.entry || [];
  var html = '<ul class="videos">';
  for (var i = 0; i < entries.length; i++) {
    var entry = entries[i];
    var title = entry.title.$t.substr(0, 20);
    var thumbnailUrl = entries[i].media$group.media$thumbnail[0].url;
    var videoUrl = entries[i].media$group.media$content[0].url;
    html += '<li style="clear:both;float:none;"><a href="' + videoUrl + '" target="_blank"><img src="' +
        thumbnailUrl + '" style="margin:5px;float:left;" width="130" height="97" /> ' + title + '</a></li>';
  }
  html += '</ul><br style="clear: left;"/>';
  document.getElementById('vjson').innerHTML = html;
}

/* linksending */
function openlinksending()
{
	url = "/portalnode/?do=3000&ls_windowtype=popup&source=" + this.location.href + "&langu=";
	window.open(url,'nodeeditor','dependent=yes,status=yes,scrollbars=no,width=350,height=350,resizable=no');
}

/* pagesending */
function openlinksending2()
{
        url = "/portalnode/?do=3000&LS_URLONLY=1&ls_windowtype=popup&source=" + this.location.href + "&langu=";
        window.open(url,'nodeeditor','dependent=yes,status=yes,scrollbars=no,width=350,height=350,resizable=no');
}

/* comment */
function opencomment( keyid )
{
	url = "/service/comment.php?pageid="+keyid+"#lenter";
	window.open(url,'commentwin','dependent=yes,status=yes,scrollbars=yes,width=350,height=350,resizable=yes');
}

/* Textbildpopup */
function popup(hosturl,picurl,picid)
{
	window.open("/Content.Node/service/textbildpopup.php?host="+hosturl+"&bildurl="+picurl+"&id="+picid+"","Bildfenster","location=no,toolbar=no,status=no,menubar=no,resizable=yes");
}
