/*
*	Flash V1.0.0
*	2007-7-16
*	laoqiming@gmail.com
*/

function Flash(id, url, width, height) {
    this.id = !id ? "FreeSiteFlash_" + Number(Math.random() * 100).toFixed(0) : id;
    this.url = !url ? "" : url;
    this.width = !width ? 200 : width;
    this.height = !height ? 50 : height;
    this.attributes = [];
    this.attributes["quality"] = "high";
    this.attributes["wmode"] = "transparent";
    this.attributes["swliveconnect"] = true;
    this.toString = function() {
        var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + this.width + '" height="' + this.height + '">\
            <param name="movie" value="' + this.url + '" id="' + this.id + '">';
        for (var i in this.attributes) {
            html += '<param name="' + i.toString() + '" value="' + this.attributes[i] + '">';
        }
        html += '<embed name="' + this.id + '" id="' + this.id + '" src="' + this.url + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + this.width + '" height="' + this.height + '"';
        for (var i in this.attributes) {
            html += ' ' + i.toString() + '="' + this.attributes[i] + '"';
        }
        html += '></embed>\
          </object>';
        return html;
    }
    this.addAttribute = function(name, value) {
        this.attributes[name] = value;
    }
    this.getAttribute = function(name) {
        return this.attributes[name];
    }
    this.render = function(target) {
        if (!target) {
            document.write(this.toString());
        } else if (typeof target == "string") {
            if (document.getElementById(target)) {
                document.getElementById(target).innerHTML = this.toString();
            }
        } else if (typeof target == "object") {
            if (target.innerHTML) {
                target.innerHTML = this.toString();
            }
        }
    }
}

/*收缩菜单*/
function onChange(i) {
    childSort = document.getElementById("Sub" + i);
    childBtn = document.getElementById("Btn" + i);
    childBg = document.getElementById("Bg" + i);
    //子列表
    if (childSort.style.display == "none") {
        childSort.style.display = "block";
    }
    else {
        childSort.style.display = "none";
    }
    //主列表	
    if (childBtn.className == "sspan") {
        childBtn.className = "";
    }
    else {
        childBtn.className = "sspan";
    }
    //背景层	
    if (childBg.style.height == "20px") {
        childBg.style.height = "29px";
    }
    else {
        childBg.style.height = "20px";
    }
}

/*滑动门效果
*V1.0.1
*/
function nTabs(thisObj, Num) {
    if (thisObj.className == "active") return;
    var tabObj = thisObj.parentNode.id;
    var tabList = document.getElementById(tabObj).getElementsByTagName("li");
    for (i = 0; i < tabList.length; i++) {
        if (i == Num) {
            thisObj.className = "active";
            document.getElementById(tabObj + "_Content" + i).style.display = "block";
            if (i == 0) {
                CityChange(1, document.getElementById("city").value);
            }
            if (i == 1) {
                CityChange(2, document.getElementById("scenic").value);
            }
        } else {
            tabList[i].className = "normal";
            document.getElementById(tabObj + "_Content" + i).style.display = "none";
        }
    }
}

/*滑动门效果
*V1.0.1
*/
function hTabs(thisObj, Num) {
    if (thisObj.className == "hactive") return;
    var tabObj = thisObj.parentNode.id;
    var tabList = document.getElementById(tabObj).getElementsByTagName("li");
    for (i = 0; i < tabList.length; i++) {
        if (i == Num) {
            thisObj.className = "hactive";
            document.getElementById(tabObj + "_Content" + i).style.display = "block";
        } else {
            tabList[i].className = "hnormal";
            document.getElementById(tabObj + "_Content" + i).style.display = "none";
        }
    }
}
