﻿var search_action_array = ['', '', ''];
var search_array = ['ra0', 'ra1', 'ra2'];
var search_index = 1;
function switch_search(index) {
    $('c').value = index == 0 ? 5 : 1;
    $('searchForm').action = search_action_array[index];
}
function init_search() {
    switch_search(search_index);
V.addListener(search_array, 'click',
	function(e, obj) {
	    var tmp = 0;
	    for (var i = 0; i != search_array.length; i++) {
	        if (obj.id == search_array[i]) {
	            tmp = i; break;
	        }
	    }
	    switch_search(tmp);
	}
)
V.addListener('searchbutton', 'click', function(e, obj) { $('searchForm').submit(); })
$('searchForm').q.focus();
$('searchForm').q.value = PH_HOTWORDS[1];
}

function clickLoginSelect() {
if ($("loginFldselectop").style.display == "block") {
    $("loginFldselectop").style.display = "none";
} else {
    $("loginFldselectop").style.display = "block";
    selectlist();
}
}

function myclick(obj) {
$("loginUl").innerHTML = obj.innerHTML;
$("loginFldselectop").style.display = "none";
}
function selectlist() {
var liObj = $("loginFldselectop").getElementsByTagName("li");
for (var j = 0; j < liObj.length; j++) {
    liObj[j].onmouseover = function() {
    this.style.background = "#FF6101";
        this.getElementsByTagName("a")[0].style.color = "#fff";

    }
    liObj[j].onmouseout = function() {
        this.style.background = "white";
        this.getElementsByTagName("a")[0].style.color = "#FF6101";
    }
    liObj[j].onclick = function() {
        $("loginFldselectop").style.display == "none";
    }
}
}
function getHotwords() {
var PH_HOTWORDS_TRAGET = 'http://gsearch.ifeng.com/gsearch/gsearch.jsp?q=', __s = '';
for (var i = 1; i < 5; i++) { __s += '<a href="' + PH_HOTWORDS_TRAGET + encodeURIComponent(PH_HOTWORDS[i]) + '" target="_blank">' + PH_HOTWORDS[i] + '</a>&nbsp;&nbsp;'; }
return __s;
}

function clear_text() {
(document.getElementById("q").value == PH_HOTWORDS[1]) ? (document.getElementById("q").value = "") : "";
}

//---

