copyright = 'http://javascript.ucoz.net';//   All new scripts for uCoz

search = new Object();
smb = ['error', 'ok', 'search', 'load'];
search.start = function () {
	var q = document.getElementById('ldF1').value;
	if (q.match(/^\s*$/) || q.length < 3) {
		document.getElementById('srchIcon').src = copyright + '/upload/icons/' + smb[0] + '.png';
		_uWnd.alert('???????? ??????? ????????', '??????', {
			w: 200,
			h: 70,
			tm: 2500
		});
		setTimeout("document.getElementById('srchIcon').src = copyright+'/upload/icons/'+smb[2]+'.png';", 2500);
		return;
	}
	else {
		document.getElementById('srchIcon').src = copyright + '/upload/icons/' + smb[3] + '.gif';
		$.post("/load/", {
			query: q,
			a: 2
		},
		function (r) {
			var qw = $(".entryLink:first", r).attr("href");
			if (!qw) {
				document.getElementById('srchIcon').src = copyright + '/upload/icons/' + smb[2] + '.png';
				_uWnd.alert('????? ?? ??? ???????????', '??? ???????????', {
					w: 200,
					h: 70,
					tm: 2500
				}); _uWnd.close('likeThis');
				return;
			}
			else {
document.getElementById('srchIcon').src = copyright + '/upload/icons/' + smb[1] + '.png';
				h = _uWnd.getdims();
				j = h.clientW - 300 - 5;
				g = h.clientH - 210 - 5;

				new _uWnd('likeThis', '??????? ????????? ???????', 300, 200, {
					min: 0,
					max: 0,
					x: j,
					y: g,
					alert: 1,
					autosize: 0,
					icon: copyright + '/upload/icons/' + smb[2] + '.png',
					fixed: 1,
					shadow: 1,
					resize: 0,
					nomove: 1,
					hidden: 0,
					notaskbar: 1,
					fadetype: 0,
					fadespeed: 0,
					fadeclosetype: 2,
					fadeclosespeed: 500,
					align: 'left'
				},
				'<fieldset><legend>' + q + '</legend><div id="likeThis"> </div></fieldset>');

				setTimeout(function () {
					$(".entryLink", r).each(function () {
						var hrf = $(this).attr("href");
						var txt = $(this).html();
						document.getElementById('likeThis').innerHTML += '<a href="' + hrf + '" target="_blank" title="????????? ? ????? ????">' + txt + '</a><br>';

					});
				},
				101);

                       setTimeout(function(){ document.getElementById('srchIcon').src = copyright + '/upload/icons/' + smb[2] + '.png'; }, 2000);
			}
		});

	}
}
search.show = function () {
	var icon = document.createElement('img');
	icon.style.border = 0;
	icon.style.paddingLeft = 3;
	icon.src = copyright + '/upload/icons/' + smb[2] + '.png';
	icon.align = 'absmiddle';
	icon.id = 'srchIcon';
	icon.style.cursor = 'pointer';
	icon.title = '?????? ?? ????????';
	icon.onclick = search.start;
	document.getElementById('ldF1').style.width = '94%';
	document.getElementById('ldM5').appendChild(icon);
}
search.show();