function showPopup(offheight, imageDiv, menuDiv, width, height) 
{
	var pos = $("#"+imageDiv).offset();
	var imageWidth = $("#"+imageDiv).width();
	var imageHeight = $("#"+imageDiv).height();
	
	if(offheight == "ah")
		var offset = imageHeight;
	if(offheight == "oh")
		var offset = 2;
	if(height == "auto")
		var aheight = height;
	else
		var aheight = height+"px";
		
	$("#"+menuDiv).css({
					    'position': "absolute",
						'z-index': "10000",
						'border': "1px solid #999999",
						'font-size': 11+"px",
						'font-weight': "bold",
						'left': (pos.left) + (imageWidth + 2) + 'px',
						'top': (pos.top) + (imageHeight - offset) + 'px',
						'width': width+"px",
						'height': aheight,
						'display': "block",
						'-moz-box-shadow': '2px 2px 1px #999999',
						'-webkit-box-shadow': '2px 2px 1px #999999',
						'box-shadow': '2px 2px 1px #999999'
					 });
    $(document).click(function (event) {
		var target = event.target;
		if($(target).parents("#"+menuDiv).attr("id") != menuDiv && $(target).attr("id") != imageDiv){
			$("#"+menuDiv).css({
								'display': "none"
							 });
		}
    });
}
function showText(div)
{
	if(div == "client")
	{
		document.getElementById("client").style.display="";
		document.getElementById("accolades").style.display="none";
		document.getElementById("profile").style.display="none";
		showPopup('oh', 'clientHref', 'clientDiv', '200', '50');
	}
	else if(div == "accolades")
	{
		document.getElementById("client").style.display="none";
		document.getElementById("accolades").style.display="none";
		document.getElementById("profile").style.display="";
		showPopup('oh', 'accoladesHref', 'accoladesDiv', '200', '240');
	}
	else if(div == "profile")
	{
		document.getElementById("client").style.display="none";
		document.getElementById("accolades").style.display="";
		document.getElementById("profile").style.display="none";
		showPopup('oh', 'profileHref', 'profileDiv', '200', '240');
	}
}
function ajax()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		alert("Your browser does not support XMLHTTP!");
	}
	return xmlhttp;
}
function select_client(value)
{
	document.getElementById("clientTd").innerHTML="<img src=\"../images/loader.gif\" width=24 height=24 />";
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			document.getElementById("clientTd").innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","select_client.php?client_type_id="+value,true);
	xmlhttp.send(null);
}
function showClient(offheight, client_type_id, imageDiv, menuDiv, width, height)
{
	showPopup(offheight, imageDiv, menuDiv, width, height);
	//document.getElementById(menuDiv).innerHTML="<img src=\"images/loader.gif\" width=24 height=24 />";
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			document.getElementById(menuDiv).innerHTML=xmlhttp.responseText;
			$("#clientScroller"+client_type_id).simplyScroll({
				className: 'vert',
				horizontal: false,
				frameRate: 20,
				speed: 5
			});
		}
	}
	xmlhttp.open("GET","show_client.php?client_type_id="+client_type_id,true);
	xmlhttp.send(null);
}
function showExhibition(offheight, client_id, imageDiv, menuDiv, width, height)
{
	showPopup(offheight, imageDiv, menuDiv, width, height);
	//document.getElementById(menuDiv).innerHTML="<img src=\"images/loader.gif\" width=24 height=24 />";
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			document.getElementById(menuDiv).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","show_exhibition.php?client_id="+client_id+"&menuDiv="+menuDiv,true);
	xmlhttp.send(null);
}
function showAwards(offheight, client_id, imageDiv, menuDiv, width, height)
{
	showPopup(offheight, imageDiv, menuDiv, width, height);
	//document.getElementById(menuDiv).innerHTML="<img src=\"images/loader.gif\" width=24 height=24 />";
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			document.getElementById(menuDiv).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","show_awards.php?client_id="+client_id+"&menuDiv="+menuDiv,true);
	xmlhttp.send(null);
}
function showImage(profile_id, menuDiv, w, h)
{
	document.getElementById(menuDiv).style.display="none";
	var popUp = document.getElementById("imagePopup");    
	var centerWidth = (window.screen.width - w) / 2;
	centerHeight = 0;    
	popUp.style.top = centerHeight + "px";   
	popUp.style.left = centerWidth + "px";   
	popUp.style.width = w + "px";   
	popUp.style.height = h + "px";    
	popUp.style.visibility = "visible";
	document.getElementById("imagePopup").innerHTML="";
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{
	if(xmlhttp.readyState==4)
	  {
		document.getElementById("client").style.display="none";
		document.getElementById("accolades").style.display="none";
		document.getElementById("profile").style.display="none";
		popUp.innerHTML=xmlhttp.responseText;
		$("#slider").easySlider({
			auto: false, 
			continuous: false
		});
	  }
	}
	xmlhttp.open("GET","show_image.php?profile_id="+profile_id+"&menuDiv="+menuDiv,true);
	xmlhttp.send(null);
}
function hideImage()
{
	document.getElementById("client").style.display="none";
	document.getElementById("accolades").style.display="none";
	document.getElementById("profile").style.display="";
	var popUp = document.getElementById("imagePopup");   
	popUp.style.visibility = "hidden";
}
function showLocation(offheight, location_id, imageDiv, menuDiv, width, height)
{
	showPopup(offheight, imageDiv, menuDiv, width, height);
	//document.getElementById(menuDiv).innerHTML="<img src=\"images/loader.gif\" width=24 height=24 />";
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			document.getElementById(menuDiv).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","show_location.php?location_id="+location_id,true);
	xmlhttp.send(null);
}
function showMap(loc_add,latitude, longitude, w, h)
{
	var popUp = document.getElementById("mapPopup");    
	var centerWidth = (window.screen.width - w) / 2;
	centerHeight = 100;    
	popUp.style.top = centerHeight + "px";   
	popUp.style.left = centerWidth + "px";   
	popUp.style.width = w + "px";   
	popUp.style.height = h + "px";    
	popUp.style.visibility = "visible";
	//document.getElementById("imagePopup").innerHTML="<img src=\"images/loader.gif\" width=24 height=24 />";
	var map = null;
	var geocoder = null;

	function load(loc) {
		if (GBrowserIsCompatible()) {
			var point;
			var map = new GMap2(document.getElementById("map"));

			map.addControl(new GOverviewMapControl());
			map.enableDoubleClickZoom();
			map.enableScrollWheelZoom();
			map.addControl(new GMapTypeControl());
			map.addControl(new GSmallMapControl());
			var address = '<div style="background-color:#FFFFFF;">'+loc_add+'</div>';
			point = new GLatLng(latitude, longitude);

			var marker = new GMarker(point);
			map.setCenter(point, 17);
			map.addOverlay(marker);
			map.setMapType(G_HYBRID_MAP);
			GEvent.addListener(marker, "mouseover", function() { marker.openInfoWindowHtml(address); });
			marker.openInfoWindowHtml(address);
			map.setCenter(point, 17);
		}
	}
	load('1');
	document.getElementById("map").innerHTML='<img src="uploaded/'+location_image+'" width=590 height=400 />';
}
function hideMap()
{
	var popUp = document.getElementById("mapPopup");   
	popUp.style.visibility = "hidden";
}

