function customselect()
{
	var ele = jQuery(".cselect");
	ele.each(function(i){
		var opts = jQuery('li', this);
		opts.each(function(j){
			if (j%2 == 0)
				jQuery(this).addClass('even');
			else
				jQuery(this).addClass('odd');
			jQuery(this).click(function(){
				var parent = jQuery(this).parent();
				var id = jQuery(parent).attr('id');
				id = id.replace('b_', '');
				var value = jQuery(this).attr('optvalue');
				setCSelectBoxValue(id, value, this);
			});
		});
		var box = jQuery('.cselect_box_text', this);
		jQuery(box).click(function(){
			var id = jQuery(this).attr('id');
			id = id.replace('l', 'b');
			hideAllCustomSelectBox(id);
			showCustomSelectBox(id, 0, 20);
			return false;
		});
		jQuery(box).blur(function(){
			var id = jQuery(this).attr('id');
			id = id.replace('l', 'b');
			hideCustomSelectBox(id);
			return false;
		});
	});
	window.onclick = function()	{
		hideAllCustomSelectBox();
	}
	
}
function showCustomSelectBox(id, left, top)
{
	var width = jQuery('.cselect-box-text').innerWidth();
	jQuery('#' + id).css("left", left + "px");
	jQuery('#' + id).css("top", top + "px");
	if (jQuery('#' + id).css("display") != 'block')
		jQuery('#' + id).show();
	else
		jQuery('#' + id).hide();
}

function hideCustomSelectBox(id_arr)
{
	setTimeout('_hideCustomSelectBox("' + id_arr + '")', 200);
}
function _hideCustomSelectBox(ids)
{
	var idArr = ids.split(":");
	for(var i=0;i<idArr.length; i++)
		jQuery('#' + idArr[i]).css("display", 'none');
}
function hideAllCustomSelectBox(id)
{
	var boxes = jQuery('.cselect_box_text');
	boxes.each(function(i){
		var bid = jQuery(this).attr('id');
		bid = bid.replace('l', 'b');
		if (id != bid)
		{
			hideCustomSelectBox(bid);
		}
		
	});
}
function setCSelectBoxValue(id, value, obj)
{
//	if(jQuery('#v_' + id).val() != value)
//	{
		jQuery('#v_' + id).val(value);
		jQuery('#l_' + id).html(jQuery(obj).html());
		jQuery('#b_' + id).hide();
//	}
}