// JavaScript Document
function hasFlash() {
    var isFlash = false;
		if (isIE()) {
        for (var i = 7; i > 0; i--) {
            try {
                var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
                isFlash = true;
                break;
            }
            catch (e) {
            }
        }
    } else {
        if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
            isFlash = true;
        }
    }
		return isFlash;
}
// functions for determining user agent
function isIE() {
    return isAgent("IE");
}
function isGecko() {
    return isAgent("Gecko");
}
function isOpera() {
    return isAgent("Opera");
}
/**
 * function to check if a browser is of a specified type
 * and of at least the version specified.
 * @param appName the name of the browser type to check for.
 *        valid types are 'IE', 'Gecko', 'Opera'.
 * @returns true if this browser is of a the specified type and
 *          and has a version greater than or equal to version.
 */
function isAgent(appName) {
    return isAgentAndVersion(appName, 0);
}
/**
 * function to check if a browser is of a specified type
 * and of at least the version specified.
 * @param appName the name of the browser type to check for.
 *        valid types are 'IE', 'Gecko', 'Opera'.
 * @param version the version number to check if this browser
 *        is greater than.
 * @returns true if this browser is of a the specified type and
 *          and has a version greater than or equal to version.
 */
function isAgentAndVersion(appName, version) {
    var isAgent = false;
    var userAgent = navigator.userAgent;
    if (appName == "IE") {
        if (userAgent.indexOf("MSIE") > 0) {
            var versionRegExp = new RegExp("MSIE ((\\d+\\.?){1,2})");
            var result = versionRegExp.exec(userAgent);
            if (result.length > 0) {
                if (result[1] >= version) {
                    isAgent = true;
                }
            }
        }
    }
    if (appName == "Gecko") {
        if (userAgent.indexOf("MSIE") < 0) {
            var versionRegExp = new RegExp("Mozilla/((\\d+\\.?){1,2})");
            var result = versionRegExp.exec(userAgent);
            if (result.length > 0) {
                if (version <= result[1]) {
                    isAgent = true;
                }
            }
        }
    }
    if (appName == "Opera") {
        if (userAgent.indexOf("Opera") > 0) {
            var versionRegExp = new RegExp("Opera(/|\\s)((\\d+\\.?){1,2})");
            var result = versionRegExp.exec(userAgent);
            if (result.length > 0) {
                if (version <= result[2]) {
                    isAgent = true;
                }
            }
        }
    }
    return isAgent;
}
function homeFlash(){
	var flash = '';
	if(hasFlash()){
			flash += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="172" height="175" id="webstore_by_amazon_movie" align="middle">';
			flash += '<param name="movie" value="http://g-ecx.images-amazon.com/images/G/01/webstore/wac/video/webstore_by_amazon_movie.swf" />'
			flash += '<param name="quality" value="high" />'
			flash += '<param name="wmode" value="transparent" />'			
			flash += '<embed src="http://g-ecx.images-amazon.com/images/G/01/webstore/wac/video/webstore_by_amazon_movie.swf" quality="high" bgcolor="#ffffff" width="172" height="175" name="webstore_by_amazon_movie" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
			flash += '</object>'
		
	}else{
			flash +='<a href="http://g-ecx.images-amazon.com/images/G/01/webstore/wac/video/web_store_by_amazon_movie.mov" target="_blank">';
				flash +='<img src="http://g-ecx.images-amazon.com/images/G/01/webstore/wac/video/alt_downlaod_video.jpg" border="0"/>';
			flash +='</a>';
	}
	document.write(flash);
}
