/*jQuery(document).ready(function($) {
	Cufon.replace('#topMenu li a, #topMenu li strong, .nameDay, #twoLinks, #footer ul', { fontFamily: 'texgyreadventor'});
});*/

$(function(){
	$('a.external_link').attr("target", "_blank");
});

/*sucker fish menu init*/
jQuery(function(){
	jQuery('ul#topMenu').supersubs({minWidth:12,maxWidth:16})
		.superfish({
		autoArrows:  false,
		animation:   {height:'show'},
		speed:       'fast',
		dropShadows:  false 
	}).find('ul').bgIframe({opacity:false});
});


$(document).ready(function(){
		
	//Remove outline from links
	$("a").click(function(){
		$(this).blur();
	});
	
	//When mouse rolls over
	$("#flyout ul li").hover(function(){
		$(this).find(".flyCont").stop().animate({height:'106px'},{queue:false, duration:600, easing: 'easeOutQuart'})
		$(this).find("a.menuLink").addClass("opened")
		if ($(this).index() == 0){
			$('#loginLink').addClass("shade")
		} else {
			$('#cartLink').addClass("shade")
		}
	}, function(){
		$(this).find(".flyCont").stop().animate({height:'0px'},{queue:false, duration:100, easing: 'easeOutCirc'})
		$(this).find("a.menuLink").removeClass("opened")
		if ($(this).index() == 0){
			$('#loginLink').removeClass("shade")
		} else {
			$('#cartLink').removeClass("shade")
		}
	});
	
});

/*replacing tag <hr> with stylable div*/
$(function(){
	$(".weditor").find("hr").wrap('<div class="fakeHr"></div>')
});
/*add alt text under image in weditor*/
$(function(){
	var imgAlt
	var imgWidth
	$('.weditor img.fleft').wrap('<div class="img-border-left"></div>')
	$('.weditor img.fright').wrap('<div class="img-border-right"></div>')
	
	$('.weditor img.fleft, .weditor img.fright').each(function (i){
		i = i+1;
		$(this).addClass("imgAlts"+i);
		imgAlt = $('.weditor .imgAlts'+i).attr("alt")
		imgWidth = $(this).width() + 0;
		$(this).parent().css('width', imgWidth + "px");
		if ($(this).attr("alt").length > 0){
			$(".weditor .imgAlts"+i).after("<p>" +imgAlt+ "</p>");
		}
	});
});
/* contact form - show captcha block after textarea above is focused*/
$(function(){
	$('#contacts div.blockCaptcha').css('display','none');
	$('#contacts textarea.textarea').focus(function(){
		$('div.blockCaptcha').css('display','block');
	})
});


