function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
     anchor.target = "_blank";
   }
 }
}

function playSound(soundfile) {

	document.getElementById("dummy").innerHTML= "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";

}


$(document).ready(function() {
	$(".biolink").fancybox({
				'titleShow'		: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'autoScale'			: true
			});
// small fix for old safari versions compatibility

// this bug occures
// on iPhone OS since 3.2 version (iPad)
// and on iOS since 4.0 version

// as of 1.4.2 the mobile safari reports wrong values on offset()
// http://dev.jquery.com/ticket/6446
// remove once it's fixed
if (/webkit.*mobile/i.test(navigator.userAgent)
&& "getBoundingClientRect" in document.documentElement) {
(function ($) {
$.fn.offsetOld = $.fn.offset;
$.fn.offset = function () {
var result = this.offsetOld();
result.top -= window.scrollY;
result.left -= window.scrollX;

return result;
};
})(jQuery);
}
	$("#spotspage li.clearfix > a, #sounddesignpage li.clearfix > a, #tvfilmpage li.clearfix > a").click(function(e) {
        e.preventDefault();
		$('#col1 a.selected').removeClass('selected'); /* keep the correct anchor highlighed */
		$(this).addClass('selected');
		var clicked_url = $(this).attr('href');
		var y = $(this).closest("li.clearfix").offset().top; /* store the height of the clicked li */
		$.get(clicked_url, function(page) {
		  /* First extract the QT script from the new page, since jQuery will filter it out!
		     Also Use the QT_GenerateOBJECTText_XHTML instead of QT_WriteOBJECT_XHTML. We'll
		     insert the object ourselves */

		  var script = (/(QT_W[^;]*\;)/m.exec(page))[0].replace('QT_WriteOBJECT_XHTML', 'QT_GenerateOBJECTText_XHTML');
		  $("div#videocontainer").empty().append($("div#videocontainer", page).children()); /* Insert the video */
		  $("div#videocontainer div#video").append(eval(script));             /* insert the video "object" */
		  
		$("div#videocontainer").animate({
    		top: y
  			}, 500);

		  sIFR.replace(avenir, {
			  selector: '#videocontainer h1',
			  css: '.sIFR-root { color: #ffffff; }',
		          wmode: 'transparent'
		  });
        });
  });

   
    $("#manual2").click(function() {
		$.fancybox([
			'images/studio/hifi-studio-1.jpg',
			'images/studio/hifi-studio-2.jpg',
			'images/studio/hifi-studio-3.jpg',
			'images/studio/hifi-studio-4.jpg',
			'images/studio/hifi-studio-5.jpg',
			'images/studio/hifi-studio-6.jpg',
			'images/studio/hifi-studio-7.jpg',
		], {
			'padding'			: 0,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'              : 'image',
			
			'changeFade'        : 0,
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}

		});
	});


});



