$(document).ready(function() {

  // CUSTOM BUTTON
  $('input.custom_button').each(function(){
      $(this).css({position:'absolute', opacity:0, zIndex: 999}).after('<span class="custom_button smoothed"></span>').next('span.custom_button').text($(this).val()).click(function(){
        $(this).prev('input.custom_button').click();
    });
  });
  
	// CUSTOM BUTTON - hover
	$('input.custom_button').hover(function(){
		$(this).next('span.custom_button').addClass('custom_button_hover');
	},
	function(){
		$(this).next('span.custom_button').removeClass('custom_button_hover');	
	});

	// GIRL ON HOMEPAGE - hover
  $('.girl').hover(function(){
      $(this).addClass('girl_hover');
      $(this).find('span').fadeOut(700);
      Cufon.refresh('.smoothed');
  },
  function(){
      $(this).removeClass('girl_hover');
      $(this).find('span').fadeIn(0);
      Cufon.refresh('.smoothed');
  });
  
  // GIRL ON HOMEPAGE - box ako odkaz
  $('.girl').click(function(){
    window.location = $(this).find('h2 a').attr('href');
  });
  
  $("#header").append('<div id="header_text"><strong>Welcome</strong>,<br /> Slovakia-escort.com presents you the best attractive girls in Slovakia. All escorts on website are independent companions from Slovakia - Bratislava and Czech republic - Prague. Escort agency - Slovakia Escort gives you the best quality of girls from Slovakia and Czech republic. All pictures and all details about companions on our website slovakia-escort.com are 100% genuine and actual. Our luxury companions are available for meeting worldwide. Escort girls use Bratislava, Vienna or Prague airport. Choose girl, contact us, enjoy time with escort girl<br /> Slovakia-escort.com</div>');

  
  // GALLERY - hover
  $('a.gal').hover(function(){
      $(this).addClass('gal_hover');
      $(this).find('span.img').fadeOut(700);
  },
  function(){
      $(this).removeClass('gal_hover');
      $(this).find('span.img').fadeIn(0);
  });
  
  // GALLERY - dimension
  var cwidth = $('#photo img').width();
  var cheight = $('#photo img').height();
  $('#photo').css({width: cwidth+'px', height : cheight+'px' })

  // GALLERY - load image
  $("a.gal").click(function() {
          $('a.gal_active').removeClass('gal_active');
          $(this).addClass('gal_active');
          $('#photo').fadeOut(0);
          $('#photo img').remove();
          link = $(this).attr("href");
          var newimage = new Image();
          newimage.src = link;
  
          newimage.onload = function(){
              var width = (newimage.width);
              var height = (newimage.height);
              
              $('#photo').prepend('<img src="'+link+'" />').css({width: width+'px', height : height+'px' });
              $('#photo img').attr('src',link).attr('width', width).attr('height', height);
              $('#photo').fadeIn(500);
              //$("#photo img").load(function(){$("#hr").beforeAfter({animateIntro:true});}); 
          }
   return false;
  })
  

});

function swip (elementInput, swipFrom, swipTo){
	if (elementInput.value == swipFrom) elementInput.value = swipTo;
}

