// Animation parameters
aboutCurrentX = 120;
aboutCurrentY = 160;
voiceCurrentX = 160;
voiceCurrentY = 210;
internetCurrentX = 190;
internetCurrentY = 260;
ivrCurrentX = 200;
ivrCurrentY = 310;
contactCurrentX = 190;
contactCurrentY = 360;
aboutEndX = 0;
aboutEndY = 130;
voiceEndX = 110;
voiceEndY = 130;
internetEndX = 220;
internetEndY = 130;
ivrEndX = 330;
ivrEndY = 130;
contactEndX = 440;
contactEndY = 130;
totalStop = 0;

// Animation code
function aboutMovement() {
  if(aboutCurrentX > aboutEndX || aboutCurrentY > aboutEndY) {
    aboutCurrentX = aboutCurrentX - 4;
    aboutCurrentY = aboutCurrentY - 1;
  }
  else {
    window.clearInterval(iabout);
    totalStop++;
  }
  about.style.posLeft = aboutCurrentX;
  about.style.posTop = aboutCurrentY;
}

function voiceMovement() {
  if(voiceCurrentX > voiceEndX || voiceCurrentY > voiceEndY) {
    voiceCurrentX = voiceCurrentX - 2.5;
    voiceCurrentY = voiceCurrentY - 4;
  }
  else {
    window.clearInterval(ivoice);
    totalStop++;
  }
  voice.style.posLeft = voiceCurrentX;
  voice.style.posTop = voiceCurrentY;
}

function internetMovement() {
  if(internetCurrentX > internetEndX || internetCurrentY > internetEndY) {
    internetCurrentX = internetCurrentX + 1.5;
    internetCurrentY = internetCurrentY - 6.5;
  }
  else {
    window.clearInterval(iinternet);
    totalStop++;
  }
  internet.style.posLeft = internetCurrentX;
  internet.style.posTop = internetCurrentY;
}

function ivrMovement() {
  if(ivrCurrentX > ivrEndX || ivrCurrentY > ivrEndY) {
    ivrCurrentX = ivrCurrentX + 6.5;
    ivrCurrentY = ivrCurrentY - 9;
  }
  else {
    window.clearInterval(iivr);
    totalStop++;
  }
  ivr.style.posLeft = ivrCurrentX;
  ivr.style.posTop = ivrCurrentY;
}

function contactMovement() {
  if(contactCurrentX > contactEndX || contactCurrentY > contactEndY) {
    contactCurrentX = contactCurrentX + 12.5;
    contactCurrentY = contactCurrentY - 11.5;
  }
  else {
    window.clearInterval(icontact);
    totalStop++;
  }
  contact.style.posLeft = contactCurrentX;
  contact.style.posTop = contactCurrentY;
}

function test(loc) {
  if (totalStop >= 5) {
    window.clearInterval(itest);
    document.location = loc;
  }
}

function moveButtons(loc) {
  iabout = window.setInterval("aboutMovement()",30);
  ivoice = window.setInterval("voiceMovement()",60);
  iinternet = window.setInterval("internetMovement()",100);
  iivr = window.setInterval("ivrMovement()",101);
  icontact = window.setInterval("contactMovement()",102);
  itest = window.setInterval("test('" + loc + "')",150);
}