
$(document).ready(function(){
	CRselectBox("province-box");
	CRselectBox("city-box");
	CRselectBox("industry-box");
	CRselectBox("produce-box");
	CRselectBox("units-box");
	CRselectBox("sex-box");
})

function CRselectBox(domId) {
	var boxDom=$("#"+domId);
	var boxValueDom=boxDom.find(".CRselectValue");
	var boxItemsContentDom=boxDom.find("ul");
	var boxItemsDom=boxDom.find("ul").find("a");
	boxDom.hover(function(){   
		$(this).addClass("CRselectBoxHover");
	},function(){
		$(this).removeClass("CRselectBoxHover");
	});
	boxValueDom.click(function(){
		$(this).blur();
		boxItemsContentDom.slideDown("fast");
		return false;
	});
	boxItemsDom.click(function(){
		$(this).blur();
		var value = $(this).attr("rel");
		var txt = $(this).text();
		$("#abc").val(value);
		$("#abc_CRtext").val(txt);
		boxValueDom.text(txt);
		boxItemsDom.removeClass("selected");
		$(this).addClass("selected");
		boxItemsContentDom.hide();
		return false;
	});
	$(document).click(function(event){
		if( $(event.target).attr("class") != "CRselectBox" ){
			boxItemsContentDom.hide();
		}
	});
}









