jQuery.noConflict();

(function($){
	jQuery.fn.idle = function(time)
	{
		var o = $(this);
		o.queue(function()
		{
			setTimeout(function()
			{
				o.dequeue();
			}, time);
		});
	};
})(jQuery);

jQuery(document).ready(function() {

  //jQuery('div.header-fade-item-image').ifixpng();
  //jQuery('div.header-fade-item-text').ifixpng();
	jQuery('#fallstudien-modul').cycle({
    fx:     'scrollUp',
    timeout: 6000,
    delay:  -2000
  });

	jQuery("form").jqTransform();


 jQuery('#nav .hlist ul li').mouseover(function() {
  jQuery(this).children('ul').show();
  jQuery(this).children('a').css('background-position','left top');
  jQuery(this).children('ul').css('opacity',0.9);
  jQuery(this).children('a').css('background-color', '#fff');

 });
 jQuery('#nav .hlist ul li').mouseout(function() {
  jQuery(this).children('ul').hide();
  if(!jQuery(this).hasClass('active'))
  jQuery(this).children('a').css('background-position','left -30px');
  jQuery(this).children('a').css('background-color', '#ccc');
 });


 	showPerson(1, 1);





});
function showPerson(num, i) {


	jQuery('#header-fade-item-'+num).show();

	var persons = jQuery('#header-fade-item-'+num).children().size();
	var items = jQuery('#header-flash').children().size();

		var timeout1  = 2000;
		var timeout2  = 4000;

    //if (navigator.appName == 'Microsoft Internet Explorer') {
      //$jQuery('.header-fade-item-image, .header-fade-item-text').fixPNG();
		//}
		//if ($.browser.msie && $.browser.version <= 7) {
			DD_belatedPNG.fix('.header-fade-item-image');
			DD_belatedPNG.fix('.header-fade-item-text');


		//}
		
		//jQuery('.header-fade-item-image').fixPNG();
		//jQuery('.header-fade-item-text').fixPNG();

		setTimeout(function(){
			jQuery('#header-fade-item-'+num+' #header-fade-person-'+i+' .header-fade-item-image').show('slow');
			
		}, timeout1);

		setTimeout(function(){
			jQuery('#header-fade-item-'+num+' #header-fade-person-'+i+' .header-fade-item-text').show('slow');

		}, timeout2);


		setTimeout(function(){
			i++;
			if(i <= persons) {
				showPerson(num, i);
			} else {
				setTimeout(function(){
					jQuery('#header-fade-item-'+num).hide();
					jQuery('.header-fade-item-image').hide();
					jQuery('.header-fade-item-text').hide();
					num++;
					if(num <= items) {
						showPerson(num, 1);
					} else {
						showPerson(1, 1);
					}
				}, '10000');
			}
		}, timeout2);
}


/*Alternative png Fix*/
(function($) {

	$.fn.fixPNG = function() {
		return this.each(function () {
			var image = $(this).css('backgroundImage');

			if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
				image = RegExp.$1;
				$(this).css({
					'backgroundImage': 'none',
					'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=" + ($(this).css('backgroundRepeat') == 'no-repeat' ? 'crop' : 'scale') + ", src='" + image + "')"
				}).each(function () {
					var position = $(this).css('position');
					if (position != 'absolute' && position != 'relative')
						$(this).css('position', 'relative');
				});
			}
		});
};
})(jQuery);


/*function showPerson() {
	jQuery('#header-fade-item-1').show();
	jQuery('#header-fade-person-1 .header-fade-item-image').show('slow');
	setTimeout(function(){
		jQuery('#header-fade-person-1 .header-fade-item-text').show('slow');
	}, '2000');

	setTimeout(function(){
		jQuery('#header-fade-person-2 .header-fade-item-image').show('slow');
    }, '4000');
	setTimeout(function(){
		jQuery('#header-fade-person-2 .header-fade-item-text').show('slow');
	}, '6000');

	setTimeout(function(){
		jQuery('#header-fade-person-3 .header-fade-item-image').show('slow');
    }, '8000');
	setTimeout(function(){
		jQuery('#header-fade-person-3 .header-fade-item-text').show('slow');
	}, '10000');
	setTimeout(function(){
		jQuery('.header-fade-item').hide();
	}, '14000');



	setTimeout(function(){
		jQuery('#header-fade-item-2').show();
	}, '14000');

	setTimeout(function(){
		jQuery('#header-fade-person-4 .header-fade-item-image').show('slow');
	}, '15000');

	setTimeout(function(){
		jQuery('#header-fade-person-4 .header-fade-item-text').show('slow');
	}, '17000');

	setTimeout(function(){
		jQuery('#header-fade-person-5 .header-fade-item-image').show('slow');
    }, '19000');
	setTimeout(function(){
		jQuery('#header-fade-person-5 .header-fade-item-text').show('slow');
	}, '21000');

	setTimeout(function(){
		jQuery('#header-fade-person-6 .header-fade-item-image').show('slow');
    }, '23000');
	setTimeout(function(){
		jQuery('#header-fade-person-6 .header-fade-item-text').show('slow');
	}, '25000');
	setTimeout(function(){
		jQuery('.header-fade-item').hide();
	}, '27000');
	showPersons();
}*/



jQuery.fn.wait = function(time, type) {
    time = time || 1000;
    type = type || "fx";
    return this.queue(type, function() {
        var self = this;
        setTimeout(function() {
            $(self).dequeue();
        }, time);
    });
};

