var image_files_cnt = 1;

function townSelect(value){
	var abc = document.getElementById('add_abc');
	abc.value = value;
	abc.select();
}

function townKeyPress(value){
	var towns = document.getElementById('town');
	towns.selectedIndex = -1;
	var len = value.length;
	var first = true;
	for (var i=0; i < towns.options.length; i++){
		if(towns.options[i].text.substring(0, len) == value){
			if(first == true){
				//towns.selectedIndex = i;
				first = false;
			}
			towns.options[i].style.display = '';
		} else {
			towns.options[i].style.display = 'none';			
		}
    }
}

function openPage(page, cnt){
	var url = location.href;
	url = url.substr(0,url.indexOf('?'));
	if (url == '') url = location.href;
	
	document.srch.action =  url + "?page="+page+"&per="+cnt;
	document.forms[0].submit();
}

function addFileField(){
	if(image_files_cnt<8){
		image_files_cnt++;
		document.getElementById('image_'+image_files_cnt).style.display = 'block';		
	}
}
$(document).ready(function(){
	
	//$(".accordion2 h3").eq(2).addClass("active");
	//$(".accordion2 p").eq(2).show();

	$(".accordion h3").click(function(){
		$(this).next("div").slideToggle("slow")
		.siblings("div:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});
	$(".accordionMore h3").click(function(){
		$(this).next("div").slideToggle("slow")
		.siblings("div:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

});
