var MyApp = {};
(function(){
	var dom=document, win=window, loc=win.location, _write=dom.write;
	var b_false=false,b_true=true;

	MyApp.$ = function(id) {
		return dom.getElementById(id);
	}

	MyApp.$F = function(id) {
		return dom.getElementById(id).value;
	}

	//搜索
	MyApp.doSearch = function(){
		var keyword = MyApp.$('keyword').value;
		if(keyword.length>20) {
			alert('关键字超常。');
		}
		else if(keyword.length==0) {
			alert('关键字不能为空。');
		}
		else {
			win.location = 'http://'+MyApp.domain+'/search/'+encodeURI(keyword);
		}
		return b_false;
	}

	MyApp.header = function(){
		_write('<div id="top">');
		_write('<span id="top_left"></span>');
		_write('<span class="top_right">');
		_write('<a href="http://www.jpgarden.cn/">青木首页</a> |');
		_write('<a href="http://dict.jpgarden.cn/">在线词典</a> |');
		_write('<a href="http://geci.jpgarden.cn/">青木歌词站</a> |');
		_write('<a href="http://word.jpgarden.cn/">单词通</a> |');
		_write('<a href="http://type.jpgarden.cn/">打字通</a> |');
		_write('<a href="http://vip.word.jpgarden.cn/" style="color:red;">单词通VIP版</a> |');
		_write('<a href="http://rome.jpgarden.cn/">罗马字</a> |');
		_write('<a href="http://news.jpgarden.cn/">青木日语新闻</a> |');
		_write('<a href="http://spell.jpgarden.cn/">假名转换</a> |');
		_write('<!--<a href="http://hao.jpgarden.cn/">青木网址</a> |-->');
		_write('</span>');
		_write('</div>');
	}
})();