﻿function keyssearch(keyType, keyTypeName, box) {
    var skystr = '';
    var html = '';
    for (var j = 0; j < keyType.length; j++) {
        skystr = keyType[j];
        html += "<a href='#' target='_blank' onclick=\"searchUrl('" + skystr + "','" + keyTypeName + "',this);\" class='black-12'>" + skystr + "</a> ";
    }
    document.getElementById(box).innerHTML = html;
}

function searchUrl(key, keyTypeName, objA) {
    var url = "";
    switch (keyTypeName) {
        case "keyNews":
            url = "/NewsSearch.aspx?q=" + encodeURIComponent(key);
            break;
        case "keyBBS":
            url = "/bbsSearch.aspx?q=" + encodeURIComponent(key);
            break;
        case "keyBlog":
            url = "/blogSearch.aspx?q=" + encodeURIComponent(key);
            break;
    }
    objA.href = url;
}

String.prototype.trim = function() {
    var reExtraSpace = /^\s*(.*?)\s+$/;
    return this.replace(reExtraSpace, "$1");
}

function isEmpty(theValue, strMsg) {
    if (theValue.trim() == "") {
        alert(strMsg + "不能为空!");
        return false;
    }
    else {
        return true;
    }
}

function searchSmth(keyWords, type) {
    var a = isEmpty(keyWords, "搜索框");
    if (a == true) {
        if (type == "news") {
            window.open("/NewsSearch.aspx?q=" + encodeURIComponent(keyWords) + "");
        }
        if (type == "bbs") {
            window.open("/bbsSearch.aspx?q=" + encodeURIComponent(keyWords) + "");
        }
        if (type == "blog") {
            window.open("/blogSearch.aspx?q=" + encodeURIComponent(keyWords) + "");
        }
    }

}
function BbsKey() {
    var key = document.getElementById('text13').value;
    searchSmth(key, "bbs");

}
function BlogKey() {
    var key = document.getElementById('text14').value;
    searchSmth(key, "blog");
}
function NewsKey() {
    var key = document.getElementById('text12').value;
    searchSmth(key, "news");
}
function nTab(old, select, num, no, name) {

    for (var i = 0; i < no; i++) { document.getElementById(name + "_" + i).style.display = "none"; }
    
    for (var i = 0; i < no; i++) { document.getElementById(name + "_nav_" + i).className = old; }
    
    document.getElementById(name + "_nav_" + num).className = select;
    document.getElementById(name + "_" + num).style.display = "block";
}

function searchTab(id, Name, no) {

    for (var i = 1; i <= no; i++) {
        document.getElementById(Name + "_" + i).style.display = "none";
    }
    for (var i = 1; i <= no; i++) {
        document.getElementById(Name + "_Tab_" + i).className = "lwss-d82";
    }
    for (var i = 1; i <= no; i++) {
        document.getElementById(Name + i).style.display = "block";
    }

    if (id == 1) {
        document.getElementById(Name + "_Tab_" + id).className = "lwss-d84";
        document.getElementById(Name + "_" + id).style.display = "block";
        document.getElementById(Name + id).style.display = "none";
    } else {
        document.getElementById(Name + "_" + id).style.display = "block";
        document.getElementById(Name + "_Tab_" + id).className = "lwss-d86";
        document.getElementById(Name + (id - 1)).style.display = "none";
        document.getElementById(Name + id).style.display = "none";
    }
}

function searchKey() {
    var Districtid = window.document.getElementById('Districtid');
    var Price = window.document.getElementById('ddlPrice');
    var ProjType = window.document.getElementById('ProjType');
    var DecoStatus = window.document.getElementById('DecoStatus');
    var Keywords = "";
    var txtKey = window.document.getElementById("txtKey");
    if (txtKey.value != "") {
        Keywords = "searchkey=" + encodeURIComponent(txtKey.value) + "";
    }
    window.open("/newhouse/search.aspx?" + Districtid.options[Districtid.selectedIndex].value + Price.options[Price.selectedIndex].value + ProjType.options[ProjType.selectedIndex].value + DecoStatus.options[DecoStatus.selectedIndex].value + Keywords + "");
}

function searchKeysh() {
    var Districtid = window.document.getElementById('shDistrictid');
    var Price = window.document.getElementById('shddlPrice');
    var BuildArea = window.document.getElementById('shBuildArea');
    var FamilyType = window.document.getElementById('shFamilyType');
    var Keywords = "";
    var txtKey = window.document.getElementById("txtKeysh");
    if (txtKey.value != "") {
        Keywords = "keywords=" + encodeURIComponent(txtKeysh.value) + "";
    }
    window.open("/house/shsearch.aspx?" + Districtid.options[Districtid.selectedIndex].value + Price.options[Price.selectedIndex].value + BuildArea.options[BuildArea.selectedIndex].value + FamilyType.options[FamilyType.selectedIndex].value + Keywords + "");
}

function searchKeyzl() {
    var Districtid = window.document.getElementById('zlDistrictid');
    var Price = window.document.getElementById('zlddlPrice');
    var ProjType = window.document.getElementById('zlProjType');
    var FamilyType = window.document.getElementById('zlFamilyType');
    var Keywords = "";
    var txtKey = window.document.getElementById("txtKeyzl");
    if (txtKey.value != "") {
        Keywords = "keywords=" + encodeURIComponent(txtKeyzl.value) + "";
    }
    window.open("/house/zlfysearch.aspx?" + Districtid.options[Districtid.selectedIndex].value + Price.options[Price.selectedIndex].value + ProjType.options[ProjType.selectedIndex].value + FamilyType.options[FamilyType.selectedIndex].value + Keywords + "");
}

function flash(url, width, height) {
    document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\"" +
            "width=\"" + width + "\" height=\"" + height + "\"><param name=\"movie\" value=\"" + url + "\" /><param name=\"quality\" value=\"high\">" +
            "<embed src=\"" + url + "\" quality=\"high\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\"" +
                "type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed></object>");

}



                      
