//收藏
function favAction(WishType,ReferID)
{
	ScreenConvert();
	DialogShow("<div id=\"DialogLoading\">正在读取,请稍候...</div>",110,24,124,24);
	if ( ReferID != null && WishType != null)
	{
		var PostData = "&ID="+ReferID+"&type="+WishType;
		PostRequest(window.location.protocol + "//" + window.location.host + "/AJAX/favorites.php", PostData);
	}
}

function WishListSave(ReferID, WishType,update)
{
	ScreenConvert();
	var objWishTags = gid("txtWishTags");
	var objoldTags = gid("txtOldTags");
	var objComments = gid("txtComments");
	var PostData = null;
	var objValidator=gid("DialogValidator");
	if ( ReferID != null && WishType != null )
	{
		if(objWishTags.value.length>=100)
		{
			objValidator.innerHTML = "<span class=\"Error\">收藏标签的字数不能大于100!</span>";}
		else if(objComments.value.length>=100)
		{
			objValidator.innerHTML = "<span class=\"Error\">备注的字数不能大于100!</span>";}
		else
		{
			
			if ( update)
			{
				PostData = "&ID=" + ReferID + "&type=" + WishType + "&tags=" + StrCode(objWishTags.value)+"&oldtags=" + StrCode(objoldTags.value) + "&comments=" + StrCode(objComments.value);
				var surl = "favorites.php?do=edit";
			}
			else
			{
				PostData = "&ID=" + ReferID + "&type=" + WishType + "&tags=" + StrCode(objWishTags.value)+"&comments=" + StrCode(objComments.value);			
				var surl = "favorites.php?do=add";
			}
			PostRequest(window.location.protocol + "//" + window.location.host + "/AJAX/"+surl,PostData);
		}
	}
}

function WishListDel(ReferID,WishType)
{
	ScreenConvert();
	DialogShow("<div id=\"DialogLoading\">正在读取,请稍候...</div>",110,24,124,24);
	if (ReferID != null && WishType != null)
	{
		var PostData = "&ID=" + ReferID + "&type=" + WishType;
		PostRequest(window.location.protocol + "//" + window.location.host + "/AJAX/favorites.php?do=del", PostData);
	}
}

function delfav(type,ID)
{	
	var AJAX_DelWishBody = "<div id=\"DialogTitle\"><div id=\"DialogTitleText\">删除收藏</div><div id=\"DialogTitleBtn\" onclick=\"return DialogHide();\" onmouseover=\"var objShut = document.getElementById(\'DialogTitleBtn\');objShut.style.border=\'solid 1px #000000\';\" onmouseout=\"var objShut = document.getElementById(\'DialogTitleBtn\');objShut.style.border=\'solid 1px #EEE\';\"></div></div><div id=\"DialogContent\">确定要删除此收藏记录吗？</div><div id=\"DialogButtons\"><button id=\"WilhListDel\" onclick=\"WishListDel('"+ID+"','"+type+"');\">删除</button>&nbsp;&nbsp;&nbsp;&nbsp;<button id=\"WishListCancle\" onclick=\"return DialogHide();\">取消</button></div>";DialogShow(AJAX_DelWishBody,250,120,300,130);
}


function noFavAuth(auth)
{
	ScreenConvert();
	var action_name = '';
	switch ( auth )
	{
		case 'add':
			action_name = '添加收藏';
			action_content = '你没有权限添加收藏';
		break;
		case 'adds':
			action_name = '添加收藏';
			action_content = '你的收藏夹已经满了,请先清理';
		break;
		case 'edit':
			action_name = '编辑收藏';
			action_content = '你没有权限编辑本收藏';
		break;
		case 'del':
			action_name = '删除收藏';
			action_content = '你没有权限删除本收藏';
		break;
	
	}
	var AJAX_noAuth = "<div id=\"DialogTitle\"><div id=\"DialogTitleText\">"+action_name+"</div><div id=\"DialogTitleBtn\" onclick=\"return DialogHide();\" onmouseover=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #000000';\" onmouseout=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #EEE';\"></div></div><div id=\"DialogContent\">"+action_content+"</div>&nbsp;&nbsp;&nbsp;&nbsp;<button id=\"AjaxMainCancle\" onclick=\"return DialogHide();\">点此取消</button></div>";
	DialogShow(AJAX_noAuth,150,120,180,110);	
}

//判断是否登录
function CheckUserLogin(Refer)
{
	//ScreenConvert();
	//DialogShow("<div id=\"DialogLoading\">正在跳转,请稍候...</div>",110,24,124,24);
	var PostData = null;
	if (Refer != null )
	{
		PostData = "do=checkuserlogin&refer=" + StrCode(Refer);

		PostRequest(window.location.protocol + "//" + window.location.host + "/AJAX/Comm.php", PostData);
	}

}
