var animationSpeed = Array(500,0,200);
var opacity = new Array("1","0.75","0.5");
var cDims = Array($(window).width(),$(window).height());	// width  | height
var minDims = Array(1280,720);
var currentCity = "boston";
var intervalHandle = null;
var headerrotatecounter = 2;
var setheadernumber = null;
var countertest = 1;
var passedmarket = false;
var marketid ="blank";

$(document).ready(function(){	

$(".homediv").click(function(){
	
	if($(this).attr('id')=="homeleft"){
		var homedestinaton = "investmentoverview";
	}else if($(this).attr('id')=="homecenter"){
		var homedestinaton = "propertiesoverview";
	}else{
		var homedestinaton = "sustainability";
	}
	
	var homedestinaton 
	
	
	location.href = homedestinaton+".php";
	//alert("clicked");
});
//alert(document.images[1]);
      preload_image_object = new Image();
      image_url = new Array();
      image_url[0] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/boston.jpg";
      image_url[1] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/dc.jpg";
      image_url[2] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/london.jpg";
      image_url[3] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/losangeles.jpg";
      image_url[4] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/newyork.jpg";
      image_url[5] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/paris.jpg";
      image_url[6] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/sanfrancisco.jpg";
      image_url[7] = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/seattle.jpg";
var i=0;
for(i=0;i<=8;i++){
   preload_image_object[i]=new Image();
   preload_image_object[i].src=image_url[i];
 }
	$("#header").animate({opacity:"0.85"},animationSpeed[1]);
// this function will obscure email addresses from spam bots
function jemail(user, domain, suffix, linkText, cssClass){
	var cssText = "";
	if(cssClass){
		cssText = ' class="'+cssClass+'"';
	}
	if(linkText){
		document.write('<a href="'+'mailto:'+user+'@'+domain+'.'+suffix+'"'+cssText+' title="click here to send an email">'+linkText+'</a>');
	}
	else{
		document.write('<a href="'+'mailto:'+user+'@'+domain+'.'+suffix+'"'+cssText+' title="click here to send an email">'+user+'@'+domain+'.'+suffix+'</a>');
	}
}

//GTFO prettyphoto, fancybox is better!
//For Assets/studies
$("a[rel=gallery]").fancybox({
				'overlayColor'		: '#fff',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'inside',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
				}
			});

//$(".selector").fancybox
/*//*/
$("a[rel=bios]").fancybox({
				'overlayColor'		: '#fff',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'width'				: 810,
				'height'			: 335,
				'type'				: 'iframe',
				'titlePosition' 	: 'inside',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
				}
			});

$("a[rel=biostxt]").fancybox({
				'overlayColor'		: '#fff',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'width'				: 810,
				'height'			: 335,
				'type'				: 'iframe',
				'titlePosition' 	: 'inside',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
				}
			});
 

//Top Menu Bar
	var thisPageMeta= $('meta[name=id]').attr("content");
	var thisPage = (String(thisPageMeta));	//check meta for pagename  /example= 'green'
	//Header image based on page
	if (thisPageMeta == "green"){
		$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/round4/sustainabilitybluebar.jpg')");
		} else if (thisPageMeta == "investment"){
			$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/round4/investmentManagementbluebar.jpg')");
		} else if (thisPageMeta == "about" ){
			$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/round4/aboutbluebar.jpg')");
		} else if (thisPageMeta == "properties"){
			$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/round4/propertiesbluebar.jpg')");
		} else if (thisPageMeta == "news"){
			$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/round4/newsbluebar.jpg')");
		} else if (thisPageMeta == "contact"){
			$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/round4/contactusbluebar.jpg')");
		}else{
			$("#subpage_headerimagefixed").css("background-image","url('http://neoscapelabs.com/projects/beaconcapital/_images/cities/heads/bostonbluebar.jpg')");
		};
	
	
	/*Menu Variables*/
	var value=new Array(250, 1, 0);
		
	/*Current page alternatives*/		
	var thisFirstUl= ("#stretch"+thisPage); 					// Current Col
	var thisFirstLi=$(thisFirstUl+" li:first-child").attr('id');// Current First LI
	var thisSecondLi = $(thisFirstUl+" li:nth-child(2)").attr('id');// Current Seccond  LI 
	var thisLastLi=$(thisFirstUl+" li:last-child").attr('id'); 	//Current last LI
	
	var secondItem = $(thisFirstUl+" li:nth-child(2) a").hasClass('buttontxtsCurrent');//(BOOLEAN)
	
	if(secondItem == true){
		$(thisFirstUl+" li:nth-child(2) a").removeClass('buttontxtsCurrent').addClass('buttontxts');
		
	};
		
/*Hover Cells*/

/*Non-animated version*/
	$(".menucell").hover(
		function(){
			var colheight= $(".stretchitems", this).height(); 	//get height of items  "100px"
			var totalcolheight = colheight;	// add 8 for corners, height of the whole cell
				$(this).css({'height': totalcolheight });
				$('div.stretchcellBG', this).show(); 
				//$('div.stretchcellBGTESTOUTLINE', this).show(); //TEST OUTLINE 
				//$('div.stretchcellBGGRADIENT', this).show(); //TEST GRADIENT 
				$('div.stretchcellBG', this).css({width:'207px', opacity: 1, height: colheight});
				//$('div.stretchcellBGTESTOUTLINE', this).css({width:'200px', opacity: 1, height: colheight}); //TEST OUTLINE 
				//$('div.stretchcellBGGRADIENT', this).css({width:'200px', opacity: 1, height: colheight}); //TEST GRADIENT 
				$("div.boxtop", this).css({opacity:1});
				$("div.boxbot",this).css({opacity:1});
				//$(this).css({"border":"#333 solid 1px","padding":"0px 0px 0px 0px"})	
		},		
			function(){
					$(this).css({'height': '35px'});
					$('div.stretchcellBG', this).hide();
					//$('div.stretchcellBGTESTOUTLINE', this).hide(); //TEST OUTLINE 
					//$('div.stretchcellBGGRADIENT', this).hide(); //TEST GRADIENT 
					$("div.boxtop", this).css({opacity:0});
					$("div.boxbot",this).css({opacity:0});
					//$(this).css({"border":"#333 solid 0px","padding":"0px 1px 0px 1px"})	
					
	}); /*End hover Cells*/
/*Hover Corners*/			
	/*First LI*/																	
	$("ul li:first-child").hover( 
		function() {
			var linkColID= $(this).closest(".menucell").attr('id');
			var linkCol=(String(linkColID));  				//Which Col
			$(String("#"+linkCol+"topr")).css('background-image','url(_images/layout/btns/outline/topr.png)');
			$(String("#"+linkCol+"topmid")).css('background-color','#1B669D');
			$(String("#"+linkCol+"topl")).css('background-image','url(_images/layout/btns/outline/topl.png)');
		}, 
			function() {
				var linkColID= $(this).closest(".menucell").attr('id');
				var linkCol=(String(linkColID));  				//Which Col
				$(String("#"+linkCol+"topr")).css('background-image','url(_images/layout/btns/outline/white/topr.png)');
				$(String("#"+linkCol+"topmid")).css('background-color','#FFF');
				$(String("#"+linkCol+"topl")).css('background-image','url(_images/layout/btns/outline/white/topl.png)');
	});
	
	/*End first LI hover*/
	/*Last LI*/																						
	$("ul li:last-child").hover(
		function() {
			var linkColID= $(this).closest(".menucell").attr('id');
			var linkCol=(String(linkColID));  	
			$(String("#"+linkCol+"botr")).css('background-image','url(_images/layout/btns/outline/botr.png)');
			$(String("#"+linkCol+"botmid")).css('background-color','#1B669D');
			$(String("#"+linkCol+"botl")).css('background-image','url(_images/layout/btns/outline/botl.png)');
		}, 
			function() {
				var linkColID= $(this).closest(".menucell").attr('id');
				var linkCol=(String(linkColID));
				$(String("#"+linkCol+"botr")).css('background-image','url(_images/layout/btns/outline/white/botr.png)');
				$(String("#"+linkCol+"botmid")).css('background-color','#fff');
				$(String("#"+linkCol+"botl")).css('background-image','url(_images/layout/btns/outline/white/botl.png)');
	}); 
	/*End last LI hover*/

	/*Box Variables*/
	var topr = $(String("#"+thisPage+"topr"));
	var topmid= $(String("#"+thisPage+"topmid"));
	var topl= $(String("#"+thisPage+"topl"));
	var botr= $(String("#"+thisPage+"botr"));
	var botmid= $(String("#"+thisPage+"botmid"));
	var botl= $(String("#"+thisPage+"botl"));
	//check if last a is current. Boolean
	var thisLinkTop= "#"+thisPage+'BoxTop';	//get boxtop ID
	var thisLinkBot= "#"+thisPage+'BoxBot';	//get boxbot ID
	
	//Load with top and bottom boxes visible and blue
	$(thisLinkTop).animate({opacity: 1},0);
	$(thisLinkBot).animate({opacity: 1},0);
	//Top Box
	$(topr).css('background-image','url(_images/layout/btns/outline/topr.png)');
	$(topmid).css('background-color','#1B669D');
	$(topl).css('background-image','url(_images/layout/btns/outline/topl.png)');
	//Bottom Box
	$(botr).css('background-image','url(_images/layout/btns/outline/botr.png)');
	$(botmid).css('background-color','#1B669D');
	$(botl).css('background-image','url(_images/layout/btns/outline/botl.png)');
	//End current box settings
		
	//Unbind earlier hovers
	$("#"+thisFirstLi).unbind('mouseenter mouseleave');//Top Box
	$("#"+thisLastLi).unbind('mouseenter mouseleave');//Bottom Box
	$("div#"+thisPage).unbind('mouseenter mouseleave');//Menu cell
	
	//Non animated
		$("div#"+thisPage).hover(
			function(){
				var colheight= $(".stretchitems", this).height(); 	// get height of items  "100px"
				var totalcolheight = colheight;// add 8 for corners
					$(this).css({'height': totalcolheight });
					$('div.stretchcellBG', this).css({opacity: 1, height: colheight});
						$(botr).css('background-image','url(_images/layout/btns/outline/white/botr.png)');
						$(botmid).css('background-color','#FFF');
						$(botl).css('background-image','url(_images/layout/btns/outline/white/botl.png)');
						//$(this).css({"border":"#333 solid 1px","padding":"0px 0px 0px 0px"})	
			},		
				function(){
						$(this).css({'height': '35px'});
						$('div.stretchcellBG', this).css({opacity: 0});
						$(botr).css('background-image','url(_images/layout/btns/outline/botr.png)');
						$(botmid).css('background-color','#1B669D');
						$(botl).css('background-image','url(_images/layout/btns/outline/botl.png)');
					//$(this).css({"border":"#333 solid 0px","padding":"0px 1px 0px 1px"})	
							
		});	
	//End Current Col Hover
	
	//Bottom LI mouseover	
	$("#"+thisLastLi).hover(
			function() {	
				$(botr).css('background-image','url(_images/layout/btns/outline/botr.png)');
				$(botmid).css('background-color','#1B669D');
				$(botl).css('background-image','url(_images/layout/btns/outline/botl.png)');
			}, 
					function() {	
						$(botr).css('background-image','url(_images/layout/btns/outline/white/botr.png)');
						$(botmid).css('background-color','#FFF');
						$(botl).css('background-image','url(_images/layout/btns/outline/white/botl.png)');															
	});
	/*//End Bottom LI Manip	
	//Remove Hover on last item if last item is current
	if (lastItem == true){$("#"+thisLastLi).unbind('mouseenter mouseleave');};
	
*/

//Side Menu Bar 
	var thisSubPageMeta= $('meta[name=subid]').attr("content");
	var thisSubPage = (String(thisSubPageMeta));
	//alert(thisSubPageMeta);
	$("a#SUB"+thisSubPage).addClass("current");
	$(".bluearrow").hover(
		function () {
		$(this).find(".leftmenuarrow").attr("src","http://neoscapelabs.com/projects/beaconcapital/_images/layout/whitearrow.png")},
			//alert("arrow")},
			function() {
			$(".leftmenuarrow").attr("src","http://neoscapelabs.com/projects/beaconcapital/_images/layout/bluearrow.png")
		})
$(".bluearrowclosed").hover(
		function () {
		$(this).find(".leftmenuarrowclosed").attr("src","http://neoscapelabs.com/projects/beaconcapital/_images/layout/whitearrowclosed.png")},
			//alert("arrow")},
			function() {
			$(".leftmenuarrowclosed").attr("src","http://neoscapelabs.com/projects/beaconcapital/_images/layout/bluearrowclosed.png")
		})
	$("a#SUB"+thisSubPage).find(".leftmenuarrow").attr("src","http://neoscapelabs.com/projects/beaconcapital/_images/layout/whitearrow.png").removeClass("leftmenuarrow").addClass("leftmenuarrowwhite");
	
	//Property Listing highlight code
$.tablesorter.addParser({
      id: "commaNum",
      is: function (s) {
          return false;
      },
      format: function (s) {
          return s.replace(/,/g, '').replace(/na/,0);
         // return s.toLowerCase().replace(/na/,0); 
      },
      type: 'numeric'
  });
  
	
//BSC portfolio Table	
	$(function() {		
		$(".tablesorter").tablesorter({
			headers:{
				2:{sorter: "commaNum"}
				},
			widgets: ['zebra']}
		);
	});
//Fixed the problem with Numbers with Commas



/*Homepage City Menu Hovers*/		
/*Set Starting position*/
$("#homebararrow").animate({backgroundPosition: '17px 0px'},function(){
	$("#homebararrow").fadeIn(500);
});

/*Mouseovers*/
$(".homebluebarcitiescell").click(
		function(){
		if( $(this).hasClass('tomarket') == true){tomarket($(this).attr("id"));}
		//Kill Previous hovers
		$("#homebararrow").stop(true, true);
		//Kill Rotator
		clearInterval(intervalHandle);
		//and start counting all over again, picking up where we clicked
		var getnumber = $(this).attr('class');
		var newcountingnumbersplit = getnumber.split("-");
		var setheadernumber = parseInt(newcountingnumbersplit[1]);
		headerrotatecounter = setheadernumber+1;
		if(headerrotatecounter==9){headerrotatecounter=1};
		loopheaderrotation();
		var currentCityHover = $(this).attr("id");//Current Hovered Cell
		
		var currenturl = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/" //For making the string
		var currentCityString = "url(http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/"+currentCityHover+".jpg)"; //Set Image
		var currentTitle = currenturl+currentCityHover+"Title.png"; //Set City Title
		//Add a class tha cal listen for the 2nd click
		 $(this).addClass('tomarket');
		 //alert($(this).hasClass('tomarket'));
	//Header image transitions
		if (currentCityHover != currentCity){
			//alert(currentCityHover +" "+ currentCity);
			//Move Arrow
			var xplace = $(this).position().left;
			var xplacesize =  $(this).width();
			var xplacehalf = xplacesize / 2;
			var xaxis = (xplace + xplacehalf) -13;
			$("#homebararrow") .animate({backgroundPosition: xaxis+'px 0px'});
			
			$("#headerimage").stop(true, true);
			$("#headerimageFade").stop(true, true);
			$("#homecitytitle").stop(true, true)
			$("#homecitytitle").fadeOut(250)
			$("#headerimageFade").fadeIn(150, 
				function() 
					{ 
					$("#headerimage").css({"backgroundImage" : currentCityString});
					}); 
			$("#headerimageFade").delay(50).fadeOut(150);
			}; //End If staement			 	
		currentCity = currentCityHover;		//Set Cell
	 /* $(this).qtip({
		 overwrite: true, // Make sure the tooltip will be be overridden once created
		  content: {
				text: "Click again to view this market!" // Data to pass along with your request
		  },
		  show: {
			 ready: true // Show the tooltip as soon as it's bound, vital so it shows up the first time you hover!
		  },
		  style: {
			  tip: true,
				classes: 'ui-tooltip-light ui-tooltip-shadow'
		   },
		   position: {
			  my: 'bottom center',  // Position my top left...
			  at: 'top center' // at the bottom right of...
		   }
	 });*/
 
}); //End Animate


//General rotations
function rotateheaderimage(countertest){
	//Eliminate old tooltip
	$(".qtip").remove();
	//Remove old tomarket classes
	$('div').removeClass('tomarket')
	/*Kill Previous hovers*/
	$("#homebararrow").stop(true, true);
	//clearInterval(intervalHandle)
	
	var currentCityHover = $(".homecell-"+headerrotatecounter).attr("id");/*Current Hovered Cell*/
	var currenturl = "http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/" /*For making the string*/
	var currentCityString = "url(http://neoscapelabs.com/projects/beaconcapital/_images/cities/headswithtitles/"+currentCityHover+".jpg)"; /*Set Image*/
	var currentTitle = currenturl+currentCityHover+"Title.png"; /*Set City Title*/
	currentCity = currentCityHover;	/*Set the current city*/
	
	/*Move Arrow*/
	var xplace = $(".homecell-"+headerrotatecounter).position().left;
	var xplacesize =  $(".homecell-"+headerrotatecounter).width();
	var xplacehalf = xplacesize / 2;
	var xaxis = (xplace + xplacehalf) -13;
	//alert(xaxis);
	$("#homebararrow") .animate({backgroundPosition: xaxis+'px 0px'});
	headerrotatecounter++;	
	/*	Expected order:
		Stop Potential Spazouts
		Fade out title 
		Fade IN black
			Change the pic
			Change the Title
		Fade IN black
		Fade IN title */
	$("#headerimage").stop(true, true);
	$("#headerimageFade").stop(true, true);
	$("#homecitytitle").stop(true, true)
	$("#homecitytitle").fadeOut(250)
	$("#headerimageFade").fadeIn(150, 
		function(){ 
			$("#headerimage").css({"backgroundImage" : currentCityString});
		}); 
	$("#headerimageFade").delay(50).fadeOut(150);
	 /*End If staement*/	
	//Reset
	if(headerrotatecounter==9){headerrotatecounter=1};
	//countertest = "unset"
}
function loopheaderrotation(){
	intervalHandle = setInterval(function(){rotateheaderimage();},5000 );
	//Eliminate old tooltip
	$(".qtip").remove();
	//Remove old tomarket classes
	$('div').removeClass('tomarket')
}
//Are we on the homepage?
if($(".homebluebarcitiescell").size()>0){
	loopheaderrotation();
}
//Opens up the apropriate market when clickin on a market from the homepage
function tomarket(marketid){
	 //location.href = "currentportfolio.php?market="+(parseInt(headerrotatecounter)+1);
}
if(passedmarket == true){
	//openMap(marketid);
}

//Shifting BSP items
$('.bcspcelltitle').click(function() {
	//alert("Test");
	var thiscontent = $(this).attr("id");
	//alert($(this).attr("id"));
  $("#bcspcellcontent"+thiscontent).slideToggle('fast', function() {
    // Animation complete.
  });
});
//Shifting News Items
$('.newstitles').click(function() {
	//alert("Test");
	var thiscontent = $(this).attr("id")+"-content";
	$('.newscontent').not("#"+thiscontent).slideUp();
	//alert($(this).attr("id"));
  $("#"+thiscontent).slideToggle('fast', function() {
    // Animation complete.
  });
});
				
/*End hover Cells*/
	
	
// Instead of creating a tooltip for each element, we instead create and show
// each individual tooltip on demand and destroy it when it hides
$('.submarkermark').live('mouseover', function(event) {
	
	
	//remove the default titles
	var elems = $('.submarkermark')
   // Store our title attribute and remove it so we don't get browser tooltips showing up
   .each(function(i) {
	  $.attr(this, 'oldtitle', $.attr(this, 'title'));
   })
   .removeAttr('title');
	
   // Bind the qTip within the event handler
   $(this).qtip({
	 overwrite: false, // Make sure the tooltip won't be overridden once created
	  content: {
			text: ('<img class=\"throbber\" src=\"_images/beacon_loading.gif\" alt=\"Loading...\" />'),
			ajax: {url: 'mappopup.php',
			type: 'GET', // POST or GET
			data: {'id':$(this).attr('id')} // Data to pass along with your request
			}
	  },
	  show:{
		 event: event.type, // Use the same show event as the one that triggered the event handler
		 ready: true // Show the tooltip as soon as it's bound, vital so it shows up the first time you hover!
	  },
	  style: {
		  tip: true,
			classes: 'ui-tooltip-light ui-tooltip-shadow largeWidth'
	   },
	   position: {
		  my: 'left center',  // Position my ...
		  at: 'right center' // at the  of...
	   },
	   events: {               
		   hide: function(event, api) { 
			   api.destroy(); 
		   }
		   
	   }
   }, event); // Pass through our original event to qTip
   
});


//Tooltip for markets
  $('.hotspot').live('mouseover', function(event) {
		//remove the default titles
	  var elems = $('.hotspot')
	   // Store our title attribute and remove it so we don't get browser tooltips showing up
	   .each(function(i) {
		  $.attr(this, 'oldtitle', $.attr(this, 'title'));
	   })
	   .removeAttr('title');
       // Bind the qTip within the event handler
       $(this).qtip({
         overwrite: false, // Make sure the tooltip won't be overridden once created
		  content: {
				text: $(this).attr('alt') // Data to pass along with your request
		  },
          show: {
             event: event.type, // Use the same show event as the one that triggered the event handler
             ready: true // Show the tooltip as soon as it's bound, vital so it shows up the first time you hover!
          },
		  style: {
			  tip: true,
				classes: 'ui-tooltip-light ui-tooltip-shadow'
		   },
		   position: {
			  my: 'bottom center',  // Position my top left...
			  at: 'top center' // at the bottom right of...
		   },
           events: {               
               hide: function(event, api) { 
                   api.destroy(); 
               }
           }
       }, event); // Pass through our original event to qTip
    });
	
	
	//Check page length to see if er need the return to top link or not
	
	//alert($(".contentholder").height());
	if($(".contentholder").height() > 810){
		$(".footercontentlink").show();	
	}
	
	$(".investmentvehiclecell").click(function(){
		var idArray = $(this).attr("id").split('-');
		window.location = "http://neoscapelabs.com/projects/beaconcapital/bcsp.php?bcsp="+idArray[1];
	});
	
	$(".casestudieslearnmore").click(function(){
		var idArray = $(this).attr("id").split('-');
		window.location = "http://neoscapelabs.com/projects/beaconcapital/thecasestudy.php?casestudy="+idArray[1];
	});
	
	$(".portfoliolearnmore").click(function(){
		window.location = "http://neoscapelabs.com/projects/beaconcapital/theproperty.php?property="+$(this).attr("id");
	});
	
	

	//Portfolio Market QTips
		
	$('.portfoliomarker').live('mouseover', function(event) {
	//alert($(this).attr('alt'));
       // Bind the qTip within the event handler
	 /*
	   if( $(this).attr('alt') == "Los Angeles" || $(this).attr('alt') == "San Frisisco" || $(this).attr('alt') == "Seattle" ){
		   var myplace = "left center";
		   var atplace = "right center";
		}else if($(this).attr('alt') == "Boston"){
			var myplace = "right center";
		   	var atplace = "left center";
		}else{
			var myplace = "bottom center";
		   	var atplace = "top center";
		}
	   */
	   	var myplace = "left top";
		var atplace = "right top";
       $(this).qtip({
         overwrite: false, // Make sure the tooltip won't be overridden once created
		  content: {
				text: $(this).attr('alt') // Data to pass along with your request
		  },
          show: {
             event: event.type, // Use the same show event as the one that triggered the event handler
             ready: true // Show the tooltip as soon as it's bound, vital so it shows up the first time you hover!
          },
		  style: {
			  tip: true,
				classes: 'ui-tooltip-light ui-tooltip-shadow'
		   },
		   position: {
			   
			  my: ''+myplace+'',  // Position my top left...
			  at: ''+atplace+'' // at the bottom right of...
			  
		   },
           events: {               
               hide: function(event, api) { 
                   api.destroy(); 
               }
           }
       }, event); // Pass through our original event to qTip
    });
	

});/*End document.ready*/

