jQuery(document).ready(function(){
	timeOut = 200;
	
	try {
		Cufon.replace('#menu > ul > li > a', {  fontFamily: 'helvetica-cond' });
		Cufon.replace('.more', {  fontFamily: 'helvetica-cond', textShadow: '1px 1px #648802' });
		Cufon.replace('#columns .more, .box_offer .more, .offers .more ', {  fontFamily: 'helvetica-cond', textShadow: '1px 1px #0c6c94' });
		Cufon.replace('.box h3', {  fontFamily: 'helvetica-cond', textShadow: '2px 2px #0c6c94' });
		Cufon.replace('.box_lead h3', {  fontFamily: 'helvetica-cond', textShadow: '2px 2px #648802' });
		Cufon.replace('h2.head, #columns h2', {  fontFamily: 'helvetica-cond', textShadow: '2px 2px #107aa6' });
	} catch(err) {}
	
	try {
		jQuery('.tab').children('h4').hide();
		if (jQuery('#tabs .tab').size() <= 1) {
			jQuery('#tabs').before('<ul id="tabs_nav"><li><a href="#" title="" class="activeSlide"><span class="fl"></span><span class="fr"></span>'+jQuery('.tab').children('h4').html()+'</a></li></ul>');
		} else {
			jQuery('#tabs').before('<ul id="tabs_nav" />');
		}
		jQuery('#tabs').cycle({ 
			fx:     'fade', 
			speed:  800, 
			timeout: 0, 
			pager:  '#tabs_nav', 
			pagerAnchorBuilder: function(idx, slide) { 
				return '<li><a href="#" title=""><span class="fl"></span><span class="fr"></span>'+jQuery(slide).children('h4').html()+'</a></li>'; 
			}
		});
	} catch(err) {}
	
	jQuery('.totop').click(function () {
		scroll(0,0);
		return false;
	});
	
	jQuery('.item_list li').mouseover(function () { 
		jQuery(this).addClass('hover'); 
	});
	jQuery('.item_list li').mouseout(function () { 
		jQuery(this).removeClass('hover'); 
	});
	
	jQuery('.cloud').hide();
	jQuery('.item_list li').hoverIntent(cloudIn,cloudOut, {interval: 0});
	
	jQuery('#menu > ul > li').mouseover(function () {
		jQuery(this).css('z-index','2');
		jQuery(this).children('a:first-child').not('a.current').addClass('hover');
	});
	jQuery('#menu > ul > li').mouseout(function () {
		jQuery(this).css('z-index','1');
		jQuery(this).children('a:first-child').not('a.current').removeClass('hover');
	});
	jQuery('#menu > ul > li > ul').hide();
	jQuery('#menu > ul > li').hoverIntent(hoverIn,hoverOut, {interval: 0});
	
	jQuery('label.hide').hide().each(function () {
		jQuery(this).next('input[type="text"], input[type="password"], textarea, select').val(jQuery(this).html());
		jQuery(this).next('input[type="text"], input[type="password"], textarea, select').attr('rel',jQuery(this).html());
		jQuery(this).hide();
	});
	jQuery('input[type="text"], input[type="password"], textarea').focus(function () {
		if (jQuery(this).val()==jQuery(this).attr('rel')) jQuery(this).val('');
		jQuery(this).removeClass('invalid');
		jQuery(this).addClass('active');
		jQuery(this).parents('p').find('.err').removeClass('err');
		jQuery(this).parents('p').find('.msg').remove();
	});
	jQuery('input[type="text"], input[type="password"], textarea').blur(function () {
		if (jQuery(this).val()=='') jQuery(this).val(jQuery(this).attr('rel'));
		jQuery(this).removeClass('active');
	});
	
	jQuery('.thumbs a').lightBox();
});


function hoverIn(){ jQuery(this).children('ul').animate({height: 'toggle'}, timeOut);}
function hoverOut(){ jQuery(this).children('ul').animate({height: 'toggle'}, timeOut);}
function cloudIn(){ jQuery(this).children('.cloud').animate({height: 'toggle'}, timeOut);}
function cloudOut(){ jQuery(this).children('.cloud').animate({height: 'toggle'}, timeOut);}
