$(document).ready(function() {
	$('body').removeClass('noscript');
// bilder colorbox
         $('a.fensterln').colorbox({transition:"elastic"});
         $('a.dailyiphone').colorbox({transition:"elastic", width:"530px", height:"435px"});
//sidebar


$('#commentform label').hide().each(function () {
var einf = $(this).text();
$(this).next().css({'margin-top':'15px'})
		.val(einf)
                 .focus(function() {
                         if ($(this).val() == einf) {
				$(this).val('');
			}
                 })
                 .blur(function(){
                         if ($.trim($(this).val()) == '') {
				$(this).val(einf).removeClass('bearbeitet');
			   } else {
                                 $(this).addClass('bearbeitet');
                            }
                 })
});

var msie6 = $.browser == 'msie' && $.browser.version < 7;

if (!msie6) {


           var top = $('#postcomment').offset().top;
           var kante = $('#sidebar').offset().top - $('#postcomment').height() - 30;

           $(window).scroll(function (event) {

           	var posthoehe = $('#content').height();
            	var viewport = $(window).width();
                 if (viewport >= 980 && posthoehe >= 710){

                     var y = $(this).scrollTop();

                      if (y < top) {
                      $('#postcomment').css({'position':'absolute','top':'0','width':'320px'});
                      }
                     if (y >= top && y <= kante) {
                       $('#postcomment').css({'position':'fixed','top':'0','width':'320px'});
                     }
                      if (y > kante) {
                        $('#postcomment').css({'position':'absolute','top': kante - 205,'width':'320px'});
                      }
                  }

           });

	}

 //scroll innerhalb
 $('a[href*=#]').click(function() {
 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
 && location.hostname == this.hostname) {
   var $target = $(this.hash);
   $target = $target.length && $target
   || $('[name=' + this.hash.slice(1) +']');
   if ($target.length) {
  var targetOffset = $target.offset().top;
  $('html,body')
  .animate({scrollTop: targetOffset}, 900);
    return false;
   }
 }
  });


});