function get_obj(objectId) {
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId);
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId);
	} else if (document.layers && document.layers[objectId]) {
		return document.layers[objectId];
	} else {
	    return false;
	}
}
function set_val(oid,v){get_obj(oid).value=v;}
function set_typ(v){
	set_val('typ',v);
	init_opts();
	if (get_obj('sq').value) {
		get_obj('search_form').submit();
	}
}

function init_opts(){
	var obj;
	total = 12;
	typ = parseInt(get_obj('typ').value);
	for (i = 1; i <= total; i++) {
		if (!(obj = get_obj('opt'+i))){
			continue;
		}
		cont = obj.innerHTML;
		obj_c = get_obj('opt'+i+'_c')
		if (i == typ) {
			obj_c.innerHTML = '<b>'+cont+'</b>';
		} else {
			obj_c.innerHTML = '<a href="javascript:set_typ('+i+');">'+cont+'</a>';
		}
	}
}
var imgbox_step, imgbox_width, imgbox_div, imgbox_pause;
function scroll_imgbox() {
	if (imgbox_pause) {
		return;
	}
	imgbox_div.scrollLeft = imgbox_div.scrollLeft + imgbox_step;
	if (imgbox_div.scrollLeft >= imgbox_last) {
		imgbox_div.scrollLeft = imgbox_last;
		imgbox_step = imgbox_step * (-1);
	}
	if (imgbox_div.scrollLeft <= 0) {
		imgbox_div.scrollLeft = 0;
		imgbox_step = imgbox_step * (-1);
	}
}
function toggle_imgbox() {
	imgbox_pause = !imgbox_pause;
}
function start_imgbox(img_count) {
	imgbox_pause = false;
	imgbox_step = 2;
	imgbox_div = get_obj('image_box_inner');
	imgbox_div.scrollLeft = 0;
	imgbox_last = img_count * 105 - 315;
	setInterval("scroll_imgbox()", 100);
}
