//
//	ic.js
//

function findFrame(win,fname)
{
	if( !win )
		return null
	for( var i=0; i<win.frames.length; i++ )
	{
		var f = win.frames[i]
		if( f==win.frames['data'] )
		{
			if( fname=='data' )
				return f; //found
			continue;
			//skip this frame
			//else when it contains a 'foreign' url, you get a
			// 'Permission denied to get property Window.name'
			// on both IE and Moz
			// at any access, eg f.name
		}

		if( f.name==fname )
			return f
		f = findFrame(f,fname)
		if( f )
			return f
	}
	return null
}

function ic_escape(s)
//
//	return escape(s) but dont touch non-latin1 characters
//
//	to avoid problems like:
//	e.g. euro in cp1250 is 0x80, in unicode 0x20AC
//	IE escape() converts it to %u20AC: not recognized by the server,
//	Moz converts it %80 (ok?),
//	Moz truncates a string at an illegal (undefined-in-cp2150) char
{
	var t = '';
	for( var i=0; i<s.length; i++ )
	{
		var c = s.charAt(i);
		if( c.charCodeAt(0)<256 )
			c = escape(c);
		t += c;
	}
	return t;
}

var tooquick_time=0;
function tooquick()
{
	var d = new Date();
	var t = tooquick_time;
	tooquick_time = d.getTime();
	return (tooquick_time-t<500);
}

function wfed_(cmd,role,title)
{
	if( tooquick() )
		return;
	wfed(cmd,role,title);
}
