/*  Monsters At Play JavaScript File  */
/*  Version: v 1.0                    */
/*  Author: Michael Johnson           */


// Get Arguments from QueryString
function getQS(qsArg) {
  var qs=location.search.substring(1);
  var pos=qs.indexOf(qsArg+"=");
  if (pos != -1) {
    var start = pos + qsArg.length + 1; 
    var end = qs.indexOf('&',start);
    if (end == -1) end = qs.length;
    var qs_value = qs.substring(start,end);
    qs_value = unescape(qs_value);
    return qs_value;
  } else {
    return 'undefined';
  }
}


// Screenshot Pop-up Window Function
function screenPop(sizeX, sizeY, caption, moviename, filename) {
	var attributes = 'scrollbars=no,status=no,location=no,toolbar=no,favorites=no,address=no';
	full_caption = escape(caption);
	var full_sizeY = eval((parseInt(sizeY) + parseInt('65')));
	var URL = '/utility/screenshot.php?title=' + moviename + '&filename=' + filename + '&caption=' + full_caption + '&width=' + sizeX + '&height=' + sizeY;
screenWin = window.open(URL,'Screenshot','width=' + sizeX + ',height=' + full_sizeY + ',' + attributes);
}


// Writes Specified Screenshot to Page
function screenWrite() {
	var title = getQS('title');
	var filename = getQS('filename');
	var caption = getQS('caption');
	var width = getQS('width');
	var height = getQS('height');
	
document.write('<img src="/assets/screenshots/' + title + '/' + filename + '" alt="[ screenshot ] width="' + width + '" height="' + height + '">');
}


// Writes Specified Caption to Page
function capWrite() {
	var caption = getQS('caption');

document.write(caption);
}
