function CancelEvent(evt)
{
 try
	{
	 if(typeof evt == 'object' && evt != null)
		{
		 try
			{
			 evt.preventDefault();
			 evt.stopPropagation();
			}
		 catch(e)
			{
			 evt.returnValue = false;
			}
		}
	}
 catch(e)
	{
	}
}

function Center(w, h)
{
 var result = {Left:0, Top:0};
 try
	{
	 if(typeof(window.pageXOffset) == 'number')
		{
		 result.Left = (window.innerWidth  - w)/2;
		 result.Top  = (window.innerHeight - h)/2;
		}
	 else
		{
		 result.Left = (window.screen.availWidth  - w )/2;
		 result.Top  = (window.screen.availHeight - h)/2;
		}
	}
 catch(e)
	{
	 result.Left = 100;
	 result.Top = 100;
	}
 return result;
}

function popup_ktu(evt)
{
 if(typeof popup_url == "string")
	{
	 CancelEvent(evt);
 
	 var option = document.location.search;

	 if(typeof popup_site == 'string')
		{
		 if(option.length > 1)
			{
			 option += '&';
			}
		 else
		 	{
		 	 option = '?';
		 	}
		 option += 'site='+popup_site+'&pop=true&nw=true';
		}
	 else
		{
		 if(option.length > 1)
			{
			 option += '&';
			}
		 else
		 	{
		 	 option = '?';
		 	}
		 option += 'pop=true&nw=true';
		}
	
	 try
	 	{
	 	 var offset = Center(popup_width,popup_height);
	 	 var newwin=window.open(popup_url+option,"mastapopupktu","left="+(offset.Left)+",top="+(offset.Top)+",width="+popup_width+",height="+popup_height+",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no");
	 	 newwin.focus();
	  	}
	  catch(er)
	 	{
		} 
	}
}
