/*
  JS Grundfunktionen | © 2010 by redwave-mode.de
____________________________________________ */

jQuery(function() {

	jQuery.fn.RedWaveMode = function(settings) {
		settings = jQuery.extend( {

      setupAnimationsZeit: '500' // Durschnittliche Zeit aller Animationen

  	},settings);

// --------------------- Prospekt Overlay -------------------------

    jQuery("#pro_bg").css('opacity', '0.7');

    jQuery("#home_latest area, #home_open_prospect, #r_sidebar #latest").click(function() {

      jQuery("#pro_bg, #pro_overlay").fadeIn(settings.setupAnimationsZeit);

      /*jQuery("#pro_prospect").flash({
          src: 'http://www.redwave-mode.de/pageflip/pageflip.swf',
          width: 925,
          height: 540
      });*/
      
    });

    jQuery("#pro_overlay, #pro_close").click( function() {
      jQuery("#pro_bg, #pro_overlay").fadeOut(settings.setupAnimationsZeit);
      //jQuery("#pro_prospect iframe").remove();
    });

    jQuery("#pro_prospect").click( function() {
      return false;
    });

// ----------------------- TABLES ------------------------------------

    jQuery(".result_table tr:nth-child(odd) td")
      .addClass('tr_nth_child');
      
    jQuery("#portfolio").innerfade({ speed: 1000, timeout: 3000, type: 'sequence', containerheight: '700px' });
      
// ------------- DISABLE RIGHTCLICK CONTEXT-MENUE --------------------

  	jQuery.extend(jQuery.fn, {
  		rightClick: function(handler) {
  			jQuery(this).each( function() {
  				jQuery(this).mousedown( function(e) {
  					var evt = e;
  					jQuery(this).mouseup( function() {
  						jQuery(this).unbind('mouseup');
  						if( evt.button == 2 ) {
  							handler.call( jQuery(this), evt );
  							return false;
  						} else {
  							return true;
  						}
  					});
  				});
  				jQuery(this)[0].oncontextmenu = function() {
  					return false;
  				}
  			});
  			return jQuery(this);
  		},
  		rightMouseDown: function(handler) {
  			jQuery(this).each( function() {
  				jQuery(this).mousedown( function(e) {
  					if( e.button == 2 ) {
  						handler.call( jQuery(this), e );
  						return false;
  					} else {
  						return true;
  					}
  				});
  				jQuery(this)[0].oncontextmenu = function() {
  					return false;
  				}
  			});
  			return jQuery(this);
  		},
  		rightMouseUp: function(handler) {
  			jQuery(this).each( function() {
  				jQuery(this).mouseup( function(e) {
  					if( e.button == 2 ) {
  						handler.call( jQuery(this), e );
  						return false;
  					} else {
  						return true;
  					}
  				});
  				jQuery(this)[0].oncontextmenu = function() {
  					return false;
  				}
  			});
  			return jQuery(this);
  		},
  		noContext: function() {
  			jQuery(this).each( function() {
  				jQuery(this)[0].oncontextmenu = function() {
  					return false;
  				}
  			});
  			return jQuery(this);
  		}
  	});
    jQuery("img").noContext();
    
  };

  // Activate RedWaveMode if HTML is ready
  jQuery("html").RedWaveMode();

});