// JavaScript Document
var flashvars = {};
var params = {	
 wmode: "transparent",
 scale: "noscale",
 menu: "false",
 align: "default",
 allowNetworking: "all",
 allowScriptAccess: "always"
};
var attributes = {};

$(function(){
		   
	$("a.anchorLink").anchorAnimate()
	
	$(document).pngFix(); 
	
	$("#twitter").tweet({
          join_text: "",
		  avatar_size: 48,
          username: "ArnoLubbinge",
          count: 10,
          auto_join_text_default: "we said,", 
          auto_join_text_ed: "we",
          auto_join_text_ing: "we were",
          auto_join_text_reply: "we replied",
          auto_join_text_url: "we were checking out",
          loading_text: "Momentje, laatste tweet wordt opgehaald..."
      });
	
	$("#videoReel").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'showNavArrows'	: false,
				'width'			: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					 'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
		return false;
	});
	
	var flashvarsDemo = {
		tekst: "Listen to my voice-over demo",
		mp3Url: "http://www.arnolubbinge.nl/mp3/ArnoLubbinge-algemenevoice-overdemo.mp3",
		mp3Omschrijving: "Algemene demo"
	};
	
	swfobject.embedSWF("swf/player.swf", "playerHolder", "443", "85", "9.0.0", "swf/expressInstall.swf", flashvarsDemo, params, attributes);
	
	swfobject.embedSWF("swf/teaser1.swf", "teaser1", "175", "180", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
	swfobject.embedSWF("swf/teaser2.swf", "teaser2", "175", "180", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
	swfobject.embedSWF("swf/teaser4.swf", "teaser4", "175", "180", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
		
	var flashvarsDemoCorporate = {
		tekst: "CorporateVoice demo",
		mp3Url: "http://www.arnolubbinge.nl/english/mp3/corporatevoice2011.mp3",
		mp3Omschrijving: "CorporateVoice demo"
	};
	
	swfobject.embedSWF("swf/player.swf", "playerHolderCorporate", "443", "85", "9.0.0", "swf/expressInstall.swf", flashvarsDemoCorporate, params, attributes);
			
	var flashvarsDemoCommercial = {
		tekst: "CommercialVoice demo",
		mp3Url: "http://www.arnolubbinge.nl/english/mp3/commercialvoice2011.mp3",
		mp3Omschrijving: "CommercialVoice demo"
	};
	
	swfobject.embedSWF("swf/player.swf", "playerHolderCommercial", "443", "85", "9.0.0", "swf/expressInstall.swf", flashvarsDemoCommercial, params, attributes);
		
	var flashvarsDemoImage = {
		tekst: "EducationVoice demo",
		mp3Url: "http://www.arnolubbinge.nl/english/mp3/educationvoice2010.mp3",
		mp3Omschrijving: "EducationVoice demo"
	};
	
	swfobject.embedSWF("swf/player.swf", "playerHolderImage", "443", "85", "9.0.0", "swf/expressInstall.swf", flashvarsDemoImage, params, attributes);
				
					
});

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = ($(""+elementClick+"").offset().top) - 40;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				//window.location.hash = elementClick
			});
		  	return false;
		})
	})
}

function goAnchor(target){
	//event.preventDefault();
	var locationHref = window.location.href;
	var elementClick = ""+target+"";
	
	var destination = ($(""+elementClick+"").offset().top) - 40;
	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100, function() {
		//window.location.hash = elementClick
	});
}

