function checkLoginStatus(result){
	 if(result==null||result==""){
        if(confirm("您未登录，现在登录？")){
              window.location.href='/toLogon.action';
           }
        return false;
      }
	  return true;
}
function openWindow(url,width,height){ 
    var x = parseInt((screen.width - width)/2);  
    var y = parseInt((screen.height - height)/2)-20; 
    var isMSIE= (navigator.appName == "Microsoft Internet Explorer");
    if (isMSIE) {           
         window.open(url, "", "width="+width+",height="+height+",left="+x+",top="+y+",status=no,directories=no,scrollbars=no,resizable=no"  ); 
     } else { 
        window.open(url, "", "top=" + y + ",left=" + x + ",scrollbars=no,dialog=no,modal=no,width=" + width + ",height=" + height + ",resizable=no" ); 
    } 
} 

function changeDisplay(div_id){
	var div_tag = document.getElementById(div_id);
	if ("none" == div_tag.style.display)
		div_tag.style.display = "";
	else
		div_tag.style.display = "none";
}

function showDiv(div_id){
	var div_tag = document.getElementById(div_id);
	div_tag.style.display = "block";
}

function hiddenDiv(div_id){
	var div_tag = document.getElementById(div_id);
	div_tag.style.display = "none";
}

function inlineDiv(div_id){
	var div_tag = document.getElementById(div_id);
	div_tag.style.display = "inline";
}

function showcateList(type){
	 
	 if($("#catelist"+type).css("display")=="none"){
		$(".category-list").css("display","none");
	    $("#catelist"+type).css("display","block");
	 }else{
		$("#catelist"+type).css("display","none");  
	 }
}
function selectCategory(cateId,type,val){
	if(type==1){
		$("#categoryId").val(cateId);
		$(".cateselected1").text(val);
	}else if(type==2){
		$("#categoryId2").val(cateId);
		$(".cateselected2").text(val);
	}
	
	$("li.selected",$("#catelist"+type)).removeClass("selected");
	$("li.cate_li_"+cateId,$("#catelist"+type)).addClass("selected");
	$(".category-list").css("display","none");
}
function validaImage(path){
   
   path=path.toUpperCase();
   
   if(path.lastIndexOf(".JPG")>0)
      return true;
   if(path.lastIndexOf(".JPEG")>0)
      return true;
   if(path.lastIndexOf(".GIF")>0)
      return true;
   if(path.lastIndexOf(".PNG")>0)
      return true;
     
   
    return false;
     
}
function share2WB(imgUrls,title){
				   
		function sharewb(s,d,e,r,l,p,t,z,c){
		   var f='http://v.t.sina.com.cn/share/share.php?appkey=3844944383',
		   u=z||d.location,
		   p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');
		   function a(){
			   if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))                   u.href=[f,p].join('');
		   };
		   if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();
		 };
		 //sharewb(screen,document,encodeURIComponent,'','','ͼƬt��|Ĭ��Ϊ��','����|Ĭ�ϵ�ǰҳ����','����t��|Ĭ�ϵ�ǰҳlocation','ҳ�����gb2312|utf-8Ĭ��gb2312');
		 sharewb(screen,document,encodeURIComponent,'','',imgUrls,title,'','utf-8');

}
function share2DB(title){
       function shareDB(title){
			 var d=document,e=encodeURIComponent,s1=window.getSelection,s2=d.getSelection,s3=d.selection,
			 s=s1?s1():s2?s2():s3?s3.createRange().text:'';
			 r='http://www.douban.com/recommend/?url='+e(d.location.href)+'&title='+title+'&sel='+e(s)+'&v=1',
			 
			 x=function(){
				 if(!window.open(r,'douban','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330'))
				      location.href=r+'&r=1';
			   };
			 if(/Firefox/.test(navigator.userAgent)){setTimeout(x,0);}else{x();}
	   }
	   shareDB(title);
	
}
