// JavaScript Document

function changeItem(id,item_name,count){
    for(i=1;i<=count;i++){
	    _item_id="#"+item_name+i;
		_item="#"+item_name+"_"+i;
		if(id == i){
			$(_item_id).attr("class",item_name+"_yes");
			$(_item).show();
		}else{
			$(_item_id).attr("class",item_name+"_no");
			$(_item).hide();
		}
	}
}



function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     
} 



// JavaScript Document
function showItem(_item){
	sh=$(_item).css("display");
	if(sh == 'none'){
		$(_item).show();
	}else{
		$(_item).hide();
		}
	
}
function hideCate(){
    $("#P_Catelist").hide();
}

function showWin(item_name){
	win_x=(document.documentElement.clientWidth-500)/2;
	win_h=$("#win_con").height()+20;
	
	sss=document.body.scrollHeight;
    bbb=window.screen.width-17;
	
	$("#black_back").css("width",bbb+"px")	
	$("#black_back").css("height",sss+"px")
	$("#black_back").css("left","0px")
	$("#black_back").css("top","0px")
	$("#win_con").css("width","500px")
	$("#win_con").css("left",(win_x+10)+"px")
	$("#win_con").css("top","200px")
	$("#black_back").show();
	$("#win_con").fadeIn('slow');
	$(item_name).fadeIn('slow');
	
	
}

function showMessage(errorId){
    error=new Array();
	error[1]="您只有登录并且加入该圈子才能发表新话题，请<a href='login.php' class='link_2E68A9'>登录</a>";
	
	
	win_x=(document.documentElement.clientWidth-500)/2;
	win_h=$("#win_con").height()+20;
	
	sss=document.body.scrollHeight;
    bbb=window.screen.width-17;
	
	$("#black_back").css("width",bbb+"px")	
	$("#black_back").css("height",sss+"px")
	$("#black_back").css("left","0px")
	$("#black_back").css("top","0px")
	$("#message_box").css("width","500px")
	$("#message_box").css("left",(win_x+10)+"px")
	$("#message_box").css("top","200px")
	$("#black_back").show();
	$("#message_box").show();
	$("#messages").html(error[errorId]);

	
	
}


function show_member(item_name){
	win_x=(document.documentElement.clientWidth-330)/2;
	win_h=$("#win_con").height()+20;
	$("#black_back").css("width","330px")
	$("#black_back").css("height",win_h+"px")
	$("#black_back").css("left",win_x+"px")
	$("#black_back").css("top","100px")
	$("#win_con").css("width","330px")
	$("#win_con").css("left",(win_x+10)+"px")
	$("#win_con").css("top","150px")
	$("#black_back").show();
	$("#win_con").show()
}
function closeItem(item_name){
		$(item_name).hide();
	$("#black_back").hide();
	$("#win_con").hide();
}

function closeAllSta(){
	ss=$('#url_t2 li').length;
    for(i=0;i<ss;i++){
     res_id='#res_'+(i+1);
     salon_id='#salon_'+(i+1);
	 $(res_id).hide();
	 $(salon_id).hide();
	}
}

function showRes(id)
{
	closeAllSta();
	sss=$("#WinSta").html();
	win_id='#res_'+id;
	$(win_id).show();
	$(win_id).html(sss)
	$('.sta_msg').html('推荐成功，谢谢您的推荐！');
	window.setTimeout("closeItem('"+win_id+"')",2000)
}
function showSalon(id)
{
	closeAllSta();
	sss=$("#WinSta").html();
	win_id='#salon_'+id;
	$(win_id).show();
	$(win_id).html(sss)
	$('.sta_msg').html('恭喜，您已经成为该作品的知音读者！');
	window.setTimeout("closeItem('"+win_id+"')",2000)
	
}

function showForum(){
	$("#forum_1").show();
}
