var currentTime = new Date()
var time = currentTime.getTime();
var j = jQuery.noConflict();
var currentMenu = "";




	function toggleMenu(menuId) {
	    
		hideMenus(menuId);
		j('#menu'+menuId+' ul li').toggle();
		
		
		if(j('#menu'+menuId+' ul').attr('class') == 'active') {
			j('#menu'+menuId+' ul').removeClass('active');
		}
		else {
		    j('#menu'+menuId+' ul').addClass('active');
		}
		
		if(menuId == 6) {
			j("#menu6 li ul").append('<li class="search_result">&nbsp;</li>');
		}
		
	}
	
	function init() {
	
		
		j(".box1").addClass('box1_aan');
		j(".textbox_black").addClass('textbox_black_aan');
	
		j('div').each(function() {
		
		   if(this.className == 'movie' || this.className == 'podcast' || this.className == 'flickr_slides') {
			
				var height = ($(this).height())/2 - 26;
				var width = ($(this).width())/2 - 24;
				j(this).find("#play").css('top',height);
				j(this).find("#play").css('left',width);
				j(this).find("#play").show();
				
			}
			
		});
		
		j("#logo").click(function() {   j("#logo").fadeOut('fast');  });
		centerLogo();
		

	}
	

	function hideMenus(currentMenuId) {
	
		j(".search_result").remove();
	
	    for(i=1;i < 7;i++) {
		
		    if(currentMenuId != i) {
				j('#menu'+i+' ul li').hide();
				j('#menu'+i+' ul').removeClass('active');
			}
			
		}
	   
	}
	

   function resetForm() {
      document.search_artist.artist.value = "";
   }
	
	function searchArtist(value) {
	 
	 
		var value =document.search_artist.artist.value;
		//alert(value);
		if(value.length > 2) {

			  j.get("search/artists.php?search_value="+value, function(data){
					
					if(data != '') {
						//alert(data);
						j(".search_result").html(data); 
						j(".search_result").show();
					
					}
					else {
						j(".search_result").hide();
					}
				 
				});
			
		}
		else {
		    
		    j(".search_result").hide();
		}
	    
	}
	
	function centerLogo() {
	   
	    
		var logoHeight = (j(document).height() - 911) / 2;
		j('#logo').css({
          position: 'absolute',
          marginTop: '0',
          top: logoHeight
        });
		
		j('#logo').show();
	    
	}
	
	function closePopup() {
	   
	     j('div.wrap').hide();
		 j('div.box').html('');
		 
	}
	
	function openFlickrSlideShow(setId) {
	   
	    j('div.box').html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="530" id="slideShow" align="middle">'+
		'<param name="allowScriptAccess" value="sameDomain" />'+
		'<param name="FlashVars" value="setId='+setId+'">'+
		'<param name="movie" value="slideShow.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />'+
		'<embed FlashVars="setId='+setId+'" src="slideShow.swf" quality="high" bgcolor="#000000" width="640" height="530" name="slideShow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
		'</object>');
		
		//j('div.box').html('<iframe align="center" src="http://www.flickr.com/slideShow/index.gne?set_id='+setId+'&" frameBorder="0" width="500" height="500" scrolling="no"></iframe>'); 
		
		j('div.wrap').css({"position" : "absolute", "left" : 100});
		 j('div.wrap').vCenter();     
		j('div.wrap').show();
		 
	}
	
	function openYouTube(url) {
	   
	    j('div.box').html('<object bgcolor="#000000" width="425" height="344"><param name="bgcolor" value="#000000"></param><param name="movie" value="http://www.youtube.com/v/'+url+'&hl=nl&fs=1&autoplay=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'+url+'&hl=nl&fs=1&autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>');	
		j('div.wrap').css({"position" : "absolute", "left" : 100});
		
		 j('div.wrap').vCenter();     
		j('div.wrap').show();
		 
	}
	
	function replaceDialog() {
	   j('div.wrap').vCenter();  
	}
	
	(function(j){
  j.fn.vCenter = function(options) {
    var pos = {
      sTop : function() {
        return window.pageYOffset || document.documentElement && document.documentElement.scrollTop ||	document.body.scrollTop;
      },
      wHeight : function() { 
        return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight;
      }
    };
    return this.each(function(index) {
      if (index == 0) {
        var $this = j(this);
        var elHeight = $this.height();
		    var elTop = pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2);
        $this.css({
          position: 'absolute',
          marginTop: '0',
          top: elTop
        });


      }
    });
  };

})(jQuery);
	
	
	/*!
 * liScroll 1.0
 * Examples and documentation at: 
 * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html
 * 2007-2009 Gian Carlo Mingati
 * Version: 1.0.1 (07-DECEMBER-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires:
 * jQuery v1.2.x or later
 * 
 */


jQuery.fn.liScroll = function(settings) {
		settings = jQuery.extend({
		travelocity: 0.01
		}, settings);		
		return this.each(function(){
				var $strip = jQuery(this);
				//$strip.addClass("newsticker")
				var stripWidth = 0;
				//var $mask = $strip.wrap("<div class='mask'></div>");
				//var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");								
				var containerWidth = 613;//$strip.parent().parent().width();	//a.k.a. 'mask' width 	
				//$strip.find("li").each(function(i){
				//stripWidth += jQuery(this, i).width();
				//});
				var stripWidth = 2000;
				$strip.width(stripWidth);			
				var totalTravel = stripWidth+containerWidth;
				var defTiming = totalTravel/settings.travelocity;	// thanks to Scott Waye		
				function scrollnews(spazio, tempo){
				$strip.animate({left: '-='+ spazio}, tempo, "linear", function(){$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
				}
				scrollnews(totalTravel, defTiming);				
				$strip.hover(function(){
				jQuery(this).stop();
				},
				function(){
				var offset = jQuery(this).offset();
				var residualSpace = offset.left + stripWidth;
				var residualTime = residualSpace/settings.travelocity;
				scrollnews(residualSpace, residualTime);
				});			
		});	
};




