jQuery(document).ready(function() {
	Cufon.replace("h3", {textShadow: "1px 1px #fff", hover: true});
	Cufon.replace(".widgettitle");		
	Cufon.replace(".date-month", {textShadow: "1px 1px #D2E1AF"});
	Cufon.replace("#subscribe a", {textShadow: "1px 1px #fff", hover: true});
	Cufon.replace(".mainmenu a:not(.current_page_item a)", {textShadow: "1px 1px #fff", fontSize: '15px', hover: true});
	Cufon.replace(".mainmenu li.current_page_item a", {textShadow: "1px 1px #3B5011", fontSize: '15px',hover: false});
	jQuery(".mainmenu li").eq(3).css("padding-left", "28px");
	jQuery(".date-day").each(function(i) {
		jQuery(this).before("<span>" + jQuery(this).text() + "</span>");
	});
	jQuery(".comments a").each(function(i) {
		jQuery(this).before("<span>" + jQuery(this).text() + "</span>");
	});
	jQuery(".tabs .list a").each(function(i) {
		jQuery(this).before("<span></span>");
	});
	jQuery(".tabs h3 a").each(function(i) {
		jQuery(this).before("<div class='tab-left'></div>").after("<div class='tab-right'></div>").click(function () {
			var p = jQuery(this).parent();
			if (!p.hasClass("current")) {
				p.siblings().removeClass("current");
				p.siblings(".tab").toggle("slow");
				p.siblings(".list").toggle("slow");
				//jQuery("#" + p.attr("title")).slideDown("slow");
				p.addClass("current");
			}
			return false;
		});
	});
	jQuery(".post-tags li").hover(function () {
		jQuery(this).addClass("current");
	}, function () {
		jQuery(this).removeClass();
	});
	var icon = ["index","about","service","referal","ad"];
	jQuery(".mainmenu li").each(function(i) {
		if (jQuery(this).hasClass("current_page_item")) {
			jQuery(this).before("<div class='icon " + icon[i] + "'></div>");
		}
	});
	jQuery(".wp-polls-form .Buttons").attr("value", " ");
	jQuery("#s").attr("value", "поиск").focus(function () {
		this.value = this.value == "поиск" ? "" : this.value;
	}).blur(function () {
		this.value = !this.value ? "поиск" : this.value;
	});
	
	jQuery(".entry img").addClass("corners");
	jQuery(".entry img").addClass("iradius12");
jQuery(".entry img").addClass("margin");

		// xhtml 1.0 strict way of using target _blank
	jQuery('.sexy-bookmarks a.external').attr("target", "_blank");

	// this block sets the auto vertical expand when there are more than 
	// one row of bookmarks.
	var sexyBaseHeight=jQuery('.sexy-bookmarks').height();
	var sexyFullHeight=jQuery('.sexy-bookmarks ul.socials').height();
	if (sexyFullHeight>sexyBaseHeight) {
		jQuery('.sexy-bookmarks-expand').hover(
			function() {
				jQuery(this).animate({
						height: sexyFullHeight+'px'
				}, {duration: 400, queue: false});
			},
			function() {
				jQuery(this).animate({
						height: sexyBaseHeight+'px'
				}, {duration: 400, queue: false});
			}
		);
	}
	// autocentering
	if (jQuery('.sexy-bookmarks-center') || jQuery('.sexy-bookmarks-spaced')) {
		var sexyFullWidth=jQuery('.sexy-bookmarks').width();
		var sexyBookmarkWidth=jQuery('.sexy-bookmarks:first ul.socials li').width();
		var sexyBookmarkCount=jQuery('.sexy-bookmarks:first ul.socials li').length;
		var numPerRow=Math.floor(sexyFullWidth/sexyBookmarkWidth);
		var sexyRowWidth=Math.min(numPerRow, sexyBookmarkCount)*sexyBookmarkWidth;
		
		if (jQuery('.sexy-bookmarks-spaced').length>0) {
			var sexyLeftMargin=Math.floor((sexyFullWidth-sexyRowWidth)/(Math.min(numPerRow, sexyBookmarkCount)+1));
			jQuery('.sexy-bookmarks ul.socials li').css('margin-left', sexyLeftMargin+'px');
		} else if (jQuery('.sexy-bookmarks-center'.length>0)) {
			var sexyLeftMargin=(sexyFullWidth-sexyRowWidth)/2;
			jQuery('.sexy-bookmarks-center').css('margin-left', sexyLeftMargin+'px');
		}
		
	}
});