//var s_hashNameWindow = false;
//
//function InitHashNameWindow()
//{
//	if ( !IsHashNameWindow())
//	if ( IsIE())
//		s_hashNameWindow = new CHash();
//	return s_hashNameWindow;
//}
//
//function IsHashNameWindow()
//{
//	if ( s_hashNameWindow)
//		return true;
//	return false;
//}
//
function SetFocusSafe( win)
{
	if ( win)
	{
		// Set focus without try catch is not working in IE 7
		try
		{
			//alert( 'win = '+win);
			win.focus();
		}
		catch ( e)
		{
			//alert( 'error set focus: '+e.description);
		}
	}
}
//function SetPopupFocusOnTimer( strName)
//{
//	var hashNameWindow = InitHashNameWindow();
//	if ( hashNameWindow)
//	{
//		SetFocusSafe( hashNameWindow.Item( strName));
//	}
//}

function PopupWindow( strUrl, strName, strFeatures, bReplace)
{
	var win = window.open( strUrl, strName, strFeatures, bReplace);

	//var hashNameWindow = InitHashNameWindow();
	//if ( hashNameWindow)
	//{
	//	hashNameWindow.Set( strName, win);
	//	// Set focus without timer is not working in IE 6
	//	// But set focus with time gives error message
	//	setTimeout( 'SetPopupFocusOnTimer( "'+strName+'")', 1000);
	//}
	//else
	//{
		SetFocusSafe( win);
	//}

	return win;
}

function SpawnMediaEx( typ, filename, headword, def, caption, width, height, nHeightTitle, soundFile) 
{
	//def=def.replace("_","'");
	var sizeX=width + 20;
	var sizeY=height+nHeightTitle+20;
	if (sizeX==0) { sizeX=360 }
	if (sizeY==0) { sizeY=360 }
	var posX=(screen.width-sizeX)/2;
	var posY=10;
	var windowfeatures = 'channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0,top='+posY+',left='+posX+',width='+sizeX+',height='+sizeY;
	var newWin = PopupWindow( 'popup.php?type='+typ+'&filename='+filename+'&headword='+headword+'&def='+def+'&cap='+caption+'&width='+width+'&height='+height+'&sndfile='+soundFile, typ, windowfeatures, 1);
	//newWin.focus();
}
  
function SpawnAudio( filename, headword) 
{
	filename=""+filename;
	var sizeX=350;
	var sizeY=350;
	var posX=(screen.width-sizeX)/2;
	var posY=(screen.height-sizeY)/2;
	var windowfeatures = 'channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0,top='+posY+',left='+posX+',width='+sizeX+',height='+sizeY;
	var newWin = PopupWindow( 'popup_audio.php?filename='+filename+'&headword='+headword, 'audio', windowfeatures, 1);
	//newWin.focus();
}

function WcdHelp( filename) 
{
  	var sizeX=750;
  	var sizeY=470;
  	var posX=(screen.width-sizeX)-20;
  	var posY=10;
  	var windowfeatures='channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,top='+posY+',left='+posX+',width='+sizeX+',height='+sizeY;
  	var helpWin = PopupWindow( filename, 'help', windowfeatures, 1);
  	//helpWin.focus();
} 

function PopupHelpPage( filename, nWidth, nHeight)
{
	var sizeX=nWidth;
	var sizeY=nHeight;
	if (sizeX==0) { sizeX=500 }
	if (sizeY==0) { sizeY=500 }
	var posX=(screen.width-sizeX)/2;
	var posY=10;
	var windowfeatures='channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,top='+posY+',left='+posX+',width='+sizeX+',height='+sizeY;
	var newWin = PopupWindow( filename, 'help', windowfeatures, 1);
	//newWin.focus();
}
