// JavaScript Document
var preFloor = "#FloorMain";
function showFloorPlam(type,object){
	$(".BottomNav li a").attr("class","2")
	$(object).attr("class","NavSet")
	$(preFloor).fadeOut(300,function(){
		$("#Floor"+type).fadeIn(300)	
		preFloor = "#Floor"+type;
	})	
}

function PageScrollTo(num){
	var pos = $("#p"+num).position()
	$(document).scrollTop(pos.top)
}

function ShowVideo(id){
	var videoString = ' <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/' + id +'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + id +'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';
	$("#VideoContainer").html("")
	$("#VideoContainer").html(videoString)
}

function ShowCommunities(type){
	
	/*
	$("#MapComing").slideDown(300);
	$("#MapNowSelling").fadeIn(300);
	$("#MapPast").fadeIn(300);
	*/
	
		if(type == "coming"){
			
			$("#MapNowSelling").hide();
			$("#MapComing").slideDown(300);
			$("#MapPast").hide();
		}else if(type == "now"){
		
			$("#MapNowSelling").slideDown(300);
			$("#MapComing").hide();
			$("#MapPast").hide();
		}else if(type == "past"){
			$("#MapNowSelling").hide();
			$("#MapComing").hide();
			$("#MapPast").slideDown(300);
		}else if(type == "all"){
			/*
			$("#MapNowSelling").hide();
			$("#MapComing").hide();
			$("#MapPast").hide();
			*/
			$("#MapComing").slideDown(300);
			$("#MapNowSelling").fadeIn(300);
			$("#MapPast").fadeIn(300);
			
		}
	
}


//James 
	function pointOutLogo($_theID) {
		//alert($_theID)
		$("#pid"+$_theID+" > img").animate({marginTop:"0px"},200)
	}
	function pointOutLogoOff($_theID) {
		$("#pid"+$_theID+" > img").animate({marginTop:"5px"},200)
	}
	
	
	function pointOutDebug($_num) {
		//alert($_num)
	}


function showImg(object){
	if($(object).find("img").width() < $(object).find("img").height()){
		
		var imgHTML = "<img src='"+$(object).find("img").attr("src")+"'  width='333' height='500' />";
	}else{
		var imgHTML = "<img src='"+$(object).find("img").attr("src")+"' width='500' height='333' />";
	}
	$("#ImgContainer").html("")
	$("#ImgContainer").html(imgHTML)
}

function showIcon(num,type,selectIndex){
		//alert(num)
		//type =1 form map, type =2 from list
		var $_theArrow = 'url(./wp-content/themes/morningstar/images/bg_header_community.gif)';
		if(type == 1){
			//from map
			/*
			if(selectIndex == 2){
				$("#pid"+num).css("text-decoration","underline");
			}else{
				$("#pid"+num+" > img").stop();
				$("#pid"+num+" > img").animate({marginTop:"0px"},200)
			}
			*/
			$("#pid"+num+" > img").stop();
			
			//Clean up
			$("#MapNowSelling ul li, #MapComing ul li, #MapPast ul li").css('background-image','');
	
			//$("#pid"+num).parent().css('background-image',$_theArrow);
		}else{
			//from list
			$("#pid"+num+" > img").stop();
			//$("#pid"+num+" > img").animate({marginTop:"0px"},200)
			
			//Hide Arrow
			//$("#pid"+num).parent().css('background-image',$_theArrow);
			
			
			//$("#pid"+num).parent().css('border','1px solid blue');
			//alert($("#pid"+num).parent().html());
			getFlashMovie("flashContainer").showIconFlash(num);
		}
		
		
		
	}
	
function hideIcon(num,type,selectIndex){
		
	if(type == 1){
		//From map
		/*
		if(selectIndex == 2){
			$("#MapPast ul li a").css("text-decoration","none");
			
		}else{
			$("#pid"+num+" > img").stop();
			$("#pid"+num+" > img").animate({marginTop:"5px"},200)
		}
		*/
		$("#pid"+num).parent().css('background-image','');
		$("#pid"+num+" > img").stop();
		
		
	}else{
		//From List
		$("#pid"+num+" > img").stop();
		//$("#pid"+num+" > img").animate({marginTop:"5px"},200)
		$("#pid"+num).parent().css('background-image','');
		getFlashMovie("flashContainer").hideIconFlash(num);
	}
}

function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
 }
 
