/**
 * In XHTML strict you can't use target="_blank", but you can
 * use some javascript to emulate the same effect.
 */
function OpenNewWindow(anchorObj) {
	if (anchorObj.href) {
		anchorObj.target = "_blank";
	}
}

/**
 * Allows you to open a popup with additional features adjusted.
 */
function doPopup(src, target, features) {
	if (features == undefined) {
    features = 'location=0,statusbar=0,menubar=0,status=0,resizable=1,scrollbars=1,width=200,height=150';
  }
	
	if (target == undefined) {
		taget = '_blank';
	}
	
	var newWindow = window.open(src.getAttribute('href'), target, features);
	newWindow.focus();
	return newWindow;
}

/**
 * Function for the login box at the top of the page.
 */
function ClearEmail(inputObj) {
	if (inputObj.value.toLowerCase() == 'email address') {
		inputObj.value = '';
	}
}

function ResetEmail(inputObj) {
	if (inputObj.value.toLowerCase() == '') {
		inputObj.value = 'Email Address';
	}
}

function SwitchPassword() {
	document.getElementById('password1').style.display = 'none';
	document.getElementById('password2').style.display = '';
	document.getElementById('password2').focus();
}

function SwitchPasswordBack() {
	var password1 = document.getElementById('password1');
	var password2 = document.getElementById('password2')
	if (password2.value == '') {
		password1.style.display = '';
		password2.style.display = 'none';
		password1.value = 'Password';
	}
}
		
function parseUrl(anchorObj){
	return {
		source: anchorObj.href,
		protocol: anchorObj.protocol.replace(':',''),
		host: anchorObj.hostname,
		port: anchorObj.port,
		query: anchorObj.search,
		params: (function(){
		    var ret = {},
		        seg = anchorObj.search.replace(/^\?/,'').split('&'),
		        len = seg.length, i = 0, s;
		    for (;i<len;i++) {
		        if (!seg[i]) { continue; }
		        s = seg[i].split('=');
		        ret[s[0]] = s[1];
		    }
		    return ret;
		})(),
		file: (anchorObj.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],
		hash: anchorObj.hash.replace('#',''),
		path: anchorObj.pathname.replace(/^([^\/])/,'/$1'),
		relative: (anchorObj.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],
		segments: anchorObj.pathname.replace(/^\//,'').split('/')
	};
}

/********************************************************************************
 * Set system wide settings for jQuery modal dialogue plugin.
 *******************************************************************************/
var modalOptions = {
	opacity: 75,
	overlay: 100,
	minWidth: 200,
	maxWidth: 800,
	overlayCss: { backgroundColor:"#000" },
	containerCss: { backgroundColor: "#fff", border: "10px solid #cdcdcd" }
}

/********************************************************************************
 * Set system wide settings for JWPlayer.
 *******************************************************************************/
var jwSWFUrl = "https://s3.amazonaws.com/media.myhousedeals.com/flash/jwplayer/4.6/player-licensed.swf";
var jwVersionReq = "9.0.115.0";
var jwPlayerId = "FlashPlayer"
var jwFlashvars =	{ id: jwPlayerId, volume: 100, dock: false, autostart: false };
var jwParams = { wmode: "transparent", allowscriptaccess: "always", allowfullscreen: true };
var jwAttributes = { id: jwPlayerId, name: jwPlayerId };
var jwVideoWidth = null;
var jwVideoHeight = null;
var jwFlashPlayer = null;

/********************************************************************************
 * Set system wide settings for Flash MP3 Audio Player.
 *******************************************************************************/
var mpSWFUrl = "https://s3.amazonaws.com/media.myhousedeals.com/flash/mp3-player/player.swf";
var mpVersionReq = "9.0.115.0";
var mpPlayerId = "FlashPlayer"
var mpAttributes = { id: mpPlayerId, name: mpPlayerId };
var mpParams = { wmode: "transparent", quality: "hight", menu: "false"};
var mpFlashvars =	{ playerID: mpPlayerId };
var mpWidth = "300"
var mpHeight = "30";


/********************************************************************************
 * Set system wide values for overlib.
 *******************************************************************************/
var wholesaleDescription =
	"These properties are for sale by other real estate investors. To clarify, the word &quot;wholesale&quot; does not mean &quot;bulk&quot;. You buy each property individually. You just get a &quot;wholesale&quot; price. The investors who sell these properties want to pocket some quick and easy cash by selling you a fixer upper &quot;as is&quot;.<br><br>" +
	"You make bigger cash by buying, fixing, and re-selling. Or you can buy, fix, and rent. It is up to you. If the deal is right, you should come out on top either way. We get these deals by calling and emailing just about every real estate investor in town, asking them what they have for sale ... at a big discount, of course.";
var motivatedDescription = 
	"These properties are for sale by regular homeowners who are in a bad situation. You have several options when you buy motivated seller properties. You can work a short sale, take over their payments, wholesale it, rehab it, lease it, buy or sell on owner financing, or whatever else you can dream up.<br><br>" +
	"Most of them are desperate to sell... and desperate to sell at a price that's way below market. You win by setting yourself up for a big payday. The sellers win by getting rid of a property that's been a thorn in their side. On this site, it's all about win/win, not taking advantage of others.<br><br>" +
	"We get these leads by spending thousands of dollars per month in online ads that say &quot;We Buy Houses&quot;. These motivated sellers fill out a simple form about their property. We take that information and display it here.";
var shortSaleDescription =
	"The seller of this property is motivated to sell quickly, but there isn't much equity. This is likely because the seller's loan balance is too high. You may be able to work with the seller and their lender to &quot;short sale&quot; this property. A &quot;short sale&quot; occurs when you negotiate with their lender to accept less than what is owed by the seller as payment in full.";
var noLongerAvailableDescription = 
	"NLA = No Longer Available";