function link(link) {
	document.location.href = link;
    return false;
}

function winopen (popupURL,width,height) {
        var popup = window.open(popupURL,"popup",'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=' + width + ',height=' + height + ',left=0' );
        popup.focus();
        if( navigator.appName.substring(0,8) == "Netscape" ) {
                popup.location = popupURL;
        }
}

function ex(a,name){
    name=name||"str";
    var f=document.str;
    f[name].value=a.innerText?a.innerText:a.firstChild.nodeValue;
    f[name].focus()
}

$(document).ready(function(){
	function liFormat (row) {
		var result = row[0] + '<p class="' + row[2] + '">' + row[1] + '</p>';
		return result;
	}

    $("#str").result(function(event, data, formatted) {
        document.str.hidid.value = data[3];
        document.str.submit();
    });

	$("#str").autocomplete("/in_auto.php", {
		delay:400,
		minChars:2,
		matchSubset:1,
		autoFill:false,
		matchContains:1,
		cacheLength:1,
		selectFirst:true,
		formatItem:liFormat,
		maxItemsToShow:4
	});

});
