﻿function showImageWidth(ImgD,iwidth,iheight){if(ImgD.width>iwidth){ImgD.width=iwidth;}if(ImgD.height>iheight){ImgD.height=iheight;}}function ClearValue(obj){obj.html('&nbsp;');}function focuslogin(value,obj){if(value==obj.value){obj.value="";}}
function checklogin(){if($('#Aimoo_username')[0].value==""){return false;}if($('#Aimoo_username')[0].value=="username"){return false;}if($('#Aimoo_password')[0].value=="password"){return false;}if($('#Aimoo_password')[0].value==""){return false;}$('#Login_to_Aimoo').submit();}
function submitedit(btnobj,btnmname){document.getElementById("btn"+btnmname).disabled=true;}
function submitdelete(id){if (confirm("Are you sure you want to delete this category？"))location="/blog/CategorySave.cfm?Action=Delete&CategoryID="+id;}
function ClearValue(obj){obj.html('&nbsp;');}function focuslogin(value,obj){if(value==obj.value){obj.value="";}}
function changecerfication()
 {
	 var param=new Date().getSeconds();
	 var verficationdiv= document.getElementById("chengeverfication");
	 verficationdiv.src="/community/community_create/randimg.cfm?rand="+param;
 }
 
 
function PostCommentsValue()
{
	var ispost = true;
	if($('#ReplyContent')[0].value=='')
	{
		$('#CommentsTip').html($('#CommentsTipStrings')[0].value);
		var ispost = false;
		return false;
	}
	if($('#verifycode')[0].value=='' || $('#verifycode')[0].value.length !=4)
	{
		$('#CommentsTip').html($('#CommentsVerifyStrings')[0].value);
		var ispost = false;
		return false;
	}
	$('#PostingArea').show();
	$('#PostArea').hide();
	
	var option = {
		url:"/Blog/BlogCommentSave.cfm",
		ContentType:"text/xml;utf-8",
		success:function(html){
			if(html=="0"){$('#CommentsTip').html($('#CommentsVerifyStrings')[0].value);$('#PostingArea').hide();$('#PostArea').show();}
			else{window.location=$('#BlogUrl')[0].value;}
		},
		error:function(html){$('#CommentsTip').html($('#CommentsPostErrorStrings')[0].value);$('#PostArea').show();$('#PostingArea').hide();}
	}
	
	
	$.ajax({
		url:'/Blog/BlogCommentSave.cfm',
		type:'get',
		data:{
		CheckCode:1,
		UrlCode:$('#verifycode')[0].value
		},
		ContentType:"text/xml;utf-8",
		success:function(html){
			if(html=="0"){$('#CommentsTip').html($('#CommentsVerifyStrings')[0].value);$('#PostingArea').hide();$('#PostArea').show();return false;}
			else{$("#fComment").ajaxSubmit(option);}
		}
	});
	return false;
	
}

function submitblogsave()
{
	var TempContent=window.frames['scontent'].getContent();
	$('#BlogContent')[0].value = TempContent;
	var title = $('#Title')[0].value;
	if (title == ""){
		$('#CommentsTip').html($('#titleStrings')[0].value);
		return false;
	}
	if (TempContent == ""){
		$('#CommentsTip').html($('#contentStrings')[0].value);
		return false;
	}
	$('#createbtn')[0].disabled = true;
	return true;
}
function AddFriend(strAction,strNickName)
{
	$.ajax({
		url:'/friends_Manager/Ajax.cfm',
		type:'get',
		data:{
		Action:strAction,
		NickName:strNickName
		},
		success:function(html){
			if($.trim(html) == "1") {
				$('#Friends_'+strNickName).hide();
				alert("Your friend request has been sent successfully, please wait for approval!");
			}
		}
		//error:function(respon){boxAlpha();$('#CommentsAjax').html(respon.responseText);}
	});
}