// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

//
// embeds flash video
//
function embedVideo(videoSource, version, width, height) {
    var width, height;
		var hasRightVersion = DetectFlashVer(9,0,0);
    var skin = "http://www.pastemagazine.com/flash/SkinOverPlayStopSeekFullVol.swf";

		if (hasRightVersion) {
        // embed the flash movie if we've detected an acceptable version

        if (!(width && height)) {
            if (version == "home") { width  = "300"; height = "230"; }
                              else { width  = "430"; height = "323"; }
//                              else { width  = "480"; height = "368"; }
        }

        AC_FL_RunContent(
            'codebase',          'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
            'width',             width,
            'height',            height,
            'src',               'http://www.pastemagazine.com/flash/VideoPlayer',
            'quality',           'high',
            'pluginspage',       'http://www.macromedia.com/go/getflashplayer',
            'align',             'middle',
            'play',              'true',
            'loop',              'true',
            'scale',             'showall',
            'wmode',             'window',
            'devicefont',        'false',
            'id',                'VideoPlayer',
            'bgcolor',           '#000000',
            'name',              'VideoPlayer',
            'menu',              'true',
            'allowScriptAccess', 'sameDomain',
            'allowFullScreen',   'true',
            'movie',             'http://www.pastemagazine.com/flash/VideoPlayer',
            'FlashVars',         'videoSource=' + videoSource + '&skinSource=' + skin,
            'salign',            ''
            ); //end AC code
		}
    else {
            // flash is too old or we can't detect the plugin
            var alternateContent = '<p>This content requires the Adobe Flash Player.'
                                 + ' <a href=http://www.macromedia.com/go/getflash/>Get Flash</a></p>';
    		    document.write(alternateContent);  // insert non-flash content
		}
}


//
// basic url query string parsing
function parse_query() {
    var qstr = location.search.replace(/^\?/,'') || '';
    var qparams = {};
    var pairs = qstr.split(/&/);
    for (var i = 0; i < pairs.length; i++) {
        var nvpair = pairs[i].split(/=/,2);
        qparams[unescape(nvpair[0])] = unescape(nvpair[1]);
    }
    return qparams;
}
this.parseQuery = parse_query;
