// JS Functions für Crazycolors
// Markus Schott
// schottmarkus.de

//öhmm einmal jQuery bitte
//google.load("jquery", "1.5.0");


//jQuery vs. Mootools FIGHT!
jQuery.noConflict();


var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
if(win.focus){win.focus();}}
function CloseNewWin(){if(win!=null && win.open)win.close()}



jQuery(document).ready(function(){

	jQuery.preLoadImages("tl_files/cc/images/hintergrundbilder/bg1.jpg");

	jQuery('body.startseite #container').css({opacity: '0'});
	jQuery('body.startseite #container').animate({
		opacity: 1,
	}, 700);
	
	jQuery('body.unterseite #container').css({opacity: '0'});
	jQuery('body.unterseite #container').css({bottom: '-15px'});
	
	jQuery('body.unterseite #container').animate({
		opacity: 1,
		bottom: 0
	}, 400);
	
	jQuery("#jquery_jplayer_1").jPlayer({
		ready: function () {
			jQuery(this).jPlayer("setMedia", {
				mp3: "tl_files/cc/RayBanton-CrazyColors.mp3"
			}).jPlayer("pause");
		},
		ended: function (event) {
			jQuery(this).jPlayer("pause");
		},
		swfPath: "tl_files/cc/js/",
		supplied: "mp3"
	});


    //Bg Stretcher Plugin	   
    jQuery(document).bgStretcher({
    	images: ['tl_files/cc/images/hintergrundbilder/bg1.jpg', 'tl_files/cc/images/hintergrundbilder/bg2.jpg','tl_files/cc/images/hintergrundbilder/bg3.jpg','tl_files/cc/images/hintergrundbilder/bg4.jpg','tl_files/cc/images/hintergrundbilder/bg5.jpg'],
    	imageWidth: 1280, imageHeight: 1024, nextSlideDelay: 10000, slideShowSpeed: 'normal'
    });
    
    jQuery('.thin').columnize({ columns: 2, lastNeverTallest: 'true' });    

});

(function(jQuery) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  jQuery.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)
