var plugin;
var version = 6;
var flashinstalled = false;

// Определяем сразу, есть ли у пользователя флэш
if (navigator.plugins) {

    if (navigator.plugins["Shockwave Flash"]) {
        plugin = navigator.plugins["Shockwave Flash"].description;
        flashinstalled = parseInt(plugin.charAt(plugin.indexOf('.') - 1)) >= version;
    } else {
        if ((navigator.userAgent.indexOf('MSIE') != -1)
            && (navigator.userAgent.indexOf('Win') != -1))
        {
            document.write('<'+'script language="vbscript"'+'>\n');
			document.write('on error resume next\n');
			document.write('flashinstalled=( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + version + '")))\n');
			document.write('</'+'script'+'>');
        }
    }

}



// Готовим всё, чтобы показать флэш, и завязать на нём меню.
var iWhichMenu = -1;
var timeouts = new Array();
	

	function myFlash_DoFSCommand(command, args){
		ExecuteReaction(command, args);
	}
	
	function ExecuteReaction(command, args){
		switch( command ){
			case "bSectionShowBegin":
				iWhichMenu++;
				aMenuDiv[iWhichMenu].style.height = "20px";
				DrawMenuLine( aMenuDiv[iWhichMenu].id, -5, 1, 50, 100, -1, false);
				break;
			case "bSectionShowEnd":
				DrawMenuLine( aMenuDiv[iWhichMenu].id, +5, 100, 1, 1, +1, true);
				break;
		}
	}

	function DrawMenuLine( sObjectID, iChange, iLimit, iTimeout, iInit, iDirection, bIsEnd){
			var oObject = document.getElementById(sObjectID);
			if( oObject ){
				if(
					( iDirection > 0 && iInit < iLimit )
					|| ( iDirection < 0 && iInit > iLimit )
				){
					iInit += iChange;
					oObject.style.width = iInit + '%';
					timeouts[sObjectID] = setTimeout('DrawMenuLine("'+sObjectID+'", '+iChange+', '+iLimit+', '+iTimeout+', '+iInit+', '+iDirection+', '+bIsEnd+')', iTimeout);
				} else {
					if( bIsEnd ){
//						oObject.style.height = "0";
					}
				}
			}
	}

	function ShowFlash() {
		document.write('<div id="MainFlash"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="290" id="myFlash" align="middle">');
		document.write('<param name="movie" value="http://www.opk.ru/052.swf?id=1" />');
		document.write('<param name="bgcolor" value="#FFFFFF" />');
		document.write('<param name="quality" value="#high" />');
		document.write('<embed src="http://www.opk.ru/052.swf?id=1" quality="high" bgcolor="#ffffff" width="100%" height="290" name="myFlash" align="middle" type="application/x-shockwave-flash" swliveconnect="false" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		document.write('</object></div>');
	}

	function ShowNonFlashImage() {
		document.getElementById('NonFlashBlock').style.display = 'block';
	}




	function ShowNewForm( sUrl, iFullWidth, iFullHeight, bIsWithScrollbars ){
		sScrollbars = bIsWithScrollbars ? "yes" : "no";
		window.open( sUrl,'FormWindow','width=' + iFullWidth +',height=' + iFullHeight + ',location=no,menubar=no,resizable=no,status=no,toolbar=no,scrollbars=' + sScrollbars);
		return false;
	}


	function ShowFullImage( iPreviewImageID, iFullImgID, iFullImgWidth, iFullImgHeight ){
		window.open('/showimagewin.phtml?PhotoID=' + iFullImgID,'BigPhoto','width=' + iFullImgWidth +',height=' + iFullImgHeight + ',location=no,menubar=no,resizable=no,status=no,toolbar=no,scrollbars=no');
		return false;
	}
