$(function(){
	$("#navigation ul li").hover(function() {
		if(!($(this).find(".dd-holder").is(':animated')))
    	{
    		$(this).find(".dd-holder").slideDown();
    		$(this).find("a:eq(0)").addClass('hover');
    	}
			
		}, function(e) {
		 
		$(this).find(".dd-holder").slideUp();
		$(this).find("a:eq(0)").removeClass('hover');
	});
	
	$('select').selectbox();
	
	$('.blink').focus(function () {
		if ($(this).val() == $(this).attr('title')) {
			$(this).val('');
		}
	});
	
	$('.blink').blur(function () {
		if ($(this).val() == '') {
			$(this).val($(this).attr('title'));
		}
	}); 
	
	$('.pass-false').focus(function(){
		$(this).hide();
		$(this).next().show();
		$(this).next().focus();
	});
	
	$('.method').live('click', function(){
		if($(this).parent().find('.pop-up').is(":visible")){
			$(this).parent().find('.pop-up').fadeOut('fast');
		}
		else {
			$('.method-holder').find('.pop-up').fadeOut('fast')
			$(this).parent().find('.pop-up').fadeIn('fast');
		}
	});
	
	
	$('.pop-up input.form-reset').live('click', function(){
		$('.pop-up').fadeOut('fast');
	});
	
	$("#slider-range").slider({
		range: true,
		step: 50,
		min: 0,
		max: 1000,
		values: [0, 1000],
		slide: function(event, ui) {
			if(ui.values[1]==1000){
				if(ui.values[0]==1000){
					$("#amount").val( ui.values[0]/1000 +'Milion - ' + ui.values[1]/1000 + 'Milion +');
				}
				else {
					$("#amount").val( ui.values[0] +'K - ' + ui.values[1]/1000 + 'Milion +');
				}
			}
			else {
				$("#amount").val( ui.values[0] +'K - ' + ui.values[1] + 'K +');
			}
		}
	});
	
	if($("#slider-range").slider("values", 1) == 1000){
		$("#amount").val($("#slider-range").slider("values", 0) + 'K - 1 Milion +');
	}
	else{
		$("#amount").val($("#slider-range").slider("values", 0) + ' K -' + $("#slider-range").slider("values", 1)+'K +');
	}
	
	$("#slider-range2").slider({
		range: true,
		step: 50,
		min: 5,
		max: 1500,
		values: [0, 1500],
		slide: function(event, ui) {
			$("#amount2").val( '$'+ui.values[0] +' - $' + ui.values[1] + ' +');
		}
	});
	
	$("#amount2").val('$'+$("#slider-range2").slider("values", 0) + ' - $' + $("#slider-range2").slider("values", 1)+'+');
	
	$("#slider-range3").slider({
		range: true,
		step: 25,
		min: 0,
		max: 500,
		values: [0, 500],
		slide: function(event, ui) {
			$("#amount3").val( ui.values[0] +'K - ' + ui.values[1] + 'K +');
		}
	});
	
	$("#amount3").val($("#slider-range3").slider("values", 0) + ' K -' + $("#slider-range3").slider("values", 1)+'K +');
	
	$('a.box-pop-up').live('click', function(){
		$(this).parent().next('.table-box').show();
		$(this).hide();
		return false;
	});
	
	$('input.reset-button').live('click', function(){
		$(this).parent().parent().parent().parent().find('a.box-pop-up').show();
		$(this).parents('.table-box').hide();		
	});
	
	$('input.red-submit').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	});
	
})
