﻿// JScript File

function navigateMLS(destinationUrl, destinationUrlOptions) {
    if(mlsAvailable) {  //mlsAvailable set by headerfooter.master
        var url = "/proxy.aspx?sys=MLS";
        if (destinationUrl != null && destinationUrl != '') {
        	url += "&d=" + destinationUrl;
        	if (destinationUrlOptions != undefined) {        	    
        		url += "&opt=" + destinationUrlOptions;
			}
		}
		window.location = url;
    }
    else {
        //alert("MLS is unavailable");
        var x = window.showModalDialog("/UnavailableSystem.aspx?s=MLS",null,"dialogWidth: 356px; dialogHeight: 270px; center: true; status: true; scroll: false;");
    }
}

function navigatePR(destinationUrl) {
    if(prAvailable) { //prAvailable set by headerfooter.master
        var url = "/proxy.aspx?sys=REALTYRECORDS"
        if (destinationUrl != null && destinationUrl != '') {
            url += "&d=" + destinationUrl;
        }
        window.location = url;
    }
    else {
        //alert("MLS is unavailable");
        var x = window.showModalDialog("/UnavailableSystem.aspx?s=PR",null,"dialogWidth: 356px; dialogHeight: 270px; center: true; status: true; scroll: false;");
    }
}

function navigateBT() {
    if(btAvailable) { //btAvailable set by headerfooter.master
        var url = "/proxy.aspx?sys=MyAccount"
        window.open(url);
    }
    else {
        //alert("MLS is unavailable");
        var x = window.showModalDialog("/UnavailableSystem.aspx?s=BT",null,"dialogWidth: 356px; dialogHeight: 270px; center: true; status: true; scroll: false;");
    }
}

function navigateBTLogin() {
	if (btAvailable) { //btAvailable set by headerfooter.master
		if (typeof EnableContinueTrendButton == 'function')
		{
			EnableContinueTrendButton(); //enable the continue into Trend button
		}
		var url = "/proxy.aspx?sys=MyAccountLogin"
		window.open(url);
	}
	else {
		//alert("MLS is unavailable");
		var x = window.showModalDialog("/UnavailableSystem.aspx?s=BT", null, "dialogWidth: 356px; dialogHeight: 270px; center: true; status: true; scroll: false;");
	}
}
