function showFlash(w, h, path) {
//===========================================
var str='<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="'+w+'" height="'+h+'" id="flash_map3" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+path+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'+path+'" quality="high" bgcolor="#ffffff" width="'+w+'" height="'+h+'" name="flash_map3" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
document.write (str);
} 
function showFlashtrans(w, h, path) {
//===========================================
var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="flash_logo" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+path+'" /><param name="wmode" value="transparent" /><param name="quality" value="high" /><param name="bgcolor" value="#666666" /><embed src="'+path+'" quality="high" wmode="transparent" bgcolor="#666666" width="'+w+'" height="'+h+'" name="'+path+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
document.write (str);
} 
//===========================================

	function rOpenImageWindow(src,width,height)
	{ 
	
	var imgincrdiv=document.getElementById("imgincrdiv");
	var imgincrtd=document.getElementById("imgincrtd");
	var darkdiv=document.getElementById("darkdiv");

		if (imgincrdiv && imgincrtd)
		{
		darkdiv.style.display="";
		imgincrdiv.style.display="";

    //alert(width + ' ' + height);
  

		var divheight=(darkdiv.clientHeight*0.9).toFixed(0);
		var divwidth=(darkdiv.clientWidth*0.7).toFixed(0);
		
		var size="";
		width=width*1;
		height=height*1;

    if(height > divheight || width > divwidth)
    {
  		hk=height/divheight;
  		hw=width/divwidth;
  
  		if (hw > hk)// по ширине
  		{
  		widthnew=divwidth*1;
  		heightnew=(height*(widthnew/width)).toFixed(0);
  		}
  		else
  		{
  		heightnew=divheight*1;
  		widthnew=(width*(heightnew/height)).toFixed(0);
  		}
    }
    else
    {
      heightnew = height;
      widthnew = width;
    }

		size="height='"+heightnew+"' width='"+widthnew+"'";
		imgincrtd.innerHTML="<img src='"+src+"'"+size+">"; 
		}
	}
//===========================================


	function OpenImageGalerry(src,width,height,type,ptitle)
	{ 

	var imgincrdiv=document.getElementById("imgincrdiv");
	var imgincrtd=document.getElementById("imgincrtd");
	var darkdiv=document.getElementById("darkdiv");
	var ptitlediv=document.getElementById("ptitlediv");

	ptitlediv.innerHTML=ptitle;

		if (imgincrdiv && imgincrtd)
		{
		darkdiv.style.display="";
		
		var divheight=(darkdiv.clientHeight*0.9).toFixed(0);
		var divwidth=(darkdiv.clientWidth*0.7).toFixed(0);
		
		imgincrdiv.style.display="";
		
		
		
		if (type==0)
			{
			var size="";
			width=width*1;
			height=height*1;
			
			hk=height/divheight;
			hw=width/divwidth;

			if (hw > hk)// по ширине
			{
			widthnew=divwidth*1;
			heightnew=(height*(widthnew/width)).toFixed(0);
			}
			else
			{
			heightnew=divheight*1;
			widthnew=(width*(heightnew/height)).toFixed(0);
			}

			size="height='"+heightnew+"' width='"+widthnew+"'";
			imgincrtd.innerHTML="<img src='"+src+".jpg'"+size+">"; 
			}
		else
			{
			var xxx=AC_FL_RunContent_html(512,384,''+src+'.flv');
			imgincrtd.innerHTML="<div style='width: 512px; padding:0; margin: 0; height: 384px;  background: url("+src+".jpg) #ffffff no-repeat 0 0;'>"+xxx+"</div>";
			}
		}

	//------------------------------
		var galleryul = document.getElementById("galleryul");
		if (galleryul){
			for (j=0; j<galleryul.childNodes.length; j++) 
			{
				node = galleryul.childNodes[j];
				if (node.nodeName=="LI") {
					srcli=node.getAttribute("srcli");
					if (srcli==src)
					{
						cur=j;
					}
				}
			}
			
			if (cur==0)
				var prew=galleryul.childNodes.length-1;
			else
				var prew=cur-1; 
			

			var	srcprew=galleryul.childNodes[prew].getAttribute("srcli");
			var	widthprew=galleryul.childNodes[prew].getAttribute("widthli");
			var	heighprew=galleryul.childNodes[prew].getAttribute("heightli");
			var	typeprew=galleryul.childNodes[prew].getAttribute("typeli");
			var	ptitleprew=galleryul.childNodes[prew].getAttribute("ptitleli");
	
			var tmp=galleryul.childNodes.length*1-1;
			if (cur==tmp)
				{
				var next=0;
				}
			else
				var next=cur+1; 

			var	srcnext=galleryul.childNodes[next].getAttribute("srcli");
			var	widthnext=galleryul.childNodes[next].getAttribute("widthli");
			var	heighnext=galleryul.childNodes[next].getAttribute("heightli");
			var	typenext=galleryul.childNodes[next].getAttribute("typeli");
			var	ptitlenext=galleryul.childNodes[next].getAttribute("ptitleli");

			
			
		}
	
	var barrowlelt = document.getElementById("barrowlelt");
	barrowlelt.setAttribute("srcarr", srcprew); 
	barrowlelt.setAttribute("widtharr", widthprew);
	barrowlelt.setAttribute("heightarr", heighprew);
	barrowlelt.setAttribute("typearr", typeprew);
	barrowlelt.setAttribute("ptitlearr", ptitleprew);

	var barrowright = document.getElementById("barrowright");
	barrowright.setAttribute("srcarr", srcnext); 
	barrowright.setAttribute("widtharr", widthnext);
	barrowright.setAttribute("heightarr", heighnext);
	barrowright.setAttribute("typearr", typenext);
	barrowright.setAttribute("ptitlearr", ptitlenext);
	
	}

	//----------------------------------------------------------

	function OpenImageGalerryCircul (way)// Вперед назад
	{
	if (way=='pr')
		{
		var barrow = document.getElementById("barrowlelt");
		}
	else
		{
		var barrow = document.getElementById("barrowright");
		}
	var src = barrow.getAttribute("srcarr"); 
	var width = barrow.getAttribute("widtharr");
	var height = barrow.getAttribute("heightarr"); 
	var type = barrow.getAttribute("typearr");
	var ptitle = barrow.getAttribute("ptitlearr"); 
	
	
	OpenImageGalerry(src,width,height,type,ptitle);
	}
