// idea & code by RGdesign.org - 2009 for lizardi.com / vitagraphics.net //

/* -------- */
$(document).ready(function(){

	/* insertFlash(youtube video id, div id) */
	function insertFlash(VIDEO_ID, DIV_ID, PARENT){
		var autoplay = 0; // 0:false, 1:true //;
		var allowFullScreen = 1; // 0:false, 1:true //;
		var showRelatedVideos = 0; // 0:false, 1:true //;
		var backGroundColor = "#070e07"; // for video player flash object //;
		var params = { allowScriptAccess: "always", bgcolor: backGroundColor, allowFullScreen: true };
		var atts = { id: DIV_ID };
		swfobject.embedSWF("http://www.youtube.com/v/"+ VIDEO_ID +"&amp;fs="+allowFullScreen+"&amp;border=0&amp;rel="+showRelatedVideos+"&amp;autoplay="+autoplay+"", DIV_ID, "459", "344", "8.0.0", null, null, params, atts);
		PARENT.animate({height:344}, 800);
	}
		
	$('#videoBox a').each(function(e) {
		var VID = $(this).attr('href').match(/[a-zA-Z0-9-_]+$/);
		$(this).attr('id', 'vid'+e);
		var ap = '<div id=vid'+ e +'></div>';
		var parent = $(this).parent();
		parent.append(ap);
		parent.css('height', '20px');
		parent.css('overflow', 'hidden');
		insertFlash(VID, 'vid'+e, parent );
	})
	
	/* insertBeatPort(div id, player id, autoplay 0 or 1, volume 0 to 100) */
	/* example for player id: http://www.beatportplayer.com/?playerId=198978 */
	function insertBeatPort(DIV_ID, PLAYER_ID, AUTOPLAY, VOLUME){
		var allownetworking = "internal";
		var allowScriptAccess = "never";
		var enableJSURL = "false";
		var saveEmbedTags = "true";
		var object = '<object type="application/x-shockwave-flash" data="https://ak-secure-beatport.bpddn.com/swf/beatportplayer.swf" height="264" width="442" style="display:block;" align="center">';
		 object += '<param name="movie" value="https://ak-secure-beatport.bpddn.com/swf/beatportplayer.swf" /><param name="allownetworking" value="internal" /><param name="allowScriptAccess" value="never" /><param name="enableJSURL" value="false" /><param name="enableHREF" value="false" /><param name="saveEmbedTags" value="true" />';
		 object += '<param name="flashvars" value="bpCfgPath=http://player.beatport.com/en-US/xml/gui/swf/configuration/3&playerId='+PLAYER_ID+'&autoplay='+AUTOPLAY+'&volume='+VOLUME+'" />';
		 object += '<param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="salign" value="lt" /><param name="scale" value="noscale" /></object>';
		 $(DIV_ID).html(object);
		}
	insertBeatPort('#beatportPlayer', $('#beatportPlayer a').attr('href').match(/[a-zA-Z0-9-_]+$/), 0, 80);
	
	/* #become-a-fan */
	$('#become-a-fan .w .t').css({opacity: .8});
	$('#become-a-fan a').hover(
		function(){
			$('#become-a-fan .w .t').animate({"opacity":1}, 150);
			},
		function(){
			$('#become-a-fan .w .t').animate({"opacity":.8}, 150);
			}
	);
	
	/* a.anim for scrolling page */
	$('a.anim').each(function() {			
		$(this).hover(
			function(){
				$(this).animate({"opacity":1}, 150);
			},
			function(){
				$(this).animate({"opacity":.8}, 150);
			}
		);
		$(this).click(function(){
			ref = $(this).attr('href');
			refPos = $(ref).position().top;
			if($.browser.opera){
				 $('html').animate({scrollTop:refPos}, 'slow')
			  }else{
				 $('html, body').animate({scrollTop:refPos}, 'slow')
			  }
			return false;
		});
		$(this).css({"opacity":0.8});
	});
	/* a.anim for scrolling page  end*/
	$('#followmeIcons a').each(function() {			
		$(this).hover(
			function(){
				var tit = $(this).attr('title');
				$('#followTitle').find('span').html('on '+tit); 
				//$(this).animate({"opacity":1}, 150);
			},
			function(){
				$('#followTitle').find('span').html('&nbsp;'); 
				//$(this).animate({"opacity":.8}, 150);
			}
		);
		$(this).click(function(){
			//return false;
		});
	});
});









/* - rgdesign.org ------- */