//Solution : to launch the “.corner()” into the “$(window).load(function(){}” and NOT INTO “$(document).ready(function(){}”


window.onload = function() {
 $('.tenpxcorner').corner('10px');
 $('.tenpxcorner2').corner('10px');
 $('.cornertop').corner('10px top');
 $('.cornerbottom').corner('10px bottom');
 $('.cornerleft').corner('10px tl bl');
 $('div.smallpics').corner('10px');
 $('li.mainpics').corner('10px');
}	



// automatically create external link class and open in new window if link is not local or ID anchor
$(document).ready(function(){
    $("a[@href^='http']").not("[@href*=http://da.designwiese.at]").not("[href^=#]").not("[href*=http://designwiese.at]").addClass("external-link").attr('target','_blank');
}); 



function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });
    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });
    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        scroll: 1,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });



    $('#blogroll').tabs();
	$('#allerlei').tabs();
	$('#sonstiges').tabs();
				
	$('.pretty').tooltip({
		track: true,
		delay: 0,
		showBody: " - ",
		extraClass: "pretty",
		showURL: false,
		left: -120
	});
	$('.pretty2').tooltip({
		track: true,
		delay:0,
		showBody: " - ",
		extraClass: "pretty2",
		showURL: false,
	    fade: 250,left: -125
	});
	$('.ext_links').tooltip({
		track: true,
		delay: 0,
		extraClass: "ext_links",
		showURL: true,
		left: -80
	});
	

	var expandform = 0;
	var expandlist = 0;
	$('h4#toggleform').click(function () {
      $("div#commentform").slideToggle("normal");
      if(expandform == 0) { 
      	document.getElementById('toggleform').className="collapse";
      	expandform = 1;
		return false;
      	}
      if(expandform == 1) {
        document.getElementById('toggleform').className="expand";
      	expandform = 0;  
		return false;
      }
    });

	$('h4#togglelist').click(function () {
      $("div#comments").slideToggle("normal");
      if(expandlist == 0) { 
      	document.getElementById('togglelist').className="collapse";
      	expandlist = 1;
		return false;
      	}
      if(expandlist == 1) {
        document.getElementById('togglelist').className="expand";
      	expandlist = 0;  
		return false;
      }
    });

/*	var myurl = document.URL;
	var mysearch = myurl.search(/#blabla/);
	if(mysearch != -1) {
      	$("div#comments").slideToggle("normal");
      	document.getElementById('togglelist').className="collapse";
      	expandlist = 1;  
	  	exit;
	}
*/
	$('#togglesuche').click(function () {
      $("#suche").slideToggle("normal");
    });



});

