function displayFlash(path, width, height)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" HEIGHT="' + height + '" WIDTH="' + width);
	document.write('" HEIGHT="' + height + '">');
	document.write('<PARAM NAME="bgcolor" VALUE="green"><PARAM NAME="movie" VALUE="' + path + '"><param name="quality" value="high"><PARAM NAME="wmode" VALUE="transparent"><PARAM NAME="quality" VALUE="high">');
	document.write('<EMBED src="' + path + '"');
	document.write(' quality="high" WIDTH="' + width + '" HEIGHT="' + height + '" NAME="FlashContent"');
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write('</EMBED></OBJECT>');
}

		function saveTag(id)
		{
			var taginput = window.document.getElementById('w'+id);
			if(taginput == null)
			{
				floatWindow.hide();
				return;
			}
			tag = taginput.value;
			var frame = document.getElementById('saveframe');
			frame.src = '/save.tag.php?intImgID='+id+'&varTag='+tag;
			floatWindow.hide();
		}

		function openQuestionEditor(qID, x, y)
		{
			//floatWindow.header.innerHTML = 'Hello?';
			html = '';
			html += '<div style="padding: 5px 5px 5px 5px; text-align: center;">';
			html += '<input id="w'+qID+'" type="text" name="varTag" value="" style="margin:2px 2px 2px 2px; width: 80px;"><br/>';
			html += '<input type="button" onclick="saveTag('+qID+');" value="OK">';
			html += '&nbsp;&nbsp;&nbsp;';
			html += '<input type="button" onclick="floatWindow.hide();" value="X">';
			html += '</div>';
			floatWindow.setBody(html);
			floatWindow.draw();
			floatWindow.show(true);
			floatWindow.moveTo(x, y);
		}

		function onAddToFavorites(id)
		{
			var frame = document.getElementById('saveframe');
			frame.src = '/my.favorites.php?event=add&intImgID='+id;
			if( document.getElementById('removefav') )
			{
				document.getElementById('removefav').style.display="block";
				document.getElementById('addfav').style.display="none";
			}

			if( document.getElementById('fav_'+id))
			{
				document.getElementById('fav_'+id).style.display = "none";
			}
			if( document.getElementById('xfav_'+id))
			{
				document.getElementById('xfav_'+id).style.display = "block";
			}

		}

		function hidewindow()
		{
			floatWindow.hide();
		}

		function onRemoveFromFavorites(id)
		{
			var frame = document.getElementById('saveframe');
			frame.src = '/my.favorites.php?event=remove&intImgID='+id;
			if( document.getElementById('removefav') )
			{
				document.getElementById('removefav').style.display="none";
				document.getElementById('addfav').style.display="block";
			}
			if( document.getElementById('xfav_'+id) != null )
			{
				document.getElementById('xfav_'+id).style.display = "none";
			}
			if( document.getElementById('fav_'+id) != null )
			{
				document.getElementById('fav_'+id).style.display = "block";
			}
		}

		function Left(elem){
			var x=0;
			if (elem.calcLeft)
				return elem.calcLeft;
			var oElem=elem;
			while(elem){
				 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
				 	x+=parseInt(elem.currentStyle.borderLeftWidth);
				 x+=elem.offsetLeft;
				 elem=elem.offsetParent;
			  }
			oElem.calcLeft=x;
			return x;
			}

		function Top(elem){
			 var x=0;
			 if (elem.calcTop)
			 	return elem.calcTop;
			 var oElem=elem;
			 while(elem){
			 	 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
				 	x+=parseInt(elem.currentStyle.borderTopWidth);
				 x+=elem.offsetTop;
			         elem=elem.offsetParent;
		 	 }
		 	 oElem.calcTop=x;
		 	 return x;

		}

		function doTagImage(id, e, el)
		{
			if( !e )
			{
				e = event;
			}
			var s = '';
			for(var key in e)
			{
				s = s + key + '=' + e[key] + " :: ";
			}
			var x = Left(el);
			var y = Top(el);
			openQuestionEditor(id, x, y);
		}

var curOpacityKoef = 100;

function removeElementDisappear( elId, koef )
{
	curOpacityKoef = koef;
	el = document.getElementById(elId);
	el.style.MozOpacity = curOpacityKoef/100;
	curOpacityKoef--;

	if ( curOpacityKoef > 0 )
	{
		setTimeout("removeElementDisappear('" + elId + "', " + (curOpacityKoef) + ");", 5);
	}
	else
	{
		el.style.display = 'none';
	}
}