var jq = jQuery.noConflict();
jq(document).ready(function(){
if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
       jq('#submit').css('padding-bottom','0px');
}

	jq('#one_1').hover(function(e){
	   e.preventDefault();
	   jq('.leftSideBar ul li.bg-li').removeClass('active');
       jq(this).addClass('active');
       jq('.innerBarIn1').css('display','none');
       jq('#one').css('display','block');
	});

	jq('#two_1').hover(function(e){
	   e.preventDefault();
	   jq('.leftSideBar ul li.bg-li').removeClass('active');
       jq(this).addClass('active');
       jq('.innerBarIn1').css('display','none');
       jq('#two').css('display','block');
	});

	jq('#three_1').hover(function(e){
	   e.preventDefault();
	   jq('.leftSideBar ul li.bg-li').removeClass('active');
       jq(this).addClass('active');
       jq('.innerBarIn1').css('display','none');
       jq('#three').css('display','block');
	});
    
    jq('.leftSideBar .inner li a').click(function(){
       jq('.leftSideBar .inner li #add-img-class').remove();
	   jq('.leftSideBar .inner li a').removeClass('active_inner').css('color','#2C0E2E');
       jq(this).addClass('active_inner').css('color','#903db1');
       jq(this).after('<img id="add-img-class" src="images/text-href.png" />').css('margin-right','5px');      
    });
    //jq('#textLeft').val(0);
    //jq('#textRight').val(40000000);
    jq("#checkbox").removeAttr("checked");
    jq('#DoubleTrack-5').wrapInner().css('display','none');
    jq('#DoubleTrack-5').before('<div id="check-line"></div>');
    jq('.fll').mouseup(function(){
       var elem1 = jq('#DoubleTrack-5-LeftText').text();
	   var allSpacesRe = /\s+/g;
		elem1 = elem1.replace(allSpacesRe, "");

       jq('#textLeft').val(elem1);
    });
    jq('.flr').mouseup(function(){
       var elem2 = jq('#DoubleTrack-5-RightText').text();
	   var allSpacesRe = /\s+/g;
		elem2 = elem2.replace(allSpacesRe, "");
        jq('#textRight').val(elem2);
    });
        
    jq('#checkbox').click(function(){
       var elem = jq('#checkbox');
       if(elem.is(':checked'))
       {
            jq('#DoubleTrack-5').wrapInner().css('display','block');
            jq('#check-line').remove();
            var elem1 = jq('#DoubleTrack-5-LeftText').text();
            jq('#textLeft').val(elem1);
            var elem2 = jq('#DoubleTrack-5-RightText').text();
            jq('#textRight').val(elem2);
       }
       else
       {
            jq('#DoubleTrack-5').wrapInner().css('display','none');
            jq('#DoubleTrack-5').before('<div id="check-line"></div>');
            jq('#textRight').val(40000000);
            jq('#textLeft').val(0);
       }
    });
	
	
	jq(".cartimage,.cart b").css("cursor","pointer").click(function(){
	if(jq(".cartlist").css("display")=="none"){
	jq(".cartlist").slideDown();
	} else {
	jq(".cartlist").slideUp();
	}});
	
	jq(".podborclick").click(function(){
	if(jq(".podbormain").css("right")=="-3px"){
	jq(".podbormain").animate({"right":"-556px"},500);
	} else {
	jq(".podbormain").animate({"right":"-3px"},500);
	}
	});	
	jq(".podborclick2").click(function(){
	if(jq(".sallsearchform").css("right")=="-3px"){
	jq(".sallsearchform").animate({"right":"-306px"},500);
	} else {
	jq(".sallsearchform").animate({"right":"-3px"},500);
	}
	});


	jq(".podborSend").click(function(){
	if(jq(".podborName").attr("value")==""){alert("Вы не ввели Имя!");return false;}
	if(jq(".podborPhone").attr("value")==""){alert("Вы не ввели телефон!");return false;}
	if(jq(".podborMail").attr("value")==""){alert("Вы не ввели E-mail!");return false;}
	});
	
	
	jq(".wtf a").click(function(){return false;});
	jq(".wtf a").hover(function(){
		jq(this).next(".iknowwtf").css("opacity","0").css("display","block").animate({"opacity":"1","top":"15"},200);
	},function(){
		jq(this).next(".iknowwtf").animate({"opacity":"0","top":"-10"},200,function(){jq(this).css("opacity","1").css("display","none")});
	});
	
	
	var catdescr = jq(".catdescription").html();
	var catdescr2 = jq(".catdescription2").html();
	var catlist = jq(".cataloglist").html();

	//alert(catdescr+"-----"+catdescr2+"-----"+catlist);
	
	if(catdescr!=null || catdescr!=undefined || catdescr2!=null || catdescr2!=undefined){
	jq(".cataloglist").html("");
	}
	if(catdescr!=null || catdescr!=undefined){
	jq(".catdescription").html(catlist);
	jq(".cataloglist").html(catdescr);
	}
	else if(catdescr2!=null || catdescr2!=undefined){
	jq(".catdescription2").html(catlist);
	jq(".cataloglist").append(catdescr2);
	}
	 
	jq(".phone").pxgradient({ //произвольный селектор jQuery
		step: 10, // размер шага градиента в пикселях. Меньше шаг - больше качество, но меньше производительность
		colors: ["#ffd700","#ffeb80"], // цвета. формат - hex (#4fc05a или #333)
		dir: "y" // направление градиента. x - горизонтальное, y - вертикальное
	});

	jq(".phoneback").click(function(){
		if(jq(".phonebackdiv").css("display")=="none"){
			jq(".phonebackdiv").slideDown();return false;
		} else {
			jq(".phonebackdiv").slideUp();return false;
		}
	});
	
	jq(".callback").click(function(){
		if(jq(".phonebackdiv2").css("display")=="none"){
			jq(".phonebackdiv2").slideDown();return false;
		} else {
			jq(".phonebackdiv2").slideUp();return false;
		}
	});
	
	
	
	
	

	
	jq(".name").focus(function(){if(jq(this).val()=="Ваше имя"){jq(this).val("");}});
	jq(".name").blur(function(){if(jq(this).val()==""){jq(this).val("Ваше имя");}});
	jq(".phonenum").click(function(){if(jq(this).val()=="Ваш телефон"){jq(this).val("");}});
	jq(".phonenum").blur(function(){if(jq(this).val()==""){jq(this).val("Ваш телефон");}});
		

	jq(".send").click(function(){
		name = jq(".name").val();
		phone = jq(".phonenum").val();
		jq.get("/callback.php", { name: name, phone: phone }, function(data){jq(".phonebackdiv").slideUp();alert("Спасибо, в ближайшее время мы Вам перезвоним");jq(".phonebackdiv2,.phonebackdiv").slideUp();});
	});
	
	
	
	jq(".livechat").hover(function(){
		jq(this).stop().animate({right:"0px"},500);
	},function(){
		jq(this).stop().animate({right:"-180px"},500);	
	});
	jq(".livechat").animate({width:jq(".livechat").width()},30000,function(){jq(this).animate({right:"0px"},500);});  

	
	jq(".dropdown div a").click(function(){
		if(jq(this).parent().next("ul").css("display")=="none"){
		jq(this).parent().next("ul").slideDown();
		} else {
		jq(this).parent().next("ul").slideUp();
		}
		return false;
	});
	
	jq(".firstsearch li a").click(function(){
		jq(this).parent().parent().slideUp();
		jq(".firstsearch div span").text(jq(this).text());
		var value = jq(this).attr("extra");
		jq(".secondsearch").animate({opacity:0.3},600,function(){jq(this).animate({opacity:1},400)});
		jq(".type").val(value);
		jq(".secondsearch li").css("display","none");
			
			//Беговые
			if(value=="1"){
				jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BH FITNESS" || jq(this).children("a").text()=="BODY-SOLID" || jq(this).children("a").text()=="BREMSHEY" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="DAUM ELECTRONIC" || jq(this).children("a").text()=="FASTRAC" || jq(this).children("a").text()=="FITNESSGALLERY" || jq(this).children("a").text()=="HORIZON" || jq(this).children("a").text()=="JOHNSON" || jq(this).children("a").text()=="KETTLER" || jq(this).children("a").text()=="LANDICE" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="MATRIX" || jq(this).children("a").text()=="MOTUS" || jq(this).children("a").text()=="PANATTA" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="SMOOTH FITNESS" || jq(this).children("a").text()=="Spirit Fitness" || jq(this).children("a").text()=="SPORTS ART" || jq(this).children("a").text()=="TUNTURI" || jq(this).children("a").text()=="VISION FITNESS" || jq(this).children("a").text()=="EuroFit" || jq(this).children("a").text()=="LIVESTRONG" || jq(this).children("a").text()=="AeroFit" || jq(this).children("a").text()=="DKN Technology" || jq(this).children("a").text()=="Sole Fitness"){jq(this).css("display","block");}
				});
			}
			
			//Элипсы
			else if(value=="2"){
				jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BH FITNESS" || jq(this).children("a").text()=="BREMSHEY" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="DAUM ELECTRONIC" || jq(this).children("a").text()=="FASTRAC" || jq(this).children("a").text()=="HORIZON" || jq(this).children("a").text()=="KETTLER" || jq(this).children("a").text()=="LANDICE" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="MATRIX" || jq(this).children("a").text()=="MOTUS" || jq(this).children("a").text()=="PANATTA" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="SMOOTH FITNESS" || jq(this).children("a").text()=="Spirit Fitness" || jq(this).children("a").text()=="SPORTS ART" || jq(this).children("a").text()=="TUNTURI" || jq(this).children("a").text()=="VISION FITNESS" || jq(this).children("a").text()=="LIVESTRONG" || jq(this).children("a").text()=="AeroFit" || jq(this).children("a").text()=="DKN Technology" || jq(this).children("a").text()=="Sole Fitness"){jq(this).css("display","block");}
				});
			}
			
			//Вело
			else if(value=="3"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BH FITNESS" || jq(this).children("a").text()=="BODY-SOLID" || jq(this).children("a").text()=="BREMSHEY" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="DAUM ELECTRONIC" || jq(this).children("a").text()=="EXPRESSO FITNESS" || jq(this).children("a").text()=="HORIZON" || jq(this).children("a").text()=="JOHNSON" || jq(this).children("a").text()=="KETTLER" || jq(this).children("a").text()=="LeMOND" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="MATRIX" || jq(this).children("a").text()=="MOTUS" || jq(this).children("a").text()=="PANATTA" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="Spirit Fitness" || jq(this).children("a").text()=="SPORTS ART" || jq(this).children("a").text()=="TOMAHAWK" || jq(this).children("a").text()=="TUNTURI" || jq(this).children("a").text()=="VISION FITNESS" || jq(this).children("a").text()=="LIVESTRONG" || jq(this).children("a").text()=="AeroFit" || jq(this).children("a").text()=="DKN Technology" || jq(this).children("a").text()=="Sole Fitness"){jq(this).css("display","block");}
				});			
			}
			
			//СТепперы
			else if(value=="4"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="KETTLER" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="MATRIX" || jq(this).children("a").text()=="MOTUS" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="SPORTS ART"){
				jq(this).css("display","block");}
				});	
			}
			
			//Гребные
			else if(value=="5"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="CONCEPT" || jq(this).children("a").text()=="HORIZON" || jq(this).children("a").text()=="KETTLER" || jq(this).children("a").text()=="MATRIX" || jq(this).children("a").text()=="TUNTURI" || jq(this).children("a").text()=="WATER ROWER"){
				jq(this).css("display","block");}
				});	
			}
			
			//Силовые
			else if(value=="6"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BODY-SOLID" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="ELITE FITNESS" || jq(this).children("a").text()=="HOIST" || jq(this).children("a").text()=="JOHNSON" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="MATRIX" || jq(this).children("a").text()=="PANATTA" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="PRO DUAL LINE" || jq(this).children("a").text()=="SPORTS ART" || jq(this).children("a").text()=="TECA" || jq(this).children("a").text()=="VECTRA FITNESS" || jq(this).children("a").text()=="AeroFit" || jq(this).children("a").text()=="Bruce Lee Dragon" || jq(this).children("a").text()=="Bruce Lee Signature" || jq(this).children("a").text()=="DKN Technology"){jq(this).css("display","block");}
				});	
			}
			
			//Мультистанции
			else if(value=="7"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BODY-SOLID" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="HOIST" || jq(this).children("a").text()=="KETTLER" || jq(this).children("a").text()=="LANDICE" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="SPORTS ART" || jq(this).children("a").text()=="VECTRA FITNESS" || jq(this).children("a").text()=="VISION FITNESS"){
				jq(this).css("display","block");}
				});	
			}
			
			//PowerPlate
			else if(value=="12"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="POWER PLATE"){
				jq(this).css("display","block");}
				});	
			}
			
			//FitVibe
			else if(value=="13"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="FIT VIBE"){
				jq(this).css("display","block");}
				});	
			}
			
			//Допобордуование
			else if(value=="14"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BODY-SOLID" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="CYBEX" || jq(this).children("a").text()=="LAPPSET" || jq(this).children("a").text()=="FITNESSGALLERY"){
				jq(this).css("display","block");}
				});	
			}
			
			//Турники и брусья
			else if(value=="29"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="Все производители" || jq(this).children("a").text()=="BODY-SOLID" || jq(this).children("a").text()=="ELITE FITNESS" || jq(this).children("a").text()=="HOIST" || jq(this).children("a").text()=="JOHNSON" || jq(this).children("a").text()=="LIFE FITNESS" || jq(this).children("a").text()=="PRECOR" || jq(this).children("a").text()=="SPORTS ART" || jq(this).children("a").text()=="TECA"){
				jq(this).css("display","block");}
				});	
			}
			
			//Ab Coaster
			else if(value=="32"){
			jq(".secondsearch li").each(function(){
				if(jq(this).children("a").text()=="AB Coaster"){
				jq(this).css("display","block");}
				});	
			}
			
			//Все тренажеры
			else {
				jq(".secondsearch li").css("display","block");
			}
		return false;
	});
	
	
	jq(".secondsearch li a").click(function(){
		jq(this).parent().parent().slideUp();
		jq(".secondsearch div span").text(jq(this).text());
		jq(".firm").val(jq(this).attr("extra"));
		return false;
	});
	
	
	jq("h1").each(
	function(){
	if(jq(this).text()=="Интернет магазин тренажеров."){jq(this).css("display","none");}
	}
	);
	
	
	
/*
    snow_intensive=1000;
    snow_speed=40000;
    snow_src=new Array('sneg1.png','sneg2.png');

    
    function snow_start() {
        snow_id=1;
        snow_y=jq("body").height()-30;
        setInterval(function() {
            snow_x=Math.random()*document.body.offsetWidth-100;
            snow_img=(snow_src instanceof Array ? snow_src[Math.floor(Math.random()*snow_src.length)] : snow_src);
            snow_elem='<img class="png" id="snow'+snow_id+'" style="position:absolute; left:'+snow_x+'px; top:0;z-index:10000" src="/images/'+snow_img+'"/>';
            jq("body").append(snow_elem);
            snow_move(snow_id);
            snow_id++;
        },snow_intensive);
    }

    function snow_move(id) {
        jq('#snow'+id).animate({top:snow_y,left:"+="+Math.random()*100},snow_speed,function() {
        jq(this).empty().remove();
    });}
	
	snow_start();
*/
	
	
	
	
	//ab coaster logo
	jq(".leftSideBar li").each(function(){
		if(jq(this).children("a").text()=="AB Coaster"){
			jq(this).children("a").prepend("<img src=/images/abcoaster-small.gif style='padding-right:5px;float:left;margin-top:-3px;'>");
		}
	});
	
	
	
	
	
	
	
	
});

		
	
