$(document).ready(function(){
	
	$("#content table").each(function (){
		$(this).tablesorter({widgets: ['zebra']});		
	});

	$("#ex_ussr a").hover(
		function()
		{
			ex = $(this).parent().offset();
			pos = $(this).offset();
			l = pos['left'] - ex['left'];
			
			if ($.browser.msie && $.browser.version == 6)
			{
				l = l - 20; 
			}else{
				l = l + 20;
			}	
			t = pos['top'] - 205;
			
			if ($(this).attr('href'))
			{
				var html = $.ajax({
				url: $(this).attr('href'),
				async: false
				}).responseText;
				$("#client_container").html(html).css({'display':'block', 'left':l, 'top':t});	
			}
		},
		function(){
			$("#client_container").css('display','none');
		}
	).click(function(){return false});
});

function open_galary(page ,pid, idm)
{
    url = "/"+page+"/galid_"+pid+"_"+idm;

    var iLeft = (screen.width  - 640) / 2 ;
    var iTop  = (screen.height - 505) / 2 ;

    var sOptions = "toolbar=no,status=no,resizable=no,dependent=no" ;
    sOptions += ",width=" + 640 ;
    sOptions += ",height=" + 505 ;
    sOptions += ",left=" + iLeft ;
    sOptions += ",top=" + iTop ;
    window.open( url, "GalaryWindow", sOptions ) ;
    return false;
}
function show(id)
{
	id = "pic"+id;
	document.getElementById(id).style.display = "block"; 
}
function hide(id)
{
	id = "pic"+id;
	document.getElementById(id).style.display = "none";
	
}
var posX;
var posY;
function hide_pic(event)
{
	if (!event) event = window.event;
//	posXmax = posX+450;
//	posXmin = posX+250;
//	if ((event.clientX > posXmin) && (event.clientX < posXmax)) return;
	document.getElementById('myalt').style.visibility="hidden";
	document.getElementById('myalt').innerHTML="";
	document.getElementById('myalt').style.top=0;
	document.getElementById('myalt').style.left=0;
}
function show_pic(img, w, h, param)
{
	var top
	if ($.browser.msie)
	{
		if (param == 1) top = 80;
		if (param == 2) top = 300;	
	}
	else
	{
		if (param == 1) top = 60;
		if (param == 2) top = 280;	
	}

	document.getElementById('myalt').style.width = w;
	document.getElementById('myalt').style.height = h;
	if ($.browser.msie)
	{
		document.getElementById('myalt').innerHTML='<div style=" background: URL(/UserFiles/Image/'+img+') no-repeat; width = '+w+'px;  height = '+h+'px"><div style="width: 220px; height: 210px; margin-top: '+top+'px;" onMouseOut="hide_pic(event)">&nbsp;</div></div>';
	}
	else
	{
		document.getElementById('myalt').innerHTML='<div><img src=/UserFiles/Image/'+img+'  width = '+w+'px  height = '+h+'px><div style="position: absolute; left: 0px; top: 0px; z-index: 1000; width: 220px; height: 210px; margin-top: '+top+'px;" onMouseOut="hide_pic(event)">&nbsp;</div></div>';
	}
	document.getElementById('myalt').style.left="0px";
	document.getElementById('myalt').style.top="0px";
	document.getElementById('myalt').style.visibility="visible";
	document.getElementById('myalt_manager').style.visibility="visible";
}
