/*-------------------- /projects/73/templates/js/main.js --------------------*/
/*
    Document   : main.js
    Created on : 08.04.2011, 11:31:35
    Description:
        Basis javascript Datei  
*/

Cufon.replace('.cufon' );

(function($) {
  jQuery.fn.backgroundPosition = function() {
    var p = $(this).css('background-position');
    if(typeof(p) == 'undefined') return [$(this).css('background-position-x'),$(this).css('background-position-y')];
    else return p.split(' ');
  };
})(jQuery);


$(document).ready(function () {

	var bgid = 'bgImage';
	var bgPause = 3000 ;
	var bgFadeTime = 3000 ;

	bgSlider(bgid, bgPause, bgFadeTime);


//    $(['/projects/73/images/bg1.jpg','/projects/73/images/bg2.jpg','/projects/73/images/bg3.jpg','/projects/73/images/bg4.jpg','/projects/73/images/bg5.jpg','/projects/73/images/bg6.jpg']).bgSlider2({
//
//	});
//    $(['/projects/73/images/bg1.jpg','/projects/73/images/bg2.jpg','/projects/73/images/bg3.jpg','/projects/73/images/bg4.jpg','/projects/73/images/bg5.jpg','/projects/73/images/bg6.jpg']).bgSlider({
//		slideshow:true,
//		interval:5000,
//		speed:2000, preload:true
//	})

	$('#TopNav ul li a').css('opacity',0.9);
	
	menuHover();
	initPrettyFoto();
 

	$('.footerarea .labels li a span.over').css({'opacity':0});
	$('.footerarea .labels li a').hover(function(){
		$(this).find('.over').stop().animate({'opacity':1}, 500) ;
	}, function(){
		$(this).find('.over').stop().animate({'opacity':0}, 5000) ;
	});

	$('.releasepager_back').live('click',function(){
		var page = $(this).attr('page');
		var ele = $(this).attr('ele');
		var label_filter = $(this).attr('label_filter');
		var template = $(this).attr('template');
		var ishome = $(this).attr('ishome');
		var limit = $(this).attr('limit');
		//console.log(ele);
		$('#'+ele).load('/projects/index.php?id='+XDCMS.project_id+'&modul=music&controller=releases&template='+template+'&ishome='+ishome+'&ajax=1&limit='+limit+'&label_filter='+label_filter+'&page='+page);
	});

	$('.releasepager_next').live('click',function(){
		var page = $(this).attr('page');
		var ele = $(this).attr('ele');
		var label_filter = $(this).attr('label_filter');
		var template = $(this).attr('template');
		var ishome = $(this).attr('ishome');
		var limit = $(this).attr('limit');
		//console.log(ele);
		$('#'+ele).load('/projects/index.php?id='+XDCMS.project_id+'&modul=music&controller=releases&template='+template+'&ishome='+ishome+'&ajax=1&limit='+limit+'&label_filter='+label_filter+'&page='+page);
	});

	$('.artistpager_next').live('click',function(){
		var page = $(this).attr('page');
		$('#artistsajax').load('/projects/index.php?id='+XDCMS.project_id+'&modul=music&controller=artists&template=artists_liste.html&ajax=1&limit=20&onlywithimage=1&page='+page);
	});
	$('.artistpager_back').live('click',function(){
		var page = $(this).attr('page');
		$('#artistsajax').load('/projects/index.php?id='+XDCMS.project_id+'&modul=music&controller=artists&template=artists_liste.html&ajax=1&limit=20&onlywithimage=1&page='+page);
	});

	$('#scrollable').jScrollPane({
		enableKeyboardNavigation: false,
		scrollbarMargin: 5,
		scrollbarWidth:13
	});


	$('.playerItem').each(function(idx, elem) {
        var item = $(elem);
        var mp3path = item.attr("alt");
        var pid = "gapl" + idx;
        item.prepend('<div id="' + pid + '"></div>');
        var so = new SWFObject("/projects/73/images/ctrlButton.swf", "F"+pid, "40", "30", "9");
        so.addVariable("pid", "F"+pid);
		so.addVariable("mp3_path", mp3path);
		so.addVariable("wmode", "transparent");
		so.write(pid);
	});
	if ($.browser.msie)
    	plItems = $('.playerItem OBJECT');
    else
        plItems = $('.playerItem embed');
});

var plItems;

/** This function stops other player on website,
 * so only one is playing at a time.
 **/
var js_playTune = function js_playTune(pid) {
    plItems.each(function(idx, elem) {
        var gp = $(elem);
        if (gp.attr('id') !== pid) {
            window.document["Fgapl"+idx].halt();
        }
    });
}

function bgSlider(bgid, bgPause, bgFadeTime) {
    var $active = $('#'+bgid+' img.active');
    //if ( $active.length == 0 ) $active = $('#'+bgid+' img:first');
    var $next =  $active.next().length ? $active.next() : $('#'+bgid+' img:first');
	$next.delay(bgPause).css({opacity: 0}).addClass('active')
	.animate({opacity: 1.0}, bgFadeTime, function() {
		$active.removeClass('active');
 		bgSlider(bgid, bgPause, bgFadeTime);
    });
}


function ajax_trackimage(image_id){ }

function slideshow(){ }

function menuHover(){
		$('#TopNav li a').each(function(){
			var size = 1.1 ;

			var oldSize = $(this).css('fontSize'), oldLSize = $(this).css('lineHeight');
			var newSize = parseInt(oldSize)*size+'px';
			var c = $(this).parent().attr('class');
			var color1, color2;
			if(c=="active"){
				color1 = "#1f1f1f" ;
				color2 = "#ffffff" ;
			} else {
				color1 = "#ffffff" ;
				color2 = "#1f1f1f" ;
			}
			$(this).hover(function(){
				$(this).stop().animate({
					'fontSize':newSize,
					'lineHeight':newSize,
					color: color1,
					backgroundColor: color2
				},400);
			},function(){
				$(this).stop().animate({
					'fontSize':oldSize,
					'lineHeight':oldLSize,
					color: color2,
					backgroundColor: color1
				},200) ;
			}).click(function(){
				$('#Content').slideUp(400, function(){
					$(this).remove()
				});

				//return false;
			});
		});
	}

function initPrettyFoto(){
	/*-------------------------------------------------------------------------
	   prettyPhoto
	---------------------------------------------------------------------------*/
	$("a[rel^='prettyOverlay'],a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal',
			opacity: 0.55,
			showTitle: true,
			allowresize: true,
			counter_separator_label: '/' ,
			theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
		});
}
 
/*-------------------- /projects/73/templates/js/mp3-player-button.js --------------------*/
/*

  SoundManager 2 Demo: Play MP3 links via button
  ----------------------------------------------

  http://schillmania.com/projects/soundmanager2/

  A simple demo making MP3s playable "inline"
  and easily styled/customizable via CSS.

  A variation of the "play mp3 links" demo.

  Requires SoundManager 2 Javascript API.

*/

function BasicMP3Player() {
  var self = this;
  var pl = this;
  var sm = soundManager; // soundManager instance
  this.excludeClass = 'button-exclude'; // CSS class for ignoring MP3 links
  this.links = [];
  this.sounds = [];
  this.soundsByURL = [];
  this.indexByURL = [];
  this.lastSound = null;
  this.soundCount = 0;
  var isIE = (navigator.userAgent.match(/msie/i));

  this.config = {
    playNext: false, // stop after one sound, or play through list until end
	autoPlay: false  // start playing the first sound right away
  }

  this.css = {
    // CSS class names appended to link during various states
    sDefault: 'sm2_button', // default state
    sLoading: 'sm2_loading',
    sPlaying: 'sm2_playing',
    sPaused: 'sm2_paused'
  }

  this.includeClass = this.css.sDefault;


  this.addEventHandler = function(o,evtName,evtHandler) {
    typeof(attachEvent)=='undefined'?o.addEventListener(evtName,evtHandler,false):o.attachEvent('on'+evtName,evtHandler);
  }

  this.removeEventHandler = function(o,evtName,evtHandler) {
    typeof(attachEvent)=='undefined'?o.removeEventListener(evtName,evtHandler,false):o.detachEvent('on'+evtName,evtHandler);
  }

  this.classContains = function(o,cStr) {
	return (typeof(o.className)!='undefined'?o.className.match(new RegExp('(\\s|^)'+cStr+'(\\s|$)')):false);
  }

  this.addClass = function(o,cStr) {
    if (!o || !cStr || self.classContains(o,cStr)) return false;
    o.className = (o.className?o.className+' ':'')+cStr;
  }

  this.removeClass = function(o,cStr) {
    if (!o || !cStr || !self.classContains(o,cStr)) return false;
    o.className = o.className.replace(new RegExp('( '+cStr+')|('+cStr+')','g'),'');
  }

  this.getSoundByURL = function(sURL) {
    return (typeof self.soundsByURL[sURL] != 'undefined'?self.soundsByURL[sURL]:null);
  }

  this.isChildOfNode = function(o,sNodeName) {
    if (!o || !o.parentNode) {
      return false;
    }
    sNodeName = sNodeName.toLowerCase();
    do {
      o = o.parentNode;
    } while (o && o.parentNode && o.nodeName.toLowerCase() != sNodeName);
    return (o.nodeName.toLowerCase() == sNodeName?o:null);
  }

  this.events = {

    // handlers for sound events as they're started/stopped/played

    play: function() {
      pl.removeClass(this._data.oLink,this._data.className);
      this._data.className = pl.css.sPlaying;
      pl.addClass(this._data.oLink,this._data.className);
    },

    stop: function() {
      pl.removeClass(this._data.oLink,this._data.className);
      this._data.className = '';
    },

    pause: function() {
      pl.removeClass(this._data.oLink,this._data.className);
      this._data.className = pl.css.sPaused;
      pl.addClass(this._data.oLink,this._data.className);
    },

    resume: function() {
      pl.removeClass(this._data.oLink,this._data.className);
      this._data.className = pl.css.sPlaying;
      pl.addClass(this._data.oLink,this._data.className);      
    },

    finish: function() {
      pl.removeClass(this._data.oLink,this._data.className);
      this._data.className = '';
      if (pl.config.playNext) {
        var nextLink = (pl.indexByURL[this._data.oLink.href]+1);
        if (nextLink<pl.links.length) {
          pl.handleClick({'target':pl.links[nextLink]});
        }
      }
    }

  }

  this.stopEvent = function(e) {
   if (typeof e != 'undefined' && typeof e.preventDefault != 'undefined') {
      e.preventDefault();
    } else if (typeof event != 'undefined' && typeof event.returnValue != 'undefined') {
      event.returnValue = false;
    }
    return false;
  }

  this.getTheDamnLink = (isIE)?function(e) {
    // I really didn't want to have to do this.
    return (e && e.target?e.target:window.event.srcElement);
  }:function(e) {
    return e.target;
  }

  this.handleClick = function(e) {
    // a sound link was clicked
    if (typeof e.button != 'undefined' && e.button>1) {
	  // ignore right-click
	  return true;
    }
    var o = self.getTheDamnLink(e);
    if (o.nodeName.toLowerCase() != 'a') {
      o = self.isChildOfNode(o,'a');
      if (!o) return true;
    }
    var sURL = o.getAttribute('href');
    if (!o.href || !soundManager.canPlayLink(o) || self.classContains(o,self.excludeClass)) {
      return true; // pass-thru for non-MP3/non-links
    }
    if (!self.classContains(o,self.includeClass)) {
      return true;
    }
    sm._writeDebug('handleClick()');
    var soundURL = (o.href);
    var thisSound = self.getSoundByURL(soundURL);
    if (thisSound) {
      // already exists
      if (thisSound == self.lastSound) {
        // and was playing (or paused)
        thisSound.togglePause();
      } else {
        // different sound
        thisSound.togglePause(); // start playing current
        sm._writeDebug('sound different than last sound: '+self.lastSound.sID);
        if (self.lastSound) self.stopSound(self.lastSound);
      }
    } else {
      // create sound
      thisSound = sm.createSound({
       id:'basicMP3Sound'+(self.soundCount++),
       url:soundURL,
       onplay:self.events.play,
       onstop:self.events.stop,
       onpause:self.events.pause,
       onresume:self.events.resume,
       onfinish:self.events.finish
      });
      // tack on some custom data
      thisSound._data = {
        oLink: o, // DOM node for reference within SM2 object event handlers
        className: self.css.sPlaying
      };
      self.soundsByURL[soundURL] = thisSound;
      self.sounds.push(thisSound);
      if (self.lastSound) {
        // stop last sound
	    self.stopSound(self.lastSound);
	  }
      thisSound.play();
    }

    self.lastSound = thisSound; // reference for next call

    if (typeof e != 'undefined' && typeof e.preventDefault != 'undefined') {
      e.preventDefault();
    } else {
      event.returnValue = false;
    }
    return false;
  }

  this.stopSound = function(oSound) {
    soundManager.stop(oSound.sID);
    soundManager.unload(oSound.sID);
  }

  this.init = function() {
    sm._writeDebug('basicMP3Player.init()');
    var oLinks = document.getElementsByTagName('a');
    // grab all links, look for .mp3
    var foundItems = 0;
    for (var i=0, j=oLinks.length; i<j; i++) {
      if (self.classContains(oLinks[i],self.css.sDefault) && !self.classContains(oLinks[i],self.excludeClass)) {
        // self.addClass(oLinks[i],self.css.sDefault); // add default CSS decoration - good if you're lazy and want ALL MP3/playable links to do this
        self.links[foundItems] = (oLinks[i]);
        self.indexByURL[oLinks[i].href] = foundItems; // hack for indexing
        foundItems++;
      }
    }
    if (foundItems>0) {
      self.addEventHandler(document,'click',self.handleClick);
	  if (self.config.autoPlay) {
	    self.handleClick({target:self.links[0],preventDefault:function(){}});
	  }
    }
    sm._writeDebug('basicMP3Player.init(): Found '+foundItems+' relevant items.');
  }

  this.init();

}

var basicMP3Player = null;

// soundManager.url = '../../swf/'; // path to directory containing SM2 SWF files

soundManager.onready(function() {
  // soundManager.createSound() etc. may now be called
  basicMP3Player = new BasicMP3Player();
});
/*-------------------- /projects/73/templates/js/swfobject.js --------------------*/
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
/*--------------------------------------------------------------------------------
sum bytes: 20420 (20 KB)
--------------------------------------------------------------------------------*/

