function DisplayFlash(path, width, height, wmode){

    text = "<object type=\"application/x-shockwave-flash\" data=\""+path+"\" width=\""+width+"\" height=\""+height+"\" wmode=\""+wmode+"\" quality=\"high\">\r\n";
    text += "<param name=\"movie\"	value=\""+path+"\" />\r\n";
    text += "<param name=\"wmode\" value=\""+wmode+"\" />\r\n";
    text += "<param name=\"quality\" value=\"high\" />\r\n";
    text += "<param name=\"width\" value=\""+width+"\" />\r\n";
    text += "<param name=\"height\" value=\""+height+"\" />\r\n";
    text += "</object>";
    document.write(text);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ShowPhoto(photo) {

	var req = new JsHttpRequest();


	req.onreadystatechange = function() {
	if (req.readyState == 4) {
          	document.getElementById("photo").innerHTML = req.responseJS.photo;

                 document.getElementById("pager").innerHTML = req.responseJS.pager;
		}
        }

	req.open(null, "/jslib/photo.php", true);
	req.send( {photo: photo} );
}


function ShowItem(item, parent) {

	var req = new JsHttpRequest();
	
	var id = "filter-value-"+parent;
	var elem = document.getElementById(id);
	var thisChilds = elem.getElementsByTagName('a');
	for (var i = 0; i < thisChilds.length; i++){
                                if (thisChilds[i].className == 'selected') thisChilds[i].className = '';
                        }

	var elem = document.getElementById(item);
	document.getElementById(item).className = "selected";

	req.onreadystatechange = function() {
	if (req.readyState == 4) {
          	document.getElementById("item").innerHTML = req.responseJS.item;
		
              
		}
        }

	req.open(null, "/jslib/item.php", true);
	req.send( {item: item} );
}


function ShowFolder(item, imgid) {

	var req = new JsHttpRequest();
	
	var elem = document.getElementById('toplinks');
	var thisChilds = elem.getElementsByTagName('img');
	for (var i = 0; i < thisChilds.length; i++){
                                if(thisChilds[i].id!=imgid)
					thisChilds[i].src = "/images/"+thisChilds[i].id+".gif";
                        }
	
	document.getElementById(imgid).className = "selected";

	req.onreadystatechange = function() {
	if (req.readyState == 4) {
          	document.getElementById("inner").innerHTML = req.responseJS.item;
			
			///////////
			
			var Tips2 = new Tips($$('.Tips2'), {
				initialize:function(){
					this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 400, wait: false}).set(0);
				},
				onShow: function(toolTip) {
					this.fx.start(1);
				},
				onHide: function(toolTip) {
					this.fx.start(0);
				}
			});
			
			///////////
		
		}
        }

	req.open(null, "/jslib/folder.php", true);
	req.send( {item: item} );
}



var x,y;
var flag =0;
function init() {
	 document.onmousemove=mousemove;
}
//определяем браузер 
var isDOM=document.getElementById;
var isOpera=isOpera5=window.opera&&isDOM; //Opera 5+ 
var isMSIE=document.all&&document.all.item&&!isOpera; //MSIE 4+ 
var isMozilla=navigator.appName=="Netscape"; //Mozilla 
function move(text,head) {
	if (text ) {	
	//new Effect.Appear('popup',  { duration: 1, from: 0.9, to: 0.0 }); 
	if (head)
	text = '<div id="head-pop">' + head + '</div><div class="clear" style="clear:both;">&nbsp;</div>' + text +'';
	document.getElementById('inbody').innerHTML = text;
 	document.getElementById("popup").style.left=x+ 'px';
	document.getElementById("popup").style.top=y + 'px';
	//new Effect.BlindDown('popup');
	new Effect.BlindDown('popup');
	}

		//new Effect.SwitchOff('popup');
		//new Effect.Squish('popup');
		//document.getElementById('popup').style.display = 'none';
}

function mousemove ()
{
if (isMSIE || isOpera)
{ 
	if (flag==0) {
		x = 0;
		y = 0;
		x = (document.body.scrollLeft | document.documentElement.scrollLeft);
		if (event)
		if (event.clientX>0) x = x + parseInt(event.clientX);
		y = (document.body.scrollTop | document.documentElement.scrollTop);
		if (event)
		if (event.clientY>0) y = y + parseInt(event.clientY);
		}
	else {
		document.getElementById('popup').style.display = 'none';
	}
} 
//находим координаты мышки в Мозилле 
else if (isMozilla){
	document.onmousemove=function(e)
	{ 
	if (flag==0) {
		x = e.pageX;
		y = e.pageY;
		}
	else {
		document.getElementById('popup').style.display = 'none';
	}
	}
	
}	
}
function popup_close() {
	new Effect.Squish('popup');
	for (i = 0; i < document.getElementsByTagName("a").length; ++i){
				document.getElementsByTagName("a")[i].className = '';
				}
	}
init();
