var isIE4=(navigator.appVersion.indexOf("MSIE")!=-1 && parseFloat(navigator.appVersion)>=4)?true:false;
var isNN4=(navigator.appName=="Netscape" && parseFloat(navigator.appVersion)<5)?true:false;
var isNN6=(navigator.appName=="Netscape" && parseFloat(navigator.appVersion)>=5)?true:false;
var isOPERA=(navigator.appName=="Opera" && parseFloat(navigator.appVersion)>=7)?true:false;

var timeout;
var DivSet="div1";
var z;

function ShowIt (parametr,div,div2,hid) {
	if (parametr == true) {
		clearTimeout(timeout);hide();
		tdWidth=document.all[div].offsetWidth;
		z=165-tdWidth;
		x=getDivX(div)-z;
		//открытие вверх
		//ymenu = document.all[div].offsetHeight;
		//ymenu_new = document.all[div2].offsetHeight;
		y=getDivY(div);//-(ymenu_new+ymenu);
		shiftY=getDivHeight(div);
		setDivX(div2,x,y+shiftY);
		DivSet=div2;
		if (hid == 1){
		try {
			document.all['div50'].style.visibility="hidden";
			document.all['div51'].style.visibility="hidden";
		}
		catch(e){}
		finally {}
		}
	}
	if (parametr == false) {
		timeout=setTimeout('hide()',500);
	}
}

function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');
}

function getDivHeight(divName){
	if( isIE4 ) {
		return document.all[divName].offsetHeight;
	}
	if( isNN6 || isOPERA ) {
		return document.getElementById(divName).offsetHeight;
	}
}


// get X coordinate of element's upper-left corner
function getDivX( szDivName )
{
	if( isIE4 )
	{
		var nPos = 0;
		objCurrent = document.all[ szDivName ];
		while( objCurrent != null )
		{
			nPos += objCurrent.offsetLeft;
			objCurrent = objCurrent.offsetParent;
		}
		return nPos;
	}
	if( isNN4 )
		return document.layers[ szDivName ].pageX; 
	if( isNN6 || isOPERA )
		return document.getElementById( szDivName ).offsetLeft;
	return 0;
}		

// get Y coordinate of element's upper-left corner
function getDivY( szDivName )
{
	if( isIE4 )
	{
		var nPos = 0;
		objCurrent = document.all[ szDivName ];
	
		// prevent relative Y positioning problems in IE55 and IE6:
		if( objCurrent.style.position.toLowerCase() != "absolute" )
			objCurrent.style.position = "static";
	
		while( objCurrent != null )
		{
			nPos += objCurrent.offsetTop;
			objCurrent = objCurrent.offsetParent;
		}

		return nPos;
	}
	if( isNN4 )
		return document.layers[ szDivName ].pageY; 
	if( isNN6 || isOPERA)
		return document.getElementById( szDivName ).offsetTop;
	return 0;
}

function setDivX(DivName,x,y){
 if(isIE4){
 document.all[DivName].style.left=x+"px";
 document.all[DivName].style.top=y+"px";
 document.all[DivName].style.visibility="visible";
 }
 if(isNN4){
 document.layers[DivName].pageX=x-5;
 document.layers[DivName].pageY=y;
 document.layers[DivName].visibility="show";
 }
 if(isNN6 || isOPERA){
 document.getElementById(DivName).style.left=x;
 document.getElementById(DivName).style.top=y;
 document.getElementById(DivName).style.visibility="visible";
 }
}

function hide(){
 if(isIE4){
 document.all[DivSet].style.visibility="hidden";
	try{
		 document.all['div50'].style.visibility="visible";
		 document.all['div51'].style.visibility="visible";
		 }
		 catch(e){}
		finally {}
 }
 if(isNN4){
 document.layers[DivSet].visibility="hidden";
	try{
		 document.layers['div50'].visibility="show";
		 document.layers['div51'].visibility="show";
		 }
	catch(e){}
	finally {}
 }
 if(isNN6 || isOPERA){
 document.getElementById(DivSet).style.visibility="hidden";
	try{
		document.getElementById('div50').style.visibility="visible";
		document.getElementById('div51').style.visibility="visible";
		}
	catch(e){}
	finally {}
 }

}


/*function Big(shot) {
	var ScrWindow;
	ScrWindow=window.open("zoom.html","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,left=15,top=15,width=400,height=400");
	if (ScrWindow != null && ScrWindow.opener == null) ScrWindow.opener=window;
	ScrWindow.document.open();
	ScrWindow.document.writeln ("<html><head><title>&nbsp </title></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor='#ffffff' TEXT='#E2E294'>"+
	"<img src='Img/"+shot+"'>"+
	"</body></html>");
	ScrWindow.document.close();
	return false;
}

function Menu(imgName,menuName){
if(document.images){eval('document.menu' + imgName + '.src="pictures/menu00' + menuName + '.gif"');}
}

function BigXY(shot,X,Y) {
	var ScrWindow;
	var tmp = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,left=15,top=15,width="+X+",height="+Y;
	ScrWindow=window.open("zoom.html","",tmp);
	if (ScrWindow != null && ScrWindow.opener == null) ScrWindow.opener=window;
	ScrWindow.document.open();
	ScrWindow.document.writeln ("<html><head><title>&nbsp</title></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor='#ffffff' TEXT='#E2E294'>"+
	"<img src='"+shot+"'>"+
	"</body></html>");
	ScrWindow.document.close();
	return false;
}
function UseXY(page,X,Y) {
	var ScrWindow;
	var tmp = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,left=15,top=15,width="+X+",height="+Y;
	
	ScrWindow=window.open(page,"",tmp);
	return false;
}*/