$(document).ready(function(){
	$('#search').click(
		function(){
			$('#waiting').show();
			$('#dict_p').hide();
			if(typeof(_IG_AdjustIFrameHeight)=='function')_IG_AdjustIFrameHeight();
			yahoo_dict();
		}
	);
	$('#q').keydown(function(e) {
		var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
		if(key==13){
			$('#search').trigger("click");
		}
		}
	);
	if(typeof(_IG_Analytics)=='function')_IG_Analytics('UA-1787781-10', '/igoogle/yahoo_dict_full');
}
)
function yahoo_dict(){
	var rpc = new PHPRPC_Client('http://bawbaw.deep.tw/yahoo_dict/rpc.yahoo_dict.php', ['yahoo_dict']);
		rpc.yahoo_dict($('#q').val(),function(result){
			$('#dict_p').show();
			$('#waiting').hide();
			$('#dict_p').html(result);
			if(typeof(_IG_AdjustIFrameHeight)=='function'){
				if(Math.floor(Math.random()*1000)%3==1){
					var iframe_src='http://bawbaw.deep.tw/yahoo_dict/gad.html';
					var iframe_str='<iframe width="240px" height="120px" src="'+iframe_src+'" frameborder="0" name="ex"></iframe>';
					$('#wrapper').html(iframe_str);
					if(jQuery.browser.version=='6.0')window.frames["ex"].location.reload();
					$('#wrapper').html(iframe_str);
		
				}else{
					$('#wrapper').html('');
				}
				setTimeout("_IG_AdjustIFrameHeight();", 500);
			}
			if(typeof(_IG_Analytics)=='function')_IG_Analytics('UA-1787781-10', '/igoogle/yahoo_dict_full');
		});
}
function do_yahoo_dict(str){
	$('#q').val(str);
	$('#search').trigger("click");
}