jQuery(function(){
	jQuery('.button-color, .button-red, .button-blue, .button-small-green, .button-ss, .button-orange, .button-green, .button-gray').each(function(){
			var button=this;
			var $button=jQuery(this);
			var classes=button.className;
			$button.mousedown(function(){
				button.className="";
				jQuery.each((classes || "").split(/\s+/), function(i, className){
				var m=className.match(/(button-(.)+)/);
						if (m){
							button.className += " " + m[1]+"-down";
							}
						else{
						button.className += " " + className;
						}
					});
			});
			
			
			$button.mouseup(function(){
				button.className=classes;
			});
		});
		
	jQuery("input:submit").focus(function(){
		jQuery(this).blur();
	});
	});
	
	
	
	jQuery(function(){
	jQuery('.selling a, .mortgage a, .blue-selling a').each(function(){
			var button=this;
			var $button=jQuery(this);
			$button.mousedown(function(){
				$button.addClass('down');
			});
			
			
			$button.mouseup(function(){
				$button.removeClass('down');
			});
		});
	});


	jQuery(document).ready(function() {

	    /* =Drop Down
	    ---------------------------------------- */
	jQuery(".top-navigation ul li").bind("mouseover", function() {
	        jQuery(this).find("div").show();
	    });
	    jQuery(".top-navigation ul li").bind("mouseout", function() {
	        jQuery(this).find("div").hide();
	    });

	});

	function getElementsWidth(list) {
	    var W = 0;
	    list.each(function() {
	        W += jQuery(this).width() + parseInt(jQuery(this).css('marginLeft'), 10);
	    });
	    return W
	}
	
	function GetParameterByName(name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regexS = "[\\?&]" + name + "=([^&#]*)";
            var regex = new RegExp(regexS);
            var results = regex.exec(window.location.href);
            if (results == null)
                return "";
            else
                return results[1];
        }
        
function trim(str)
{
    return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
