var arrTopics = new Array();
var arrItems;

arrItems = new Array(1, new Array(3));
arrItems[1][0] = 6;
arrItems[1][1] = 7;
arrItems[1][2] = 4;
arrTopics[0] = arrItems;

arrItems = new Array(2, new Array(3));
arrItems[1][0] = 146;
arrItems[1][1] = 13;
arrItems[1][2] = 10;
arrTopics[1] = arrItems;

arrItems = new Array(3, new Array(3));
arrItems[1][0] = 18;
arrItems[1][1] = 19;
arrItems[1][2] = 16;
arrTopics[2] = arrItems;

arrItems = new Array(4, new Array(3));
arrItems[1][0] = 24;
arrItems[1][1] = 25;
arrItems[1][2] = 22;
arrTopics[3] = arrItems;

arrItems = new Array(5, new Array(3));
arrItems[1][0] = 30;
arrItems[1][1] = 31;
arrItems[1][2] = 28;
arrTopics[4] = arrItems;

arrItems = new Array(6, new Array(3));
arrItems[1][0] = 36;
arrItems[1][1] = 37;
arrItems[1][2] = 34;
arrTopics[5] = arrItems;

arrItems = new Array(7, new Array(3));
arrItems[1][0] = 45;
arrItems[1][1] = 47;
arrItems[1][2] = 41;
arrTopics[6] = arrItems;

var sType = "realtor";

function checkSource(frm) {
    if(frm.source.value=='') {
        changeSource('realtor')
    }
}

function frmSubmitFindHome( frm, piranhaurl ) {
    if (frm.city.value == ''||frm.city.value == ' Enter City' && sType!="homeplans") {
        alert("Please Enter A City");
        frm.city.focus();
        return false;
    }
    if (frm.state.selectedIndex == ''&& sType!="homeplans") {
        alert("Please Select A State");
        frm.state.focus();
        return false;
    }
    
    goPiranhaPage( piranhaurl, "http://www.homestore.com/HS_Special/Redirects/FindHomeRedir.asp?"
    + "city=" + frm.city.value
    + "&submitto=" + sType
    + "&state=" + frm.state.value
    + "&gate=" + frm.gate.value
    + "&source=" + frm.source.value ) ;
    return false;
}

function ReloadTopics( newValue ) {
    intIndex = findIndex(newValue);
    if (intIndex != -1) {
        optTopic = document.frmIntLearning.elements["optTopic"];
        optTopic[0].value = arrTopics[intIndex][1][0];
        optTopic[1].value = arrTopics[intIndex][1][1];
        optTopic[2].value = arrTopics[intIndex][1][2];
    }
}

function findIndex(newValue) {
    for (var i=0; i < arrTopics.length;i++) {
        if (arrTopics[i][0] == newValue) return i;
    }
        
        return -1;
}
        
function frmFHRSubmit( frm , piranhaurl ) {
    goPiranhaPage( piranhaurl, "http://netscape.bargain.com/click/statesearch.aspx?aid=pr_h957j&type=Foreclosure"
    + "&state=" + frm.state.value );
    return false;
}

function goPiranhaPage( piranhaurl , destinationurl ) {
    document.location.href = piranhaurl + escape(destinationurl);
}