
/*

jQuery(function($) {

	$('#phone').mask('(999) 999-9999');
	

});

*/
function getWindowInnerSize(pDoc)
{
	var width, height;
	if (!pDoc)
		pDoc = document;

	if (self.innerHeight) // all except Explorer
	{
		width = self.innerWidth;
		height = self.innerHeight;
	}
	else if (pDoc.documentElement && pDoc.documentElement.clientHeight) // Explorer 6 Strict Mode
	{
		width = pDoc.documentElement.clientWidth;
		height = pDoc.documentElement.clientHeight;
	}
	else if (pDoc.body) // other Explorers
	{
		width = pDoc.body.clientWidth;
		height = pDoc.body.clientHeight;
	}
	return {innerWidth : width, innerHeight : height};
}

function getWindowScrollPos(pDoc)
{
	var left, top;
	if (!pDoc)
		pDoc = document;

	if (self.pageYOffset) // all except Explorer
	{
		left = self.pageXOffset;
		top = self.pageYOffset;
	}
	else if (pDoc.documentElement && pDoc.documentElement.scrollTop) // Explorer 6 Strict
	{
		left = document.documentElement.scrollLeft;
		top = document.documentElement.scrollTop;
	}
	else if (pDoc.body) // all other Explorers
	{
		left = pDoc.body.scrollLeft;
		top = pDoc.body.scrollTop;
	}
	return {scrollLeft : left, scrollTop : top};
}
$(document).ready(function(){
	
	$(".open_my_popup").click(function () { 
		$(".my_turn_light").show();
		
		var ws = getWindowInnerSize();
		var wss = getWindowScrollPos();
		height_box = $(".my_top_box").height();
		var marginTop = wss.scrollTop + 350;
		//alert(wss.scrollTop);
		$(".my_top_box").css({"top": marginTop+"px"});

		$(".my_top_box").show();
		$(".my_turn_light").height($("body").height());
		$(".my_turn_light").width($("body").width());
		$(".my_turn_light").animate({ opacity: 0.8 }, 1 ); 
		return false;
	});	
	
	$("#close_popup_box").click(function () { 
		$(".my_turn_light").hide();
		$(".my_top_box").hide();
	});	
	
	
	var h = 0
		
		$("#downarrow").click(function () { 
			n = $(".my_gallery ul li").size();
			//alert(n);
			if(h < n-1)
			{	
				$(".my_gallery ul").animate({"top": "-=110px"}, "slow");
				h++;
			}
			else
			{
				$(".my_gallery ul").animate({"top": "0px"}, "slow");
				h = 0;
			}
		});	
		
		$("#uparrow").click(function () { 
			n = $(".my_gallery ul li").size();
			//alert(n);
			if(h > 0)
			{	
				$(".my_gallery ul").animate({"top": "+=110px"}, "slow");
				h--;
			}
		});	
		
		$(".my_image_box3 IMG").click(function () { 
			path = $(this).attr("name");
			path_zoom = $(this).attr("id");
			
			$("#bigimage").attr("src",path);
			$("a.zoom").attr("href",path_zoom);
		});	
		
				/*$(".callback").toggle(
				  function () {
						//alert("show");
					    $(".my_popup").show();
					    return false;
				  },
				  function () {
					$(".my_popup").hide();
					return false;
				  }
				);*/
				$(".callback").click(function () { 
					$(".my_popup").show();
				    return false;
				});
				$("#close_popup_box2").click(function () { 
					$(".my_popup").hide();
					return false;
				});	
				
	
 });
