function isdefined(object, variable) {
	return (typeof(eval(object)[variable]) != 'undefined');
}

function initSel(){
	var _hold = document.getElementsByTagName('div');
	for(var i = 0 ; i < _hold.length ; i++){
		if(_hold[i].className.indexOf('psevdo-select-type2') !=-1){ _Sel(_hold[i]);}
		if(_hold[i].className.indexOf('select-element') !=-1){ _Sel(_hold[i]);}
	}
	
	// some post processing if needed
	
	if (isdefined('window','divreeksaction') && divreeksaction=='hide') {
		$('#divreeks').hide();
	}	
}

function _Sel(_block){
	
	var _timer;
	var _box = _block.getElementsByTagName('div')[0];
    
	_box.onclick = function(){
		if(this.className.indexOf('open') != -1){ this.className = this.className.replace('open','');}
		else{ this.className += ' open '; }
	}
	_box.onmouseover = function(){ if (_timer) clearTimeout(_timer);}
	_box.onmouseout = function(){ hideSel(this);}
	
	function hideSel(_bx){
		_timer = setTimeout(function(){
			_bx.className = _bx.className.replace('open','');
		}, 200);
	}
}

if (window.addEventListener){
	window.addEventListener("load", initSel, false);
}
else if (window.attachEvent){
	attachEvent("onload", initSel);
}

