// JavaScript Document
//搜索框点击效果
$j(function(){
	var search_text = "输入问题内容"
	var search_in = $j("#tword");
	search_in.focus(function(){
		if(search_in.attr("value") == search_text){
			search_in.attr({value:""})
			}
		$j(this).addClass("search-input-on");
		});
	search_in.focusout(function(){
		if($j(this).attr("value") == ""){
		    $j(this).removeClass("search-input-on");
			$j(this).attr("value",search_text);
			}
		});
	
	$j("#getask").click(function(){  
　　   var bus_n = $j("#tword").val();
	      if(bus_n == "")
            {
                alert("请输入内容");
                $j("#tword").focus();
                return false;
            }
		  else
	       {			
　　       get_ask($j("#tword").val())
　　    }
　　}); 
   
    $j("#postask").click(function(){ 
     var bus_n = $j("#tword").val();
	      if(bus_n == "")
            {
                alert("请输入内容");
                $j("#tword").focus();
                return false;
            }
		  else
	       {			
　　      ask($j("#tword").val())
　　    }　   
　　}); 
	
    $j("#search").click(function(){ 
            if(search_in.attr("value") == search_text){
                search_in.attr({value:""});
            }
        });
    if(search_in.attr('value') == ''){
        search_in.removeClass("search-input-on");
        search_in.val(search_text);
    }
	})

	 
//setInterval("BindLevel()",500);

//function BindLevel(){
//     $j("#ClassLevelI00038").change(function(){
  //     alert('ok');
//}); 
	 
/*
#ClassLevelI00039{ width:130px;height:165px;}
#ClassLevelI00038{ width:130px;height:165px;}
#ClassLevelI00020{ width:130px;height:165px;}
#ClassLevelI00037{ width:130px;height:165px;}
#ClassLevelI00034{ width:130px;height:165px;}
#ClassLevelI00040{ width:130px;height:165px;}
#ClassLevelI00041{ width:130px;height:165px;}
#ClassLevelI00107{ width:130px;height:165px;}
#ClassLevelI00136{ width:130px;height:165px;}
#ClassLevelI00101{ width:130px;height:165px;}
*/
//}

//切换城市
$j(function(){
	$j("#city_btn").click(
		function (){
			if($j(".othercity").is(":hidden")){
				$j("#city_btn").addClass("city-btn-on");
				$j(".othercity").css({display:"block"});
			}
			else{
				$j("#city_btn").removeClass("city-btn-on");
				$j(".othercity").css({display:"none"});
				}
		})
			
	//$j(".othercity a").attr({href:"#"});       //把所有城市的链接替换成#
	$j(".othercity a").click(function(){
		$j("#the_city").text($j(this).text());
		$j("#city_btn").removeClass("city-btn-on");
		$j(".othercity").css({display:"none"});
		});
	$j(".othercity .close").click(function(){
		$j("#city_btn").removeClass("city-btn-on");
		$j(".othercity").css({display:"none"});
		});
	})
//用户发布信息
$j(function(){
	$j("#publish_btn").hover(
		function(){
			$j(this).toggleClass("publish-btn publish-btn-on");
			}
		);
	$j("#suggest_btn").hover(
		function(){
			$j(this).toggleClass("suggest-btn suggest-btn-on");
			}
		);
	$j("#publish_btn").click(
		function(){
			window.location.href=$j(this).find("a").attr("href");
			}
		);
	$j("#suggest_btn").click(
		function(){
			window.location.href=$j(this).find("a").attr("href");
			}
		);
	})

//执行suggestion功能js
/*
$j(function(){
	$j("#search-input").jSuggest({
		url: "/suggestion/search.fcgi",
		type: "GET",
		data: "q",
		autoChange: true
	});
});

$j(function(){
    $j("#jSuggestContainer").click(
        function(){
            $j("#city_btn").removeClass("city-btn-on");
            $j(".othercity").css({display:"none"});
        }
    );
});
*/

function ShowTabs(tabTitle,tabContent,tabNo,tabCount,overTabClass,outTabClass){   
    for(i=1;i<=tabCount;i++){   
        if(document.getElementById(tabContent+i) == null)   
            continue;   
        if(i==tabNo){   
            document.getElementById(tabContent+i).style.display='block';   
            document.getElementById(tabTitle+i).className = overTabClass;   
        }   
        else{   
            document.getElementById(tabContent+i).style.display='none';   
            document.getElementById(tabTitle+i).className = outTabClass;   
        }   
    }   
}   

 function visit(href, target){
    if(navigator.appName.toLowerCase().search("microsoft") != -1){
        var bodyElem = document.getElementsByTagName("body")[0];
        var elem = document.createElement("a");
        elem.style.display = "none";
        elem.href = href;
        elem.target = target;
        bodyElem.appendChild(elem);
        elem.click();
        bodyElem.removeChild(elem);
    }else{
        if(target == undefined || target == "" || target == "_self"){
            window.location.href = href;
        }else{
            window.open(href);
        }
    }
 }
