// JavaScript Document
function setIndexZero(){
	setZindexValue(0)
}

function setIndexMax(){
	setZindexValue(1)
}

function setZindexValue(value){
	$('#pageFlipImageHolder').css('z-index',value)
}
$(document).ready(function(){
		/*var imageDivHolder = $('#pageFlipImageHolder');
		var flipingImage = $('#pageFlipImageHolder img');
		var imageAdvertistmentHolder = $('#advertistmentHolder');
		var imageAdvertistment = $('#advertistmentHolder img');
		var mouseOverLink = $('.peelThePage');
		
		var fullWidth = 600;
		var smallWidth = 50;
		var durationValue = 1000;
		
		var mouseOverEvent = false;
		
		var windowWidth = $(window).width();
		var windowHeight = $(window).height();
		
		var mouseOver = false;
		
		$(window).resize(function(){
			windowWidth = $(window).width();
			windowHeight = $(window).height();
		});

		$(window).mousemove(function(event){
			
			var currentPositoinX = windowWidth - event.pageX;
			var currentPositoinY = event.pageY;

			if(currentPositoinX < 100 && currentPositoinY < 100){
				mouseOver = true;
				$('#pageFlipImageHolder').css('z-index',1)

			}
			
			if(currentPositoinX  > 650 && currentPositoinY < 600){
				mouseOver = false;
				setTimeout(function(){
					$('#pageFlipImageHolder').css('z-index',-1)
				},800);
				
			}
			
		});
		
		$('#pageFlipImageHolder').mouseover(function(){
			$('#pageFlipImageHolder').css('z-index',1)
		});
		
		$('body').mouseleave(function(){
			setTimeout(function(){
				$('#pageFlipImageHolder').css('z-index',-1);
			},800);
		});
		*/
		
		
		/*function setZindexValue(value){
			console.log(value)
			$('#pageFlipImageHolder').css('z-index',value)
		}
		*/
		/*
		mouseOverLink.hover(function(){
			
			$('.mapPlot').animate({
				top:700
			},{queue:false});
			mouseOverEvent = true;
			
			imageDivHolder.animate({
			width:fullWidth,
			height:fullWidth
			},{queue:false,duration:durationValue});
		
			flipingImage.animate({
				width:fullWidth,
				height:fullWidth
			},{queue:false,duration:durationValue,complete:mouseOut});
			
			imageAdvertistmentHolder.animate({
				width:fullWidth,
				height:fullWidth
			},{queue:false,duration:durationValue});
			
			
		},function(){
			mouseOverEvent = true;
			
			imageAdvertistmentHolder.animate({
				width:smallWidth,
				height:smallWidth
			},{queue:false,duration:durationValue});
			
			
			
			imageDivHolder.animate({
				width:smallWidth,
				height:smallWidth
			},{queue:false,duration:durationValue});
		
			flipingImage.animate({
				width:smallWidth,
				height:smallWidth
			},{queue:false,duration:durationValue,complete:mouseOut});
			
			
			setTimeout(function animateAfterDelay(){
						$('.mapPlot').animate({
							top:0
						},{queue:false});
					},1000);
			
			
			
		});
		
		function mouseOut(){
			//animateFlip();
			mouseOverEvent = false;
		}
		
		//animateFlip();
		function animateFlip(){
			if(imageDivHolder.is(':animated')){
				
			}else{
				imageDivHolder.animate({
					width:imageDivHolder.width()+5,
					height:imageDivHolder.height()+5
				},{queue:false,complete:rollback});
				
				flipingImage.animate({
					width:flipingImage.width()+5,
					height:flipingImage.height()+5
				},{queue:false,complete:rollbackImage});
			}
		}
		
		function rollback(){
			imageDivHolder.animate({
				width:imageDivHolder.width()-5,
				height:imageDivHolder.height()-5
			})
		}
		
		function rollbackImage(){
			flipingImage.animate({
				width:flipingImage.width()-5,
				height:flipingImage.height()-5
			},function(){
				if(!mouseOverEvent){
					setTimeout(function animateAfterDelay(){
						animateFlip();
					},2000);
				}
			});
		}
		*/
		
	});
