
var lng="sr";
var lngLink = "http://www.kodar.rs/site/index.php?[sr]";

for (p=1; p<=3; p++) {
  for(s=1; s<=8; s++) {
    var pic = new Image();
    pic.src = '/switch/img/ph'+p+''+s+'.jpg';
  }
}
$(document).ready(function(){ 
  $('#links a').bind('mouseenter', function() {
    $(this).stop().animate({color: '#f7931e'}, 600); 
  });
  $('#links a').bind('mouseleave', function() {
    $(this).stop().animate({color: '#0a193a'}, 1800); 
  });

  $('#click1').bind('mouseenter', function() {
    $('#link1 a').stop().animate({color: '#f7931e'}, 600); 
  });
  $('#click1').bind('click', function(){
    document.location = lngLink;
  });
  $('#click2').bind('click', function(){
    document.location = lngLink;
  });
  $('#click3').bind('click', function(){
    document.location = lngLink;
  });
  $('#click2, #link2 a').bind('mouseenter', function() {
    $('#link2 a').stop().animate({color: '#f7931e'}, 600);
    $('#link2 a.textchange span.text1').css({display: 'none'});
    $('#link2 a.textchange span.text2').css({display: 'inline', fontSize: '14px'});
  });  
  $('#click3, #link3 a').bind('mouseenter', function() {
    $('#link3 a').stop().animate({color: '#f7931e'}, 600); 
    $('#link3 a.textchange span.text1').css({display: 'none'});
    $('#link3 a.textchange span.text2').css({display: 'inline', fontSize: '14px'});
  });
for (l=1; l<=3; l++) {
  $('#click'+l).bind('mouseleave', function() {
    $('#link1 a, #link2 a, #link3 a').stop().animate({color: '#0a193a'}, 1800);
    $('#link2 a.textchange span.text1').css({display: 'inline'});
    $('#link2 a.textchange span.text2').css({display: 'none'});
    $('#link3 a.textchange span.text1').css({display: 'inline'});
    $('#link3 a.textchange span.text2').css({display: 'none'});
  });
}
for (l=1; l<=3; l++) {
  $('#link'+l).bind('mouseleave', function() {
    $('#link1 a, #link2 a, #link3 a').stop().animate({color: '#0a193a'}, 1800);
    $('#link2 a.textchange span.text1').css({display: 'inline'});
    $('#link2 a.textchange span.text2').css({display: 'none'});
    $('#link3 a.textchange span.text1').css({display: 'inline'});
    $('#link3 a.textchange span.text2').css({display: 'none'});
  });
}
for (i=2; i<=8; i++) {
  $('#img1').append('<div><img src="/switch/img/ph1'+i+'.jpg" alt=""></div>');
  $('#img2').append('<div><img src="/switch/img/ph2'+i+'.jpg" alt=""></div>');
  $('#img3').append('<div><img src="/switch/img/ph3'+i+'.jpg" alt=""></div>');
 } 
  $('#img1').cycle({fx: 'scrollDown', speed:  2000, timeout: 6500, cleartypeNoBg: true});
  $('#img2').cycle({fx: 'fade', speed:  2000, timeout: 6000, cleartypeNoBg: true});
  $('#img3').cycle({fx: 'scrollLeft', speed:  1500, timeout: 7000, cleartypeNoBg: true});

});  
  
  
function swLng() {
   if (lng == "sr") {
      $("#ts a").text("SR");
      $("#link1 a").text("Telecommunication");
         $('#link1 a').attr('href', 'http://www.kodar.rs/site/index.php?[en]');
         lngLink = 'http://www.kodar.rs/site/index.php?[en]';
      $("#link2 a").text("Energetics");
         $('#link2 a').attr('href', 'http://www.kodar.rs/site/index.php?[en]');
         lngLink = 'http://www.kodar.rs/site/index.php?[en]';
      $("#link3 a").text("Construction");
         $('#link3 a').attr('href', 'http://www.kodar.rs/site/index.php?[en]');
         lngLink = 'http://www.kodar.rs/site/index.php?[en]';
      $("#bottomStripe").text("©2010 KODAR engineering · Auto put za Zagreb 41i · 11077 Beograd · Serbia · Telephone: +381 11 3142 124 · Fax: +381 11 3142 124 · office@kodar.rs");
      lng = "en";
   }
   else {
      $("#ts a").text("EN");
      $("#link1 a").text("Telekomunikacije");
         $('#link1 a').attr('href', 'http://www.kodar.rs/site/index.php?[sr]');
         lngLink = 'http://www.kodar.rs/site/index.php?[sr]';
      $("#link2 a").text("Energetika");
         $('#lin2 a').attr('href', 'http://www.kodar.rs/site/index.php?[sr]');
         lngLink = 'http://www.kodar.rs/site/index.php?[sr]';
      $("#link3 a").text("Građevinarstvo");
         $('#link3 a').attr('href', 'http://www.kodar.rs/site/index.php?[sr]');
         lngLink = 'http://www.kodar.rs/site/index.php?[sr]';
      $("#bottomStripe").text("©2010 KODAR inženjering · Auto put za Zagreb 41i · 11077 Beograd · Republika Srbija · Telefon: +381 (11) 3142 124 · Fax: +381 (11) 3142 124 · office@kodar.rs");
      lng = "sr";	
   }
}
