$(document).ready(function(){

// GET THE PAGE QUERY STRING AND RETRIEVE PAGE PARAMS:
var options={}, queryString = window.location.search;

if (queryString) {
queryString = queryString.substring(1);				
options = $.fn.strobemediaplayback.parseQueryString(queryString);
}

// DEFAULT DIMENISONS IF SOURCE NOT SET:
if (!options.src)
{
options.src = "Video_Montage_-_Demo_Reel_-_656x480";
options.width = "656";
options.height = "480";
options.autoPlay = "true";
options.title = "Welcome To My Portfolio!";
}

// DEFAULT TITLE IF SOURCE NOT SET:
if (!options.src && !options.title)
{
}

// DEFAULT TITLE IF TITLE NOT SET:
if (!options.title)
{
options.title = "Jake Siemer | Media Player";
}

// DEFAULT DIMENSIONS IF NONE SET:
if (!options.width | !options.height)
{
options.width = "720";
options.height = "404";
}

// SETTING THE PATH TO THE PLAYER:
options.base = "player.htm";
options.popup = options.base;

// GENERATE POPUP CODE BASED ON VALUES:
if (options.src) {options.popup = options.base + "?src=" + options.src;}
if (options.src && options.poster) {options.popup = options.base + "?src=" + options.src + "&poster=" + options.poster;}
if (options.src && options.dir) {options.popup = options.base + "?src=" + options.src + "&dir=" + options.dir;}
if (options.src && options.autoPlay) {options.popup = options.base + "?src=" + options.src + "&autoPlay=" + options.autoPlay;}
if (options.src && options.poster && options.dir) {options.popup = options.base + "?src=" + options.src + "&poster=" + options.poster + "&dir=" + options.dir;}
if (options.src && options.dir && options.autoPlay) {options.popup = options.base + "?src=" + options.src + "&dir=" + options.dir + "&autoPlay=" + options.autoPlay;}
if (options.src && options.poster && options.autoPlay) {options.popup = options.base + "?src=" + options.src + "&poster=" + options.poster + "&autoPlay=" + options.autoPlay;}
if (options.src && options.poster && options.dir && options.autoPlay) {options.popup = options.base + "?src=" + options.src + "&poster=" + options.poster + "&dir=" + options.dir + "&autoPlay=" + options.autoPlay;}

// OPENS ON PAGE LOAD:
$.fn.colorbox({iframe:true, innerWidth:options.width, innerHeight:options.height, initialWidth:options.width, speed:options.height*2, title:options.title, href:options.popup, open:true});
// OPENS WHEN CALLED:
$(".640x360").colorbox({iframe:true, innerWidth:640, innerHeight:360, initialWidth:640, speed:720});
$(".656x480").colorbox({iframe:true, innerWidth:656, innerHeight:480, initialWidth:656, speed:960});
$(".704x396").colorbox({iframe:true, innerWidth:704, innerHeight:396, initialWidth:704, speed:792});
$(".720x404").colorbox({iframe:true, innerWidth:720, innerHeight:404, initialWidth:720, speed:808});
$(".872x486").colorbox({iframe:true, innerWidth:872, innerHeight:486, initialWidth:872, speed:972});
$(".1280x720").colorbox({iframe:true, innerWidth:1280, innerHeight:720, initialWidth: 1280, speed:1440});
// DEFINES A GROUP:
$("a[rel='Multi']").colorbox({current:""});

});
