jQuery(function(jQuery) {
	//droplist
	jQuery('div.droplist').each(_droplist);
	jQuery('div.droplist span').hover(function(){jQuery(this).addClass("hover")},function(){jQuery(this).removeClass("hover")});
	//droplist end
	//add hover style to open source download page.  this can combine to above, line 20
	jQuery('item_list li').hover(
	function(){jQuery(this).addClass("hover");},
	function(){jQuery(this).removeClass("hover");}
	);
});

var _droplist = function(jQueryi){
	var dl = jQuery(this);
	var hander = dl.find('span');
	var list = dl.find('ul');
	hander.hover(
		function(){jQuery(this).addClass("hover");},
		function(){jQuery(this).removeClass("hover");}
	);
	list.hide();
	list.css('z-index', '999');
	hander.click(function(){list.slideDown('fast');});
	jQuery('body').click(function(){list.hide();});
}

function showMenu(id_menu){
	var my_menu = document.getElementById(id_menu);
	if(my_menu.style.display=="none" || my_menu.style.display==""){
		my_menu.style.display="block";
	} else { 
		my_menu.style.display="none";
	}
}

function swapImage(idStatus){
	if(idStatus==0){
		document.arrow_profile.src ="themes/newstyle/images/droplist/arrow_hover.png";
	} else if(idStatus==1){
		document.arrow_profile.src ="themes/newstyle/images/droplist/arrow_select.png";
	} else if(idStatus==2){
		document.arrow_profile.src ="themes/newstyle/images/droplist/arrow.png";
	}	
}

function select_lang( value ) {
    var target =  "/news/show/1?lang=" + value;
    window.location = target;
}
function change_search(value){
	var input = document.getElementById('searchinput');
	if(!input.value || input.value == ''){
		alert('Search key can\'t empty');return;
	}
    var form = document.getElementById('searchform');
    form.action = value;
    if(value.indexOf('search.jsp')>=0){
        input.name = "srchtxt";
    }else{
        input.name = "q";
    }
    form.submit();
}
function preSearch(){
    return;
    var form = document.getElementById('searchform');
    if(form.action.indexOf('search.jsp')>=0){
        var input = document.getElementById('searchinput');
        document.getElementById('forumSearchInput').value = input;
    }
}