
jQuery.fn.selectBox=function(settings){
return this.each(function(){
var el=$(this);
el.hover(function(){$(this).addClass("CRselectBoxHover");},
function(){$(this).removeClass("CRselectBoxHover");});
$('.CRselectValue',el).click(function(){
if($('.CRselectBoxOptions',el).is(':hidden')){
$(this).blur();
$(this).next('.CRselectBoxOptions').slideDown();}else{
$('.CRselectBoxOptions').hide();}
return false;});
$('.CRselectBoxItem a',el).click(function(){
$(this).blur();
$('.CRselectValue',el).text($(this).text());
$('.CRselectBoxItem a',el).removeClass('selected');
$(this).addClass('selected');
$('.CRselectBoxOptions',el).hide();});
$(document).click(function(event){
if(event.target!=el){
$('.CRselectBoxOptions').hide();}});});};

