$(document).ready(function() {
	MediaVideos.init();
	Modals.init();
});

var Modals = {
	
	reFilename: /\/media\/images\/[^\/]*\/(.*)/,
	reMediaFile: /\/media\/(.*)/,
	
	init: function() {
		$('a.modal').colorbox();
		$('a.modalHTML').each( function(i) {
			var matches = Modals.reFilename.exec( $(this).attr('href') );
			if ( matches ) {
				$(this).colorbox({ href: '/media/html/' + matches[1] + '.html #mediaContent' });
			}
			else {	
				var matches2 = Modals.reMediaFile.exec( $(this).attr('href') );
				if ( matches2 ) {
					$(this).colorbox({ href: '/media/html/' + matches2[1] + '.html', width: 400, height: 400, iframe: true });
				}
			}
		} );
	}
	
};

var MediaVideos = {
	vid: '',
	init: function() {},
	getVideoUrl: function() {
		var reFilename = /\/media\/html\/(.*).html$/;
		var matches = reFilename.exec( document.location.href );
		if ( matches ) {
			MediaVideos.vid = matches[1];
		}
		return MediaVideos.vid;
	}
	
};

