var dm = new Array();
  var d = new Array();
  var rm = new Array();
  var ind_img = 1;
  var ind_s = "";
  function get_data(data){
    d = [];
    rm = [];
    k = 0;
	j = 0;
    for(i = 0; i<data.length; i++){
	   	if (data.charAt(i) == "¦") {
		 d[j] = i;
		 j++;
		}	
	  }
	 for(l = 1; l<d.length; l++){
	  rm[k] = data.substring(d[l-1]+1, d[l]);
	  k++;
	 }
    return rm;
  }
 
 function runMultiple() {
	   img_s = dm[ind_img];
	   anim();
	   ind_img++;
       if (ind_img == 5) ind_img = 1;        
    }
	
 function anim(){
  $('#img_k1').animate({opacity: 0}, 1000);
  $('#img_k2').animate({opacity: 0}, 1000);
  setTimeout(pok, 1000);
 }
 
 function pok(){
  $('#img_k1').attr('src', "http://tucat.ru/images/slide/head_"+ind_img+"_1.jpg");
  $('#img_k2').attr('src', "http://tucat.ru/images/slide/head_"+ind_img+"_2.jpg");

  if(ind_img == 1){
  $('#img_l1').attr('href', "http://tucat.ru/kontact.html"); 
  $('#img_l2').attr('href', "http://tucat.ru/kontact.html");
  }
  if(ind_img == 2){
  $('#img_l1').attr('href', "http://tucat.ru/sail.html"); 
  $('#img_l2').attr('href', "http://tucat.ru/millen_neo.html"); 
  }
  if(ind_img == 3){
  $('#img_l1').attr('href', "http://tucat.ru/benj.html"); 
  $('#img_l2').attr('href', "http://tucat.ru/enjoy.html"); 
  }
  if(ind_img == 4){
  $('#img_l1').attr('href', "http://tucat.ru/dx4.html"); 
  $('#img_l2').attr('href', "http://tucat.ru/s2see.html"); 
  }
  setTimeout('$("#img_k1").animate({opacity: 1}, 1000);$("#img_k2").animate({opacity: 1}, 1000);', 1000);
 }
	
 var timerMulti = window.setInterval("runMultiple();", 10000); 
 
 $(document).ready(function(){
zagr();
refcart();

  $.post("get_file_list.php", {dir: "images/slide/"}, function(data1){
    dm = get_data(data1);
	
    if ((window.location.href == "http://tucat.ru/")||(window.location.href == "http://www.tucat.ru/")||(window.location.href == "http://tucat.ru/index.php")||(window.location.href == "http://www.tucat.ru/index.php")) {

	}
	if ((window.location.href == "http://tucat.ru/kachestvopr.html")||(window.location.href == "http://www.tucat.ru/kachestvopr.html")) {
	 $('#img_b').attr('src', "images/ban/ban2.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/ursul.html");
	}
	if ((window.location.href == "http://tucat.ru/technologiapr.html")||(window.location.href == "http://www.tucat.ru/technologiapr.html")) {
	 $('#img_b').attr('src', "images/ban/ban3.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/ektivi.html");
	}
	if ((window.location.href == "http://tucat.ru/news.html")||(window.location.href == "http://www.tucat.ru/news.html")) {
	 $('#img_b').attr('src', "images/ban/ban4.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/d4xmud.html");
	}
	/*if ((window.location.href == "http://tucat.ru/selfbiznes.html")||(window.location.href == "http://www.tucat.ru/selfbiznes.html")) {
	 $('#img_b').attr('src', "images/ban/ban5.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/antioks.html");
	}*/
	if ((window.location.href == "http://tucat.ru/predlojenie.html")||(window.location.href == "http://www.tucat.ru/predlojenie.html")) {
	 $('#img_b').attr('src', "images/ban/ban6.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/brain.html");
	}
	if ((window.location.href == "http://tucat.ru/production.html")||(window.location.href == "http://www.tucat.ru/production.html")) {
	 $('#img_b').attr('src', "images/ban/ban8.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/vineks.html");
	 $('#img_b2').attr('src', "images/ban/ban1.jpg");
	 $('#ban_lnk2').attr('href', "http://tucat.ru/granatinq10.html");
	 $('#img_b1').attr('src', "images/ban/ban5.jpg");
	 $('#ban_lnk1').attr('href', "http://tucat.ru/antioks.html");
	}
	if ((window.location.href == "http://tucat.ru/vision.html")||(window.location.href == "http://www.tucat.ru/vision.html")) {
	 $('#img_b').attr('src', "images/ban/ban8.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/vineks.html");
	}
	if ((window.location.href == "http://tucat.ru/technologija.html")||(window.location.href == "http://www.tucat.ru/technologija.html")) {
	 $('#img_b').attr('src', "images/ban/ban9.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/giper.html");
	}
	if ((window.location.href == "http://tucat.ru/kach.html")||(window.location.href == "http://www.tucat.ru/kach.html")) {
	 $('#img_b').attr('src', "images/ban/ban10.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/detox.html");
	}
	if ((window.location.href == "http://tucat.ru/terapevt.html")||(window.location.href == "http://www.tucat.ru/terapevt.html")) {
	 $('#img_b').attr('src', "images/ban/ban_dx.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/d4xmud.html");
	}
	if ((window.location.href == "http://tucat.ru/cosmet.html")||(window.location.href == "http://www.tucat.ru/cosmet.html")) {
	 $('#img_b').attr('src', "images/ban/ban_hh.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/index.php?whatpage=mag&gid=18");
	}
	if ((window.location.href == "http://tucat.ru/millen.html")||(window.location.href == "http://www.tucat.ru/cosmet.html")) {
	 $('#img_b').attr('src', "images/ban/ban_di.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/d_i.html");
	 }
	if ((window.location.href == "http://tucat.ru/millenium.html")||(window.location.href == "http://www.tucat.ru/millenium.html")) {
	 $('#img_b').attr('src', "images/ban/ban13.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/mega.html");
	}
	if ((window.location.href == "http://tucat.ru/novinki.html")||(window.location.href == "http://www.tucat.ru/novinki.html")) {
	 $('#img_b').attr('src', "images/ban/ban14.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/mistik.html");
	}
	if ((window.location.href == "http://tucat.ru/granatin.html")||(window.location.href == "http://www.tucat.ru/granatin.html")) {
	 $('#img_b').attr('src', "images/ban/ban15.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/nortia.html");
	}
	if ((window.location.href == "http://tucat.ru/enjoynt.html")||(window.location.href == "http://www.tucat.ru/enjoynt.html")) {
	 $('#img_b').attr('src', "images/ban/ban16.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/nutrimaks.html");
	}
	if ((window.location.href == "http://tucat.ru/dx4.html")||(window.location.href == "http://www.tucat.ru/dx4.html")) {
	 $('#img_b').attr('src', "images/ban/ban17.jpg");
	 $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/paks.html");
	}
	if ((window.location.href == "http://tucat.ru/safe2c.html")||(window.location.href == "http://www.tucat.ru/safe2c.html")) {
	 $('#img_b').attr('src', "images/ban/ban18.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/passilat.html");
	}
	if ((window.location.href == "http://tucat.ru/energ.html")||(window.location.href == "http://www.tucat.ru/energ.html")) {
	 $('#img_b').attr('src', "images/ban/ban19.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/reven.html");
	}
	if ((window.location.href == "http://tucat.ru/braslet.html")||(window.location.href == "http://www.tucat.ru/braslet.html")) {
	 $('#img_b').attr('src', "images/ban/ban20.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/sveltform.html");
	}
	if ((window.location.href == "http://tucat.ru/deti.html")||(window.location.href == "http://www.tucat.ru/deti.html")) {
	 $('#img_b').attr('src', "images/ban/ban21.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/hrom.html");
	}
	if ((window.location.href == "http://tucat.ru/rezult.html")||(window.location.href == "http://www.tucat.ru/rezult.html")) {
	 $('#img_b').attr('src', "images/ban/ban22.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/cheviton.html");
	}
	/*if ((window.location.href == "http://tucat.ru/kontact.html")||(window.location.href == "http://www.tucat.ru/kontact.html")) {
	 $('#img_b').attr('src', "images/ban/ban23.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/tan.html");
	}*/
	if ((window.location.href == "http://tucat.ru/var_pokupki.html")||(window.location.href == "http://www.tucat.ru/var_pokupki.html")) {
	 $('#img_b').attr('src', "images/ban/ban7.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/beauty.html");
	}
	if ((window.location.href == "http://tucat.ru/hudeem.html")||(window.location.href == "http://www.tucat.ru/hudeem.html")) {
	 /*$('#img_b').attr('src', "images/ban/ban24.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/kgoff.html");
	 $('#img_b1').attr('src', "images/ban/ban25.jpg");
	 $('#ban_lnk1').attr('href', "http://tucat.ru/kgoff1.html");
	 $('#img_b').attr('src', "images/ban/ban1.jpg");
	 $('#ban_lnk').attr('href', "http://tucat.ru/granatinq10.html");*/
	 $('#img_b').attr('src', "images/ban/ban5.jpg");
	  $('#img_b').css('width', "157px");
	 $('#ban_lnk').attr('href', "http://tucat.ru/antioks.html");
	}
  });
 });

 function zagr(){
  var lin = document.getElementsByTagName("a");
  if(window.location.href.indexOf("whatpage=mag")>0){
   document.getElementById("cat").style.color = "#000000";
   document.getElementById("cat").style.fontWeight = "bold";
   document.getElementById("cat").style.fontSize = "16px";
  }
  for (i = 0; i < lin.length; i++){
   if (lin[i].getAttribute("href") == window.location){
    lin[i].style.color = "#000000";
    lin[i].style.fontWeight = "bold";
    lin[i].style.fontSize = "16px";
   }
  }
  
 if (document.getElementById("inp_m") != null){
   tp = document.getElementById("inp_m").value;
  if (tp != ""){
  for (i = 0; i < lin.length; i++){
   if ((lin[i].getAttribute("href") == tp)||("/"+lin[i].getAttribute("href") == tp)){
    lin[i].style.colorWeight = "bold";
    lin[i].style.fontWeight = "bold";
	lin[i].style.fontSize = "16px";
   }
  }
}
}

 }

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16651086-3']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
