//$LAB.setGlobalDefaults({AlwaysPreserveOrder: true, AppendTo: 'body'});
$LAB
.script("/scripts/jquery-1.4.2.min.js").wait() .script("/scripts/jquery.cycle.lite.min.js")
.wait(function() {
	$(document).ready(function() {
		$('.rotating').cycle({timeout: 3000, speed: 3000}); 
	});
})
.script("/scripts/jquery.tools.min.js")
.script("/scripts/mediaelement-1.0.4.js").wait()
.script("/scripts/mediaelementplayer-1.0.4.js")
.wait(function() {
	$(document).ready(function() {
		$("a[rel]").overlay({
			mask: '#333',
			top: '15%',
			left: 'center',
			onClose: function() {
				$('.owrap').html('');
			},
			onBeforeLoad: function() {
				//ov = this.getOverlay();
				//ov.removeAttr('style');
				txt = '';	
				h = this.getTrigger().attr("href");
				t = this.getTrigger().attr("title");				
				c = this.getTrigger().attr("class");
				id = this.getTrigger().attr("id");
				w = 'auto';
				mtop = '0';
				
				//console.log(t,c,id);
				if (id==='') {			
					if (c=='audio') {
						txt = '<div class="avwrap"><audio controls="controls" src="'+ h+'" type="audio/mp3" tabindex="0"><p><a href="'+h+'">Download Audio</a> (mp3)</p></audio></div>';
						w = '340px';
						mtop = '100px';
					} else if (c=='video') {
						txt = 'video player';				
					} else {
						w = '805px';
						txt = '<img src="'+ h+'" />';	
					}
				} else {
					d = '#de'+id.substring(2);
					txt = '<div class="avwrap">' + $(d).html()+'</div>';
					w = $(d).width() + 40 + 'px';
				}
				$('#overlay').css('margin-top',mtop);
				$('.owrap').css('width', w).html(txt);
				$('.owrap audio, .owrap video').mediaelementplayer();			
			}
		
		});	
	});
})
.script(('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js')
.wait(function(){
	pageTracker = _gat._getTracker("UA-4721464-1");
	pageTracker._trackPageview();
});

/*
$(document).ready(function() {
	$('.rotating').cycle({timeout: 3000, speed: 3000}); 
	$("a[rel]").overlay({
		mask: '#333',
		top: '5%',
		left: 'center',
		onClose: function() {
			$('.owrap').html('');
		},
		onBeforeLoad: function() {
			//ov = this.getOverlay();
			//ov.removeAttr('style');
			txt = '';	
			h = this.getTrigger().attr("href");
			t = this.getTrigger().attr("title");				
			c = this.getTrigger().attr("class");
			id = this.getTrigger().attr("id");
			w = 'auto';
			
			//console.log(t,c,id);
			if (id==='') {			
				if (c=='audio') {
					txt = '<div class="avwrap"><audio controls="controls" src="'+ h+'" type="audio/mp3" tabindex="0"><p><a href="'+h+'">Download Audio</a> (mp3)</p></audio></div>';
				} else if (c=='video') {
					txt = 'video player';				
				} else {
					w = '805px';
					txt = '<img src="'+ h+'" />';	
				}
			} else {
				d = '#de'+id.substring(2);
				txt = '<div class="avwrap">' + $(d).html()+'</div>';
			}
			$('.owrap').css('width',w).html(txt);
			$('.owrap audio, .owrap video').mediaelementplayer();			
		}
	
	});	
});
*/
