/* Author: 
	Ahoy Man!
*/
$(document).ready(function(){

	if(!Modernizr.input.placeholder){

		$('[placeholder]').focus(function() {
		  var input = $(this);
		  if (input.val() == input.attr('placeholder')) {
			input.val('');
			input.removeClass('placeholder');
		  }
		}).blur(function() {
		  var input = $(this);
		  if (input.val() == '' || input.val() == input.attr('placeholder')) {
			input.addClass('placeholder');
			input.val(input.attr('placeholder'));
		  }
		}).blur();
		$('[placeholder]').parents('form').submit(function() {
		  $(this).find('[placeholder]').each(function() {
			var input = $(this);
			if (input.val() == input.attr('placeholder')) {
			  input.val('');
			}
		  })
		});

	}
	
	var $queryBox = $('form.query'),
		$queryPeek = $('.query.peek');
	
	$queryBox.appear(function(){ $queryPeek.hide(); });
	
	$queryPeek.click(function(){
		$.scrollTo('form.query',1200,{offset:-50,easing:'easeOut'});
		})

	$('#go-top').click(function(){
		$.scrollTo(0,600,{easing:'easeOut'}); 
		return false;
		})
});









$(document).ready(function(){
	// Add class to show jquery is loaded
	$('#infosys').addClass('js-on');


	$('#infosys .selections .selection').not('#infosys #Businesses').hide();
	
	$('#infosys .selections .dropdown').toggle(function(){
			$('#infosys #geo .selection').slideUp(200);
			$(this).next('#infosys .selection').slideDown(400);
			
		},function(){
			$(this).next('#infosys .selection').slideUp(200);
		});
	
	// Add Checkbox Styling
	$('#infosys .state').addClass('jscheckbox');
	
	$('#infosys.js-on .jscheckbox').click(function(){

    var checked = $(this).children('input[type=checkbox]').attr('checked');
    
    if(checked === false){
        $(this).children('input[type=checkbox]').attr('checked',true);
        $(this).addClass('checked');
    }
    if(checked === true){
        $(this).children('input[type=checkbox]').attr('checked',false);
        $(this).removeClass('checked');
    }

	});
	
	$('.list-neighborhood .jscheck input').hide();
	$('.list-neighborhood .jscheck').addClass('yesno');
	
	$('#infosys.js-on .jscheck').click(function(){

		var checked = $(this).children('input[type=checkbox]').attr('checked');
		
		if(checked === false){
			$(this).children('input[type=checkbox]').attr('checked',true);
			$(this).addClass('checked');
		}
		else if(checked === true){
			$(this).children('input[type=checkbox]').attr('checked',false);
			$(this).removeClass('checked');
		}

	});
	
});











