var zoom_duration = 300
var timer_duration = 2000
var form_duration = 300
var timer = null

$(document).ready(function(){
  $('#zoom_images li').hover(function(){
    $('img', this).stop()
    $('img', this).animate({
      width: '80px',
      height: '80px',
      left: '-20px',
      top: '-20px'
    }, zoom_duration).css({
      zIndex: 10
    })
    $(this).css({
      zIndex: 10
    })
  }, function(){
    $('img', this).stop()
    $('img', this).animate({
      width: '45px',
      height: '45px',
      left: '0px',
      top: '0px'
    }, zoom_duration)
    $('img', this).queue(function(){
      $(this).css({
        zIndex: 1
      })
      $(this).parent().parent().css({
        zIndex: 1
      })
      $(this).dequeue()
    })
  })

  $('#dezin_text img').hover(function(){
    $(this).stop()
    $(this).animate({
      width: '200px',
      left: '-5px'
    }, zoom_duration)
  }, function(){
    $(this).stop()
    $(this).animate({
      width: '190px',
      left: '0px',
      top: '0px'
    }, zoom_duration)
  })

  $('#mail_image').hover(function(){
    $(this).stop()
    $(this).animate({
      width: '113px',
      left: '-15px'
    }, zoom_duration)
  }, function(){
    $(this).stop()
    $(this).animate({
      width: '100px',
      left: '0px'
    }, zoom_duration)
  })

  $('#contact_image').hover(function(){
    $(this).stop()
    $(this).animate({
      width: '46px',
      left: '108px'
    }, zoom_duration)
  }, function(){
    $(this).stop()
    $(this).animate({
      width: '40px',
      left: '115px'
    }, zoom_duration)
  })

  $('#frog_small img').hover(function(){
    $(this).stop()
    $(this).animate({
      width: '50px',
      left: '-6px',
      top: '-5px'
    }, zoom_duration)
  }, function(){
    $(this).stop()
    $(this).animate({
      width: '40px',
      left: '0px',
      top: '0px'
    }, zoom_duration)
  })
  
  $('#dezin_text').click(function(){
	  $('#dezin_popup2').hide(300)
      $('#dezin_popup').show(300)
  })
  
  $('#frog_small').click(function(){
      $('#dezin_popup').hide(300)
	  $('#dezin_popup2').show(300)

  })  
  

  $('#contact').click(function(){
      $('#form_popup').show(form_duration)
  })
  
  centerWin('container')
  
  $(window).resize(function(){
      centerWin('container')
  })
})

function clearInput(input, val) {
  if(input.value == val) {
    input.value = ""
  }
}

function centerWin(b, center_win) {
  var box = document.getElementById(b)
  var frog_box = document.getElementById("frog_placeholder")
  
  if(document.documentElement.clientHeight > box.offsetHeight)  {
    box.style.top = '50%'
    box.style.marginTop = -(box.offsetHeight/2)+'px'
  } else {
    box.style.top = '0px'
    box.style.marginTop = '0px'
  }
  
  if(document.documentElement.clientWidth > box.offsetWidth)  {
    box.style.left = '50%'
    box.style.marginLeft = -(box.offsetWidth/2)+'px'
  } else {
    box.style.left = '0px'
    box.style.marginLeft = '0px'
  }
}