var infoExpanded = false;
function expandInfo(){
	if(infoExpanded){
		$("#additional-content-block").animate({height: "1px"}, 500 , "linear",function(){
			$("#additional-content-block").css("borderWidth", "0px");
			$("#additional-content-block").css("backgroundColor", "#ffffff");
			$("#additional-content-block").css("height", "2px");
		});
	}
	else{
		$("#additional-content-block").css("borderWidth", "2px");
		$("#additional-content-block").css("backgroundColor", "#dedede");
		$("#additional-content-block").css("height", "1px");
		var bh = ($("#addcontainer").height() + 30) + "px";
		$("#additional-content-block").animate({height: bh}, 500 );
	}
	
	infoExpanded = !infoExpanded;
}

function showLeftPopup(){
	document.getElementById('popup_right').style.display = 'none';
	document.getElementById('popup_left').style.display = 'block';
	document.getElementById('popup_text').innerHTML = navInfo["prev"]["text"];
	document.getElementById('popup_image').src = navInfo["prev"]["img"];
	showPopup('btn_prev', 49, -26);
}

function showRightPopup(){
	document.getElementById('popup_left').style.display = 'none';
	document.getElementById('popup_right').style.display = 'block';
	document.getElementById('popup_text').innerHTML = navInfo["next"]["text"];
	document.getElementById('popup_image').src = navInfo["next"]["img"];
	showPopup('btn_next', -356, -26);
}

function showMap(){
	var pos = findElementPos(document.getElementById("mapicon"));
	$("#map_popup").css("left", (pos[0] - 600) +"px");
	$("#map_popup").css("top", (pos[1] - 385) +"px");
	$("#map_popup").show();
}

function hideMap(){
	$("#map_popup").hide();
}

function findElementPos(elemFind)
{
	var elemX = 0;
	var elemY = 0;
	do {
		elemX += elemFind.offsetLeft;
		elemY += elemFind.offsetTop;
	} while ( elemFind = elemFind.offsetParent )


	return Array(elemX, elemY);
}


function openImage(title, img_url, width, height){
	var str = "scrollbars=yes, height=" + height + ",innerHeight=" + height;
	 str += ",width=" + width + ",innerWidth=" + width;
	 
	 if (window.screen) {
	   var ah = screen.availHeight - 20;
	   var aw = screen.availWidth - 10;
	
	   var xc = (aw - width) / 2;
	   var yc = (ah - height) / 2;
	
	   str += ",left=" + xc + ",screenX=" + xc;
	   str += ",top=" + yc + ",screenY=" + yc;
	 }
	 
	wnd = window.open("", "photo", str);
	wnd.document.open();

	wnd.document.write("<html><head><title>" + title + "</title></head><body style='background-color: RGB(220, 220, 209);'>");
	
	wnd.document.write("<table cellspacing='0' cellpaddin='0' border='0' width='100%' height='100%'>");
	wnd.document.write("<tr><td align='center' valign='middle'>");
	wnd.document.write("<img src='" + img_url + "'>");
	wnd.document.write("</tr></td></table>");
	
	wnd.document.write("</body></html>");

	wnd.document.close(); 
	wnd.focus();
}





