Cufon.replace(".phone .value, .apple_symbols");


(function($){

	$.fn.custom_select = function()
	{
		$(document).mousedown(function(event)
		{
			if ($(event.target).parents('.custom_select').length === 0)
				$('.custom_select ul').hide();
		});
		
		return this.each(function(index)
		{
			custom_select_init(this, index);
		});
	};

	var custom_select_init = function(element, index)
	{
		var select_elem = $(element);
		var select_w = select_elem.outerWidth();
				
		select_elem.wrap('<div class="custom_select_wrapper"></div>');
		var select_wrapper = select_elem.parent();
		select_wrapper.width(select_w);
		index = (index) ? index : 0;
		select_wrapper.css('zIndex',100-index);
		
		select_elem.after('<div class="custom_select"><div><span class="text"></span><span class="opener"></span></div><ul></ul></div>');
		var select_custom = $(element).siblings('.custom_select').width(select_w);
		var select_text = jQuery('.text', select_custom);
		var select_opener = jQuery('.opener', select_custom);
		select_text.width(select_w - select_opener.width() - parseInt(select_text.css('padding-left')) - parseInt(select_text.css('padding-right')));
		
		ul = $('div', select_custom).siblings('ul');
		ul.width(select_w-2);
		
		if( jQuery.browser.msie && jQuery.browser.version < 7 )
		{
			select_elem.after('<iframe src="javascript:\'\';" marginwidth="0" marginheight="0" align="bottom" allowTransparency="true" scrolling="no" tabIndex="-1" frameborder="0"></iframe>');
			select_elem.next().css({height:select_elem.height()+4+'px', width:select_elem.width()+4+'px'}).animate({opacity: "0"}, "fast");
		}
		
		custom_select_update(element);
		
		$('div', select_custom).click(function()
		{
			ul = $(this).siblings('ul');
			if (ul.css('display')=='none')
				$('.custom_select ul').hide()
			ul.slideToggle(100);
			var offset = ($('a.selected', ul).offset().top - ul.offset().top);
			ul.animate({scrollTop: offset});
			return false;
		});
	};

	var custom_select_update = function(element)
	{
		var select_elem = $(element);
		var select_custom = select_elem.siblings('.custom_select');
		var $ul = select_custom.find('ul').find('li').remove().end().hide();
		$('option', select_elem).each(function(i){
			$ul.append('<li><a href="#" index="'+ i +'">'+ this.text +'</a></li>');
		});

		$ul.find('a').click(function()
		{
			$('a.selected', select_custom).removeClass('selected');
			$(this).addClass('selected');	
			if( select_elem[0].selectedIndex != $(this).attr('index') && select_elem[0].onchange )
			{
				select_elem[0].selectedIndex = $(this).attr('index');
				select_elem[0].onchange();
			}
			select_elem[0].selectedIndex = $(this).attr('index');
			$('span:eq(0)', select_custom).html($(this).html());
			$ul.hide();
			return false;
		});

		$('a:eq('+ select_elem[0].selectedIndex +')', $ul).click();
	};

	$(function()
	{
		$('select.custom_select').custom_select();
	});
})(jQuery);

$.fn.overlay=function() {
	var el=$(this);
	$('body').prepend('<div id="fancy_overlay"></div>');
	$('#fancy_overlay').click(function()
	{
		$('#fancy_overlay').remove();
		$('.popup').hide();
	});
	$('#fancy_overlay').show('slow');
	return this;
}

$(document).ready(function(){

	$('.list_questions .item .q a').click(function() {
		$(this).parent().next().toggle();
		return false;
	});
	
	$('.my_question').click(function()
	{
		$('#send_question').show().overlay().centering(1,1);
		return false;
	});
	
	$('.popup .close').click(function()
	{
		$('#fancy_overlay').remove();
		$('.popup').hide();
		return false;
	});
	
        $('.list_questions .item .q a').parent().next().toggle();

});

