var cssFix = function(){
	var u = navigator.userAgent.toLowerCase(),
	addClass = function(el,val){
		if(!el.className) {
			el.className = val;
		} else {
			var newCl = el.className;
			newCl+=(" "+val);
			el.className = newCl;
		}
	},
	is = function(t){
		return (u.indexOf(t)!=-1)
	};
	addClass(document.getElementsByTagName('html')[0],[
		(!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)
		:is('firefox/2')?'gecko ff2'
		:is('firefox/3')?'gecko ff3'
		:is('gecko/')?'gecko'
		:is('opera/9')?'opera opera9':/opera (\d)/.test(u)?'opera opera'+RegExp.$1
		:is('konqueror')?'konqueror'
		:is('applewebkit/')?'webkit safari'
		:is('mozilla/')?'gecko':'',
		(is('x11')||is('linux'))?' linux'
		:is('mac')?' mac'
		:is('win')?' win':''
		].join(" "));
}();

function formsub() {
	if ($.trim($("#keyword").attr('value')) == '-Keyword-') {
		$("#keyword").attr('value', '');
	}
	$('#advance_search').submit();
}

$(document).ready(function(){
	$('#keyword').each(function() {
		var default_value = '-Keyword-';
		$(this).focus(function(){
			if($.trim($(this).val()) == default_value) {
				this.value = '';
			}
		});

		$(this).blur(function(){
			if($.trim($(this).val()) == '') {
				this.value = default_value;
			}
		});

	});
});



$(document).ready(function(){
  if($.browser.msie){
    $('#category li:last-child').addClass('last');
    $('.templates td:last-child').addClass('last-td');
    $('.pager li:last-child').addClass('last');
    $('#related ul li:last-child').addClass('last');
    $('#recent-posts ul li:last-child').addClass('last');
    $('.ie .preview_image').css(
      'margin-bottom', '5px'
      );

  //alert (heightprimg);
  }
  $('#notification-unsubscribe').hover(
    function(){
      $(this).addClass('hover')
    },
    function(){
      $(this).removeClass('hover')
    }
    );
    //Add class to aff form div wrappers 'field-wrapper'
    $('#aff-form label').closest('div').addClass('field-wrapper');

    //Delete neighborhood delimeters
    $('#menu a').hover(
    function(){
      $(this).closest('li').prev().addClass('remove-border')
    },
    function(){
      if (!$(this).closest('li').hasClass('active')) $(this).closest('li').prev().removeClass('remove-border')
    })
    $('#menu li.active').prev().addClass('remove-border')
    
    
})


 // Get blocks from WP blog
 function getBlock($url,$type,$box) {
  var $target_url = $url + '&do_action=' + $type;
  $.getJSON($target_url, function(response){
      if (response.status) {
          $($box).prepend(response.content);
          processTexts();
          $('#sidebar-footer a[href^="http://"]').attr('target','_blank');
      }
    })
}

