// initiate JCEMediabox
JCEMediaObject.init('/', {flash:"10,0,22,87",windowmedia:"5,1,52,701",quicktime:"6,0,2,0",realmedia:"7,0,0,0",shockwave:"8,5,1,0"});JCEMediaBox.init({popup:{width:"",height:"",legacy:0,resize:1,icons:1,overlay:1,overlayopacity:0.8,overlaycolor:"#000000",fadespeed:500,scalespeed:500,hideobjects:1,scrolling:"fixed",labels:{'close':'Close','next':'Next','previous':'Previous','cancel':'Cancel','numbers':'{$current} of {$total}'}},tooltip:{className:"tooltip",opacity:0.8,speed:150,position:"br",offsets:{x: 16, y: 16}},base:"/",imgpath:"wo/jce/jcemediabox/img",theme:"standard",themecustom:"",themepath:"wo/jce/jcemediabox/themes"});

function redirectPage() {
 window.location = linkLocation;
} 

$(document).ready(function() {
	/*---- DL Code ----*/
	if( ($('div.dl').length > 0) && (typeof($.fn.dynamiclead) != "undefined") ) {
		$('div.dl h3').addClass('hidden');
		$('div.dl .credit').removeClass('hidden');
		
		$('div.dl ul').dynamiclead({
			slideArray: ((typeof(DLslides)!="undefined")?DLslides:[{url:'',link:'',headline:'',caption:''}])   
        });
        		
	}
	
	$(".image").hover(
	  function () {
		$(this).css("opacity", "0.7");
	  }, 
	  function () {
		$(this).css("opacity", "1");
	  }
	);
	
	/*$("#levelTwoInner li").delay(3000).animate({opacity: 0}, 1200); 
	
	$("#levelTwoInner a").hover(
	  function () {
		$(this).animate({opacity: 1}, 1200); 
	  }, 
	  function () {
		$(this).animate({opacity: 0}, 1200); 
	  }
	);*/
	
	$('a').click( function( event ){
		if( this.href == "" || this.href == null ) { event.preventDefault(); return; }
		if( (this.href.indexOf("#") == -1) && (this.href.indexOf("mailto:") == -1) && (this.href.indexOf("javascript:") == -1) && (this.target != "_blank")) {
			event.preventDefault();
			linkLocation = this.href;
			$("body").fadeOut(600, redirectPage);
		}
	}); 
	
	
	$('.top').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	}); 
	
	$('.projectinfo').click(function(){
		var offset = $("#cmsarea3-p").offset();
		$('html, body').animate({scrollTop:offset.top}, 'slow');
		return false;
	}); 
	
	$("#cmsarea1 img, #cmsarea2 img, #cmsarea3 img").lazyload({ placeholder : "img/grey.gif", effect : "fadeIn"});

	
});
