  var img = 4;$(document).ready(function(){
	
  var url = window.location.href;
  url = url.toString();
  var baseURL = "http://wintera.com.ua/";
  var separator = false;

	if(url == baseURL){
		separator = true;
	}
	else if(url.indexOf("/baner/") != -1 || url.indexOf("/home/") != -1){
		separator = true;
	}
	else{
		separator = false;
	}
	
	if(separator){
		$('#baner').css("display","block");
	}
	else{
		$('#baner').css("display","none");
	}
	
	//Banner

  timeoutId = setInterval(function(){
    $('#big_baner').animate({opacity:0},800,function(){
      img++;
      if (img>4) img = 1;
      $('#big_baner').attr("src",'img/baner'+img+'_big.jpg'); 
		if (img==4) $('#big_baner').parent().attr('href','baner/id/'+img+'#text'); //для того чтоб прокручивало 4й банер сразу на текст
		else $('#big_baner').parent().attr('href','baner/id/'+img);
	  $('#big_baner').parent().attr('href','baner/id/'+img);
	  $('#big_baner').animate({opacity:1},800);
      //setTimeout(function(){$('#big_baner').animate({opacity:1},1000);},2000);
    });
  }, 8000);

  $('.baner').click(function(){
    $('#big_baner_text').css('display','none');
    var id = $(this).attr('id');
    $('#big_baner').animate({opacity:0},1000,function(){
    $('#big_baner').attr("src",'img/baner'+id+'_big.jpg');
		//if (id==4) $('#big_baner').parent().attr('href','baner/id/'+id+'#text');	else 
		$('#big_baner').parent().attr('href','baner/id/'+id+'#text');		
    }).animate({opacity:1},1000);
    clearTimeout(timeoutId);
		
  });
  
  if(url.indexOf("news_one/id/67") != -1){
    $('#i').css('display','none');
  }

  if(url.indexOf("/baner/id/") != -1){
    clearTimeout(timeoutId);
    id = url.substr(url.indexOf("/id/")+4);
    $('#big_baner').parent().html('<img id="big_baner" />');
  }

  $('#profil').change(function() {
    var text = '';
    switch($(this).attr('value')){
      case 'KBEoptima':{text = '3x камерный профиль монтажная ширина 60мм'; break;}
      case 'KBEklassic':{text = '5 камерный профиль монтажная ширина 70мм'; break;}
      case 'Schuco_Corona_CT70':{text = '5 камерный профиль монтажная ширина 70мм'; break;}
      case 'Schuco_AS60':{text = '3x камерный профиль монтажная ширина 60мм'; break;}
      case 'Schuco_SL82':{text = '3x камерный профиль монтажная ширина 82мм'; break;}
    }
   
   $('#profil_text').html(text);
  });
  
  $('#profil_ua').change(function() {
    var text = '';
    switch($(this).attr('value')){
      case 'KBEoptima':{text = '3 камерний профіль монтажна ширина 60мм'; break;}
      case 'KBEklassic':{text = '5 камерний профіль монтажна ширина 70мм'; break;}
      case 'Schuco_Corona_CT70':{text = '5 камерний профіль монтажна ширина 70мм'; break;}
      case 'Schuco_AS60':{text = '3 камерний профіль монтажна ширина 60мм'; break;}
      case 'Schuco_SL82':{text = '3 камерний профіль монтажна ширина 82мм'; break;}
    }
   
   $('#profil_text').html(text);
  });
  
  if(url.indexOf("news_one")==-1){
  	$('#corp_video').css('display','none');
  }
});
