$(document).ready(function() {
	$("#ix-nav li").hover(
		function() { $("ul", this).fadeIn(10); }, 
		function() { } 
	);
	$(".nav_stick").hover(
		function () {$(this).children("A").attr("class","on");},
		function () {$(this).children("A").attr("class","off");}
	);
	if (document.all) {
		$("#ix-nav li").hoverClass("sfHover");
	}
	document.getElementById("layoutcontent").style.display = "inline";
	
	if (document.getElementById("prop_link_scroll")) {
		fleXenv.fleXcrollMain("prop_link_scroll");
	}
	
	if (document.getElementById("mod_cover")) {
		window.onscroll = function () { document.getElementById("mod_cover").style.top = document.body.scrollTop; };
	}

});
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};
function txtHover(id,className) {
	document.getElementById(id).className=className;
}

function mapDoOver(obj,id) {
	var newTop = 0;
	var lbl = document.getElementById(id);
	obj.className="map_dot_on";
	obj.style.zIndex = "2000";
	lbl.style.display="inline";
}
function mapDoOut(obj,id) {
	obj.className='map_dot';
	obj.style.zIndex = "1004";
	document.getElementById(id).style.display = "none";
}

function propOn(img,spn) {
	document.getElementById(img).src='docs/images/trans.gif';
	document.getElementById(spn).style.display='inline';
}
function propOff(img,spn) {
	document.getElementById(img).src='docs/images/trans.gif';
	document.getElementById(spn).style.display='none';
}

prop_cur = 1;
safari=(navigator.userAgent.indexOf('Safari')!=-1);
function swapImg(i) {
	var j;
	prop_cur = i;
	if (safari) {document.getElementById("img_src").src = 'docs/images/trans.gif';}
	//document.getElementById("img_src").src = 'docs/images/gallery238/' + prop_imgs[i];
	document.getElementById("img_src").src = prop_imgs[i].src;
	for (j=1;j <= prop_tot;j++) {
		document.getElementById("a_"+j).className = "off";
	}
	document.getElementById("a_"+i).className = "on";
}

function nextImg() {
	if (prop_cur == prop_tot) {
		prop_cur = 1;
	} else {
		prop_cur += 1;
	}
	swapImg(prop_cur);
}
function prevImg() {
	if (prop_cur == 1) {
		prop_cur = prop_tot;
	} else {
		prop_cur -= 1;
	}
	swapImg(prop_cur);
}
function getProp(obj,prop) {
	if(window.getComputedStyle) {
		compStyle = window.getComputedStyle(obj,null);
		return parseInt(compStyle[prop],10);
	} else if (obj.currentStyle) {
		return parseInt(obj.currentStyle[prop],10);
	} else {
		return parseInt(obj.style[prop],10);
	}
}

function showMap() {
	document.getElementById("prop_box").style.display = "block";
}
function hideMap() {
	document.getElementById("prop_box").style.display = "none";
}


function showModal(idx) {
	document.getElementById("mod_cover").style.display = "inline";
	document.getElementById("mod_content").style.display = "inline";
	document.getElementById("mod_content_title").innerHTML = document.getElementById("mod_data_title").innerHTML;
	loadModalTab(idx);
}
function closeModal() {
	document.getElementById("mod_cover").style.display = "none";
	document.getElementById("mod_content").style.display = "none";
}

var curr_mod = 0;
function loadModalTab(idx) {
	if (idx !== curr_mod) {
		if (curr_mod !== 0) {
			document.getElementById("mod_nav_"+curr_mod).className = "off";
		}
		
		curr_mod = idx;
		document.getElementById("mod_nav_"+curr_mod).className = "on";
		
		document.getElementById("mod_value").innerHTML = "";
		
		document.getElementById("mod_noscroll").innerHTML = "";
		document.getElementById("mod_noscroll").style.display = "none";

		if (curr_mod == 3) {
			document.getElementById("mod_noscroll").innerHTML = "<div id=\"mod_value_3\" style=\"height:550px;width:905px;\"></div>";
			document.getElementById("mod_noscroll").style.display = "inline";
			initialize_map();
		} else {
			document.getElementById("mod_value").innerHTML = document.getElementById("mod_data_"+curr_mod).innerHTML;
			document.getElementById("mod_scroll").className = "flexcroll";
			fleXenv.fleXcrollMain("mod_scroll");
			document.getElementById("mod_scroll").fleXcroll.updateScrollBars();
		}
	}

}

function initialize_map() { 
	var lat = document.getElementById("mod_data_3").getAttribute("lat");
	var lng = document.getElementById("mod_data_3").getAttribute("lng");
	var info = document.getElementById("mod_data_3").innerHTML;
	
	if (lat == "" || lng == "") {
		lat = "38.578266";
		lng = "-121.485615";
		info = "";
	}
	
	var latlng = new google.maps.LatLng(lat,lng); 
	var myOptions = { 
		zoom: 14, 
		center: latlng, 
		mapTypeId: google.maps.MapTypeId.ROADMAP 
	}; 
	var map = new google.maps.Map(document.getElementById("mod_value_3"), myOptions); 
	
	var marker = new google.maps.Marker({ 
		position: latlng,  
		map: map
	}); 
	
	var infowindow = new google.maps.InfoWindow({ 
		content: info
	}); 

	google.maps.event.addListener(marker, 'click', function() { 
		infowindow.open(map,marker); 
	});
	
	infowindow.open(map,marker); 
}


//function showLease() {
//	hideTenant();
//	if (navigator.appName == 'Microsoft Internet Explorer') {
//		document.getElementById("prop_lease").style.left = "175px";
//		document.getElementById("prop_lease_box").style.width = "100%";
//	}
//	if (document.getElementById("prop_lease").style.display == "none") {
//		document.getElementById("prop_lease").style.display = "inline";
//	} else {
//		hideLease();
//	}
//}
//function hideLease() {
//	document.getElementById("prop_lease").style.display = "none";
//}

//function showTenant() {
//	hideLease();
//	if (navigator.appName == 'Microsoft Internet Explorer') {
//		document.getElementById("prop_tenant").style.left = "175px";
//		document.getElementById("prop_tenant_box").style.width = "100%";
//	}
//	if (document.getElementById("prop_tenant").style.display == "none") {
//		document.getElementById("prop_tenant").style.display = "inline";
//	} else {
//		hideTenant();
//	}
//}
//function hideTenant() {
//	document.getElementById("prop_tenant").style.display = "none";
//}


//function showMap() {
//	if (navigator.appName == 'Microsoft Internet Explorer') {
//		document.getElementById("prop_map").style.left = "275px";
//		document.getElementById("prop_map").style.width = "367px";
//		document.getElementById("prop_map_box").style.width = "100%";
//	}
//	if (document.getElementById("prop_map").style.display == "none") {
//		document.getElementById("prop_map").style.display = "inline";
//	} else {
//		hideMap();
//	}
//}
//function hideMap() {
//	document.getElementById("prop_map").style.display = "none";
//}
