function showProvinceList(country,province){
		 	$.ajax({
    		   type: "POST",
    		   url: "/util/provinceList",
    		   data: "country.countryId="+$("#"+country).val(),
    		   async: false,
    		   dataType: "json",
    		   success: function(msg){
    		    $("#"+province).html("");
    		   	for(var i= 0; i <msg.provinceList.length; i ++){
    		   		$("#"+province).append("<option value="+msg.provinceList[i].provinceId+">"+msg.provinceList[i].provinceName+"</option>");
    		   		
    		   	}
    		     
    		   }  
            });
}
function showCityList(province,city){
		 	$.ajax({
    		   type: "POST",
    		   url: "/util/cityList",
    		   data: "province.provinceId="+$("#"+province).val(),
    		   async: false,
    		   dataType: "json",
    		   success: function(msg){
    		    $("#"+city).html("");
    		   	for(var i= 0; i <msg.cityList.length; i ++){
    		   		$("#"+city).append("<option value="+msg.cityList[i].cityId+">"+msg.cityList[i].cityName+"</option>");
    		   		
    		   	}
    		     
    		   }  
            });
}
function showConstellation(birthday,constellation){

		 	$.ajax({
    		   type: "POST",
    		   url: "/util/constellation",
    		   data: "userInfo.userBirthday="+birthday.value,
    		   async: false,
    		   dataType: "json",
    		   success: function(msg){
    		   
    		       $("#"+constellation).html(msg);
    		   
    		     
    		   }  
            });
}
//check password
//CharMode函数 
//测试某个字符是属于哪一类. 
function CharMode(iN){ 
	if (iN>=48 && iN <=57) //数字 
		return 1; 
	if (iN>=65 && iN <=90) //大写字母 
		return 2; 
	if (iN>=97 && iN <=122) //小写 
		return 4; 
	else 
		return 8; //特殊字符 
} 
//bitTotal函数 
//计算出当前密码当中一共有多少种模式 
function bitTotal(num){ 
	modes=0; 
	for (i=0;i<4;i++){ 
		if (num & 1) modes++; 
		num>>>=1; 
	} 
	return modes; 
} 
//checkStrong函数 
//返回密码的强度级别 
function checkStrong(sPW){ 
	if (sPW.length<=4) 
	return 0; //密码太短 
	Modes=0; 
	for (i=0;i<sPW.length;i++){ 
		//测试每一个字符的类别并统计一共有多少种模式. 
		Modes|=CharMode(sPW.charCodeAt(i)); 
	} 
	return bitTotal(Modes); 
} 
//pwStrength函数 
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色 
function pwStrength(pwd){ 
	O_color="#eeeeee"; 
	L_color="#FF0000"; 
	M_color="#FF9900"; 
	H_color="#33CC00"; 
	if (pwd==null||pwd==''){ 
		Lcolor=Mcolor=Hcolor=O_color; 
	} 
	else{ 
		S_level=checkStrong(pwd); 
		switch(S_level) { 
			case 0: 
				Lcolor=Mcolor=Hcolor=O_color; 
			case 1: 
				Lcolor=L_color; 
				Mcolor=Hcolor=O_color; 
				break; 
			case 2: 
				Lcolor=Mcolor=M_color; 
				Hcolor=O_color; 
				break; 
			default: 
				Lcolor=Mcolor=Hcolor=H_color; 
		} 
		
	} 
	
	document.getElementById("strength_L").style.background=Lcolor; 
	document.getElementById("strength_M").style.background=Mcolor; 
	document.getElementById("strength_H").style.background=Hcolor; 
	return; 
} 

//id：推薦對象的ID ，  type：推薦類型（blog，   photo,  survey,  collection, vs,      assn_news,  assn_survey,  assn_photo,  assn_video）
//id：推薦對象的ID ，  type：推薦類型（個人博客，個人照片, 個人投票, 個人訂閱,     個人對決, 社團資訊,     社團投票,      社團圖片        社團視頻）
function recommend(id, type, userId){
	if($.browser.msie) { 
		mybox = $.weeboxs.open('/util/recommend?id='+id+'&type='+type+'&userId='+userId, { contentType: 'ajax', title: '推薦給社友', width: 390, type: 'dialog', showButton: false });
	}else{
	    mybox = $.weeboxs.open('/util/recommend?id='+id+'&type='+type+'&userId='+userId, { contentType: 'ajax', title: '推薦給社友', width: 410, type: 'dialog', showButton: false });
	}
	 <!--mybox = $.weeboxs.open('/util/recommend?id='+id+'&type='+type+'&userId='+userId, { contentType: 'ajax', title: '推薦給社友', width: 400, type: 'dialog', showButton: false });-->
}

//id：舉報內容id， type:舉報類型, title：標題， userId:被舉報人 userName:被舉報人名稱
function warnReport(id, type,title, userId, userName){
	if(!confirm("您確定要舉報此內容嗎？")){
		return;
	}
    var filters = "id=" + id+
                  "&type="+type+
                  "&title="+title+
                  "&userId="+userId+
                  "&userName="+userName;
	$.ajax({
    		   type: "POST",
    		   url: "/util/warnReport",
    		   data: filters,
    		   async: false,
    		   dataType: "json",
    		   success: function(msg){
    		   	  if(msg == "success"){
    		   	  	alert("舉報成功！");
    		   	  }else if(msg == "failed"){
    		   	  	alert("舉報失敗！此功能正在升級中！");
    		   	  }else if(msg == "hasWarnReport"){
    		   	    alert("您已經對此內容進行了舉報。");
    		   	  }
    		     
    		   }  
            });  
	
}
/*訂閱公共方法，type（blog 為博客 ，information 為資訊 ,photo 為個人圖片 ，assPhoto 為社區圖片 ，assFilm為社區視頻 ，share 為社區共享）*/
function collection( collectionId , entityId, type , userId){
	var url = '/collection/executeCollection?entityId='+entityId+'&resultMessage='+type+"&userInfo.userId="+userId;
	if(collectionId!=null){
		url+="&userCollection.collectionId="+collectionId;
	}
	if($.browser.msie) { 
		mybox = $.weeboxs.open(url, { contentType: 'ajax', title: '訂閱', width: 390, type: 'dialog', showButton: false });
	}else{
	    mybox = $.weeboxs.open(url, { contentType: 'ajax', title: '訂閱', width: 410, type: 'dialog', showButton: false });
	}
	
}
//區域事件處理
function doGetAreaChild(parent){
        if(parent.value=='-1') { jQuery(parent).nextAll().remove(); return ;}//如果為‘【請選擇】則不加載它的子孫~’
        var data = "area.areaParentId="+parent.value;
        
        jQuery.ajax({
    		   type: "POST",
    		   url: "/util/loadAreaListByParent",
    		   data: data,
    		   async: false,
    		   dataType: "json",
    		   success: function(msg){
                  jQuery(parent).nextAll().remove();
                 
                  if(msg.areaList!=null && msg.areaList.length!=0){
                   var slt = "<select onchange='doGetAreaChild(this)'>";
                   slt+='<option value=\'-1\' selected>【請選擇】</option>';
                   for(var i = 0; i < msg.areaList.length ; i++){
    		   	      var area = msg.areaList[i];
    		   	      var opt = "<option value='"+area.areaId+"'>"+area.areaName+"</option>";
    		   	      slt+=opt;
    		   	    }
    		   	    slt+="</select>";
    		   	    jQuery(parent).parent().append(slt);
                  }
    		   }  
      });  
}

//寫短信息
function smsWrite(userId){
	if($.browser.msie) { 
		if($.browser.version == "7.0"){			
			mybox = $.weeboxs.open('/user/writeSms?userSms.smsReceiveUser='+userId, { contentType: 'ajax', title: '寫短信息', width: 392, type: 'dialog', showButton: false });
		}else{
		mybox = $.weeboxs.open('/user/writeSms?userSms.smsReceiveUser='+userId, { contentType: 'ajax', title: '寫短信息', width: 390, type: 'dialog', showButton: false });
		}
	}else{
	    mybox = $.weeboxs.open('/user/writeSms?userSms.smsReceiveUser='+userId, { contentType: 'ajax', title: '寫短信息', width: 410, type: 'dialog', showButton: false });
	}
	 <!--mybox = $.weeboxs.open('/user/writeSms?userSms.smsReceiveUser='+userId, { contentType: 'ajax', title: '寫短信息', width: 400, type: 'dialog', showButton: false });-->
}
