/*
 * JTip
 * By Cody Lindley (http://www.codylindley.com)
 * Under an Attribution, Share Alike License
 * JTip is built on top of the very light weight jquery library.
 */

//on page load (as soon as its ready) call JT_init

//window.open('www.baidu.com','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=100,height=200');

function a(page, w, h, t, l, wn) {
    if (parseInt(navigator.appVersion) >= 4) {
        l = (screen.width - w) / 2;
        t = (screen.height - h) / 2;
    }
    var loc = 'width=' + w + ',height=' + h + ',top=' + t + ',left=' + l;

    a_handle = window.open(page, wn, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no," + loc);
    if (parseInt(navigator.appVersion) >= 4) { a_handle.window.focus(); }
}

$(document).ready(JT_init);

function JT_init(){
	       $("a.jTip")
	      
		   .hover(function() { JT_show(this.href, this.id, this.name, $(this).attr('tooltipID')) }, function() { $('#JT').remove() })
           .click(function() { return false });	
           
              
}
var Sources = new Array();
Sources[0]="Moving Station\'s programs for helping seniors overcome the hurdles of home sale are indispensable tools for both the customer and the client community."
Sources[1] = "In the final installment of our three-part Moving On and Moving In series, we look at more issues submitted by clients relating to real estate agents and brokerage.";
Sources[2] = "In the second installment of our three-part Moving On and Moving In series, we address questions submitted by our clients specific to the impact of foreclosure activity on local markets and individual homeowners.";
Sources[3] = "Today, the most significant obstacle a depositor faces in the path of becoming a resident is the sale of their current home. In the first installment of our three-part Moving On and Moving In series, we discuss how you can help them overcome many of these challenges and get them moving on and moving in. ";
Sources[4] = "It\'s a simple enough question though deriving the answer is a bit complex. In this article, we delve deeper into the real estate market\'s current condition to give our prediction on when and how it will inevitably rebound. ";
Sources[5] = "At this time of year homeowners looking to sell trust the time-tested strategy of waiting until spring to push their homes onto the market. While this strategy generally held sway for many years, the current economic upheaval changes everything. ";
Sources[6] = "In this article we look at our senior\'s expectations for their neighborhood real estate markets and present the harsh reality of an ensuing \"Perfect Storm\".";
Sources[7] = "Chief among the complaints heard from homesellers in today\'s real estate market, is the oft-repeated lament, \"I lost money due to the 2006-2010 downturn.\" In this article, we discuss how home pricing data over time reveals what many will find to be a startling conclusion. ";
Sources[8] = "The moving process can be filled with anxiety from uncertainties. Moving Station helps to relieve some of that stress, instilling confidence in the home sale process.";
Sources[9] = "Imagine you can sign a depositor, and give them a receipt that guarantees the sale of their home and a move in date. How would that impact your sales and marketing? Your cash flow? Your peace of mind? And theirs?";
Sources[10] = "There are many myths surrounding home sales today. In this article we take 10 of the more common myths and set them straight, while showing how we can make the shift into the next part of your life quick and stress-free.";
Sources[11] = "Imagine you can sign a depositor, and give them a receipt that guarantees the sale of their home and a move in date. How would that impact your sales and marketing? Your cash flow? Your peace of mind? And theirs?";
Sources[12] = "Rob Love gives a first-hand look at the success that home sale can have when it is with Moving Station. The comparison with his mother's home sale and the house next door gives excellent insight into the good that Moving Station can do for you.";
Sources[13] = "Moving Made easy helps to simplify the transition process into a new community. With MME you\'ll have no difficulty managing the gap between deposit and move-in.";
Sources[14] = "Having a Real Estate Counselor available for potential residents lightens the stress of home selling while taking care of the residents\' best interests.";
Sources[15] = "The Home Purchase Program allows for a quick turnaround that takes the pressure of home selling off your hands and gives it to real estate experts. Faster results lead to an increase in cash flow.";
Sources[16] = "You\'ve probably heard some of the same assumptions that we have, in this article we outlined our top seven. We are also sharing some of the tips we use to educate and guide seniors who may be selling for the first time in years.";
Sources[17] = "As the real estate market begins to stabilize, it is still hindered by unemployment. Moving Station provides three solutions with our different available services.";
Sources[18] = "Moving can present a whole array of challenges to overcome such as, concern over the sale of a current home. Moving Station offers three different solutions to these obstacles through the Home Sale Program, Home Purchase Program and Moving Made Easy. This article goes into more detail about what each individual program can do.";
Sources[19] = "Don\'t focus on where the market has been, look towards the future to achieve success.";
Sources[20] = "The number of homes for sale has steadily increased over the years with the supply of available homes outpacing the demand. Home sellers are also putting consistent downward pressure on prices through distressed sales. While normalizing may be on the way according to certain trends, Moving Station continues to stay ahead of the market instead of following behind it.";
Sources[21] = "The services that Moving Station offers through the Home Sale Program, Home Purchase Program, and Moving Made Easy make the moving process easy in a difficult real estate environment. These programs lead to a greater home sale success rate and allow a smooth transition into a new lifestyle.";
Sources[22] = "When it comes to selling a home, the real estate agent can make all the difference in the world. We work with agents that represent the 4 E\'s; experience, expertise, efficiency and energy.  Their hard work enables us to sell homes well before the national market average.";
Sources[23] = "With the decline of home prices in recent years you might assume it\'s easier to stay in a home where there is no monthly community fee. What you may not realize is the impact that home maintenance and repairs can have. With the help of Moving Station, you can avoid these unnecessary expenses, sell your current home and find a community that best suits you in no time.";
Sources[24] = "Because real estate is one of the primary drivers of U.S. prosperity and economic activity, much has been made of the struggles facing the residential market over the past 4 years. Tumbling prices, excessive inventory and rising defaults left the nation in a self-perpetuating downward spiral, and left sellers searching for signs of recovery. One challenge that remains an obstacle to a turnaround is the pending calendar of foreclosures.";
Sources[25] = "The question always comes up in conversation with future residents. The first steps toward a market-ready home are revealed through a comprehensive home marketing analysis performed by at least two real estate professionals. The results should be clear and actionable recommendations forming the basis of a marketing strategy.";

function JT_show(url, linkId, title,tooltipID) {
   
	if(title == false)title="&nbsp;";
	var de = document.documentElement;
	var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var hasArea = w - getAbsoluteLeft(linkId);
	var clickElementy = getAbsoluteTop(linkId) - 3; //set y position
	
	var queryString = url.replace(/^[^\?]+\??/,'');
	var params = parseQuery( queryString );
	if(params['width'] === undefined){params['width'] = 250};
	if(params['link'] !== undefined){

	    $('#' + linkId).bind('click', function() { 

t=0;
l=0;
w=800;
h=700;
 if (parseInt(navigator.appVersion) >= 4) {
        l = (screen.width - w) / 2;
        t = (screen.height - h) / 2;
    }
    var loc = 'width=' + w + ',height=' + h + ',top=' + t + ',left=' + l;

window.open(params['link'],linkId,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,'+loc );
	});
	$('#' + linkId).css('cursor','pointer');
	}
	
	if(hasArea>((params['width']*1)+75)){
	    $("body").append("<div id='JT' style='width:" + params['width'] * 1 + "px'><div id='JT_arrow_left'></div><div id='JT_close_left'>" + title + "</div><div id='JT_copy'>" + Sources[tooltipID] + "<div></div></div>"); //right side
		var arrowOffset = getElementWidth(linkId) + 11;
		var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position
	}else{
		$("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_arrow_right' style='left:"+((params['width']*1)+1)+"px'></div><div id='JT_close_right'>"+title+"</div><div id='JT_copy'>1111111111111111<div></div></div>");//left side
		var clickElementx = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position
	}
	
	$('#JT').css({left: clickElementx+"px", top: clickElementy+"px"});
	$('#JT').show();
	//$('#JT_copy').load(url);

}

function getElementWidth(objectId) {
	x = document.getElementById(objectId);
	return x.offsetWidth;
}

function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	return oLeft
}

function getAbsoluteTop(objectId) {
	// Get an object top position from the upper left viewport corner
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	return oTop
}

function parseQuery ( query ) {
   var Params = new Object ();
   if ( ! query ) return Params; // return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function blockEvents(evt) {
              if(evt.target){
              evt.preventDefault();
              }else{
              evt.returnValue = false;
              }
}
