var flashDetect=false;
var pInstalled=false;

var isWin=(navigator.appVersion.indexOf("Win")!=-1)? true : false;
var isMac=(navigator.appVersion.indexOf("Mac")!=-1)? true : false;
var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)? true : false;
var isIE4=(navigator.appVersion.indexOf("MSIE 4.")!=-1)? true : false;

function detectFlash(obj){

	if(isMac&&isIE4) location.replace(obj.substitute);

	if(isWin&&isIE){
		document.write('<scr' + 'ipt type="text/vbscript">'+'\n');
		document.write('on error resume next'+'\n');
		document.write('pInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+obj.requiredVersion+'")))'+'\n');
		document.write('<\/scr' + 'ipt\>'+'\n');
		if(pInstalled){
			flashDetect=true;
		}
	}

	if(navigator.plugins["Shockwave Flash"]){
		var verDescription=navigator.plugins["Shockwave Flash"].description;
		var actualVersion=verDescription.charAt(verDescription.indexOf(".") - 1);
		if( actualVersion >= obj.requiredVersion ){
			flashDetect=true;
		}
	}

	if(flashDetect){
		document.open();
		document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' id='"+obj.name+"' width='"+obj.width+"' height='"+obj.height+"'>"+"\n");
		document.write("<param name='movie' value='"+obj.swf+"' >"+"\n");
		document.write("<param name='loop' value='"+obj.loop+"' >"+"\n");
		document.write("<param name='menu' value='"+obj.menu+"' >"+"\n");
		document.write("<param name='quality' value='"+obj.quality+"' >"+"\n");
		document.write("<param name='bgcolor' value='"+obj.bgColor+"' >"+"\n");
		document.write("<embed src='"+obj.swf+"' name='"+obj.name+"' loop='"+obj.loop+"' menu='"+obj.menu+"' quality='"+obj.quality+"' bgcolor='"+obj.bgColor+"' width='"+obj.width+"' height='"+obj.height+"' swliveconnect='"+obj.liveConnect+"' type='application/x-Shockwave-flash' pluginspage='http://www.macromedia.com/jp/shockwave/download/?P1_Prod_Version=ShockwaveFlash'><\/embed>"+"\n");
		document.write("<\/object>"+"\n");
		document.close();
	}else{
		location.replace(obj.substitute);
	}
}

function printMovie (file,w,h) {
		document.write (
				'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ' +
					'id="Movie" width="' + w + '" height="' + h + '">' +
					'<param name="movie" value="' + file + '">' +
					'<param name="menu" value="false" />' +
					'<param name="FlashVars" value="8">' +
					'<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/jp/shockwave/download/?P1_Prod_Version=ShockwaveFlash&amp;Lang=Japanese" ' +
						'name="index" width="' + w + '" height="' + h + '" ' +
						'src="' + file + '"' +
					'FlashVars="8" menu="false"' +
					'><\/embed>' +
				'<\/object>');

}
function FullWin(href){
w1=screen.availWidth;
h1=screen.availHeight;
	if (!((navigator.appVersion.indexOf("Win")!=-1))) {
		if(navigator.appVersion.indexOf("Safari")!=-1){ 
			h1 -= 2;
			win=window.open(href,"win","scrollbars=0,resizable=0,width=" + w1 +",height=" + h1);
			win.moveTo(0,0);
		}else{
			win = window.open(href,"win","fullscreen=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,screenX=0,screeny=0,left=0,top=0");
			win.moveTo(0,0);
			win.resizeTo(w1,h1);
		}
	} else {
		win=window.open(href,"win","scrollbars=no,location=no,menubar=no,left=0,top=0,width=" +w1+ ",height=" + h1)
	}
}
