$(document).ready(function()
{

	$('<div class="toolTipCon"><div class="toolTipBox"><p>&nbsp;</p></div></div>').appendTo("body");


	if ( $("div#profilesContent div.person").length )
	{
		$("div#profilesContent div.person img").mouseover(function()
		{
			$(".toolTipCon").css({ "visibility": "visible" });
		}).mousemove(function(evt)
		{
			imgSrc = $(this).attr("src");

				$(".toolTipCon").css({ "top": evt.pageY, "left": evt.pageX + 15	});
				$(".toolTipCon p").html( '<img src="' + imgSrc + '" />' );

		}).mouseout(function()
		{
			$(".toolTipCon").css({ "visibility": "hidden", "top": "-100000px" , "left": "-100000px" });
		});
	}


	if ( $("a.profileLink").length )
	{
		$("a.profileLink").mouseover(function()
		{
			$(".toolTipCon").css({ "visibility": "visible" });
		}).mousemove(function(evt)
		{
			imgSrc = $(this).parent().find("img").attr("src");

				$(".toolTipCon").css({ "top": evt.pageY, "left": evt.pageX + 15	});
				$(".toolTipCon p").html( '<img src="' + imgSrc + '" />' );

		}).mouseout(function()
		{
			$(".toolTipCon").css({ "visibility": "hidden", "top": "-100000px" , "left": "-100000px" });
		});
	}


	$("a.loginSubmit").click(function()
	{
		$("form#frmLogin").submit();
	});

	$("a.addWorkerSubmit").click(function()
	{
		$("form#frmAddEmployee").submit();
	});


	$("a.addWorderBtn").click(function()
	{
		$("form#addStorefrm").submit();
	});

	$("a.addWorkerSubmit").click(function()
	{
		$("form#frmSelectEmployees").submit();
	});

	$("a.addEmployeeBtn").click(function()
	{
		$("form#addEmployeeFrm").submit();
	});

	$("a.delEmployee").click(function(e)
	{
		var answer = confirm("Are you sure you want to delete this Employee from this store?");

		if (!answer)
		{
			e.preventDefault();
		}
	});

	$("a.remEmployee").click(function(e)
	{
		var answer = confirm("Are you sure you want to delete this Employee? All previous/current scores will be removed.");

		if (!answer)
		{
			e.preventDefault();
		}
	});

	$("a.delCurrProject").click(function(e)
	{
		var answer = confirm("Are you sure you want to delete this Current Project?");

		if (!answer)
		{
			e.preventDefault();
		}
	});

	$("a.scoreSubmit,a.scoreSubmit-b").click(function()
	{
		$("form#frmScoreSubmit").submit();
	});



	$("table.scores input[type='text'][name^='score_']").change(function()
	{
		theVal = $(this).val();
		if (theVal > 5)
		{
			$(this).val(5);
		}
		else if (theVal < 0)
		{
			$(this).val(0);
		}
		else if (isNaN(theVal))
		{
			$(this).val(0);
		}
	});


});

	var map;

	function makeMap()
	{

		if (GBrowserIsCompatible())
		{
			var m = document.getElementById("gmap");
			m.style.height = "230px";
			m.style.width = "345px";

			map = new GMap(document.getElementById("gmap"));
			map.addControl(new GLargeMapControl());
			map.centerAndZoom(new GLatLng(52.91222, -1.456999), 3);
			
			var point = new GLatLng(52.91222, -1.456999);
			
			var marker = createMarker(point);
			map.addOverlay(marker);
			//marker.openInfoWindowHtml(mhtml);
		}
	}

	function createMarker(point)
	{
		var marker = new GMarker(point);
		return marker;	  
	}


