$.initSelectbox = function() {			
			
	$('.selectbox').each( function(i,selectbox) {
		
		if($(".options",selectbox).height() > $(".select",selectbox).height() ) {
			$(".select",selectbox).addClass("scroll");
		}
		
		$(".select", this).hide();
				
		$(selectbox).click( function() {			
			$(this).addClass("is_active");
			$('.select',this).slideDown("normal");				
			if($('input[name="type"]',selectbox).val()=='input') {
				$('.options .option',selectbox).click(function(){					
					$('input[name="key"]',selectbox).val($('.key',this).html());
					$('input[name="value"]',selectbox).val($('.value',this).html());
					$('input[name="'+$('input[name="name"]',selectbox).val()+'"]',selectbox).val($('.value',this).html());
					
					$('.title',selectbox).html($('.key',this).html());
					
					$.hideSelectbox(selectbox);
				});
			} else if($('input[name="type"]',selectbox).val()=='link') {		
				$('.options .option',selectbox).click(function(){					
					location.href=$('.value',this).html();
					$.hideSelectbox(selectbox);
				});
			}						
			setTimeout(
				function(){
					$.hideSelectbox(selectbox);
				},
				50
			);
		});
		
		if($.trim($(".title",selectbox).html())=='') {
			$('input[name="key"]',selectbox).val($('.options .option:eq(0) .key',this).html());
			$('input[name="value"]',selectbox).val($('.options .option:eq(0) .value',this).html());
			$('input[name="'+$('input[name="name"]',selectbox).val()+'"]',selectbox).val($('.options .option:eq(0) .value',this).html());
			
			$('.title',selectbox).html($('.options .option:eq(0) .key',this).html());
		}
		
	});
	
	$.hideSelectbox = function(selectbox) {		
		$("body").bind("click", function() {
			$('.select',selectbox).slideUp("fast", function() {				
				$(selectbox).removeClass("is_active");
				$("body").unbind("click");				
			});				
		});
	} 
}
