/* �֥饦��Ƚ�� */
var ie=document.all ? 1 : 0;
var ns6=document.getElementById&&!document.all ? 1 : 0;
var opera=window.opera ? 1 : 0;

/* �ҥ�˥塼��ɽ������ɽ������ */
function openFolder(childObj, number){
    var child="";
//    if (ie || ns6 || opera){
//            child = ns6 ? document.getElementById(childObj).style : document.all(childObj).style;
//            if (child.display=="none") {
//                child.display="block";
//            } else {
//                child.display="none";
//        }
//    }
    jQuery('#'+childObj).slideToggle();
    // ���ƶ�����ä����Τ����ƥ����å�
    var name_reg = new RegExp('^subjob\\[' + number + '\\]');
    var checkboxes = $A(document.getElementsByTagName('input')).findAll(function(element) {
        return element.name.match(name_reg);
    });
    if (checkboxes.find(function (element) { return element.checked; }) === undefined) {
        checkboxes.each(function (element) {
            element.checked = true;
        });
    }
}

function setcolor(obj0,sw1) {
  if (sw1 == 0) {
    bd = '1px solid #F5F5F5';
    bgc = '';
  } else {
    bd = '1px solid #71AFEE';
    bgc = '#EEF7FB';
  }
  obj0.style.border = bd;
  obj0.style.backgroundColor = bgc;
}

/* �̿��ڤ��ؤ� */
var photo_index = {};
function nextPhoto(id) {
	if (photo_index[id] === undefined) photo_index[id] = 0;
	photo_index[id]++;
	if (image_exists[id].length-1 < photo_index[id]) {
		photo_index[id] = 0;
	}
	$('photo_' + id).src = "http://j-sen.jp/img/job_pict/" + id + "/" + image_exists[id][photo_index[id]] + ".jpg"; 
}

function backPhoto(id) {
	if (photo_index[id] === undefined) photo_index[id] = 0;
	photo_index[id]--;
	if (photo_index[id] == -1) {
		photo_index[id] = image_exists[id].length-1;
	}
	$('photo_' + id).src = "http://j-sen.jp/img/job_pict/" + id + "/" + image_exists[id][photo_index[id]] + ".jpg"; 
}

function setObserver() {

//	new Form.Observer('searchConditionBox', 0.3, updateCounter);
		var inputs = $('searchConditionBox').getInputs();
		[].push.apply(inputs, $('searchConditionBox').getElements('select'));
		inputs.each(function (element) {
			element.observe('change', setUpdateCounter);
		});
		//setUpdateCounter();
}

Event.observe(window, 'load', setObserver);

function setUpdateCounter() {
	setTimeout(updateCounter, 100);
}

function updateCounter() {
	var timer = setInterval(setRandom, 30);
	var value = $('searchConditionBox').serialize();
	var url = '/change/count';
	var myAjax = new Ajax.Request(
		url, 
		{
			method: 'get',
			parameters: value,
			onSuccess: function(transport) {
				clearInterval(timer);
				$('match_number').update(transport.responseText);
		}
	});
}

function setRandom() {
	$('match_number').update((Math.random()*1000).floor());
}




