$(document).ready(function(){
	$('.light').lightBox();

	/* home page 4 image and title show-hide starts */
	$('.home-image').mouseover(function(){
		var title_image_id = $(this).attr('rel');
		show_hide_home_image(title_image_id,'mouseover_event');
	});
	$('.home-image').mouseout(function(){
		show_current_image();
	});

	$('.home-image').click(function(){
		 var title_image_id = $(this).attr('rel');
		 if($('.title-show').attr('id') != "title_image_"+title_image_id)
		 {
			 show_hide_home_image(title_image_id,'click_event');

			$('.home-image').parent().removeClass('active');
			$(this).parent().map(function () {
                 if(this.tagName == 'SPAN'){
					 $(this).parent().addClass('active');
				 }else{
					 $(this).addClass('active');
				 }
			});
		 }
	});
	/* home page 4 image and title show-hide ends */

/* retouching show-hide starts */

$('.thumb').click(function(){
		var rel = $(this).parent().attr('rel');
		var before_image = "uploaded/retouching_images/thumbs/big_"+$('#before_'+rel).val();
		var after_image = "uploaded/retouching_images/thumbs/big_"+$('#after_'+rel).val();
		//$('#bfr').css('background-image','url("'+before_image+'")');
		//$('#aft').css('background-image','url("'+after_image+'")');


		$('#bfr > img').attr('src',before_image);
		$('#aft > img').attr('src',after_image);
		
	});
//$('#mycarousel').jcarousel();
//$('#container').beforeAfter({imagePath:'images/'});

/* retouching show-hide ends */

/* anchor tagging Starts */

$('a[href*=#]').click(function() {
	if($(this).attr('href') == "#")
	{
		return false;
	}
    if (location.hostname == this.hostname) {
      var $target = $(this.hash);
	
      $target = $('[name*=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
		
        $('html,body').animate({scrollTop: targetOffset-50}, 1000);
       return false;
      }
	 
    }
  });
/* anchor tagging Ends */

});

function show_hide_home_image(title_image_id,event_name)
{
	$('.title-image').hide();
	$('#title_image_'+title_image_id).show();

	if(event_name && event_name =='click_event')
	{
		$('.title-image').removeClass('current')
		$('#title_image_'+title_image_id).addClass('current');
	}
}
function show_current_image()
{
	$('.title-image').hide();
	$('.current').show();
}
function ManagerGeneral(url) 
{	
	$('#loading').show();
		var params ={
			'IsProcess': "Y"
			};		
		$.ajax({
				type: "POST",
				url: url,
				data: params,				
				success: function(data){						
						$('#scroller').html(data);
						$('#loading').hide();
				}
		});
}
