$(document).ready(function(){
	
	/*$('input[name=rdoParking]').each(function(index){	
		$(this).attr("disabled", "disabled");
	});*/
	
	
	
	if($('input[name="Parking"]').attr("checked") == false){	
		disbaleInput('rdoParking');
	}
	
	if($('input[name="environmentalAmenities"]').attr("checked") == false){
		disbaleInput('exenvironmentalAmenities');
	}
	
	if($('input[name="commonArea"]').attr("checked") == false){
		disbaleTextArea('otherCommonArea');
	}
	
	if($('input[name="hookups"]').attr("checked") == false){
		disbaleInput('washerHookups');
	}
	
	if($('input[name="flooring"]').attr("checked") == false){
		disbaleInput('optflooring');
	}
	
	if($('input[name="ketchenfeatures"]').attr("checked") == false){
		disbaleInput('optketchenfeatures');
	}
	
	if($('input[name="store"]').attr("checked") == false){
		disbaleInput('kitchen');
	}
	
	if($('input[name="other"]').attr("checked") == false){
		disbaleTextArea('txtareaother');
	}
	
	if($('input[name="IndoorGym"]').attr("checked") == false){
		disbaleInput('equipment');
	}
		
	$('input[name="Parking"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('rdoParking');
		}else{
			disbaleInput('rdoParking');
		}
	});
			
	$('input[name="environmentalAmenities"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('exenvironmentalAmenities');
		}else{
			disbaleInput('exenvironmentalAmenities');
		}
	});

	$('input[name="IndoorGym"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('equipment');
		}else{
			disbaleInput('equipment');
		}
	});
			
	$('input[name="commonArea"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableTextArea('otherCommonArea');
		}else{
			disbaleTextArea('otherCommonArea');
		}
	});
			
	$('input[name="hookups"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('washerHookups');
		}else{
			disbaleInput('washerHookups');
		}
	});
		
	$('input[name="flooring"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('optflooring');
		}else{
			disbaleInput('optflooring');
		}
	});
			
	$('input[name="ketchenfeatures"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('optketchenfeatures');
		}else{
			disbaleInput('optketchenfeatures');
		}
	});
			
	$('input[name="store"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableInput('kitchen');
		}else{
			disbaleInput('kitchen');
		}
	});
			
	$('input[name="other"]').click(function(elem){
		if($(this).attr('checked') == true){
			enableTextArea('txtareaother');
		}else{
			disbaleTextArea('txtareaother');
		}
	});	
	
	
	$("ul#menu-header_menu li:last-child .menu_separator").hide();
	$("ul#menu-main_menu li:last-child .main_menu_separator").hide();
	$("ul#menu-blog_menu li:last-child .main_menu_separator").hide();
		
	$("a.projects-link").mouseover(function(){
		$(this).find("img").hide();
		$(this).find("img:last").show();
	}).mouseout(function() {
		$(this).find("img").hide();
		$(this).find("img:first-child").show();				
	});		
});
		
function disbaleInput(chkName){
	$('input[name='+chkName+']').each(function(index){
		$(this).attr("disabled", true);
	});
}
	
function disbaleTextArea(chkName){
	$('textarea[name='+chkName+']').each(function(index){
		$(this).attr("disabled", true);
	});
}
		
function enableInput(chkName){
	$('input[name='+chkName+']').each(function(index){
		
		if($(this).attr("type") == "radio" && index == 0){
			$(this).attr("checked", "checked");	
		}
		
		$(this).attr("disabled", false);
	});
}
		
function enableTextArea(chkName){
	$('textarea[name='+chkName+']').each(function(index){
		$(this).attr("disabled", false);
	});
}		
