var path = "";
function initPath()
{
	path = document.getElementById("path").value;
}
//截取时间字段
function formatDates(str)
{
 	return str.length >10 ? str.substring(0,10) : str;
}
//截取时间字段
function queryResource()
{
	var title = jsTrim(document.getElementById("resourceTitle").value);
	var type = document.getElementById("queryType").value;
	if(title == "" || title == "请输入文章标题")
	{
		getScreenByStatus("jsAddScreenInfo","info","","","","","");
    	showScreen("","ScreenInForss","promptBoxInForss",null,260,20);
	 	document.getElementById("p_content").innerHTML="请输入新闻标题关键字进行搜索！";
	}
	else
	{
		window.location.href=""+path+"/resourceResult.html?type="+type+"&title="+encodeURI(title); 
	}
}
//******************************myResource
//删除资源
function diaryDeleteMe(e,resourceId)
{
	var mouse_x;
    var mouse_y;
    if(!document.all){
		mouse_x=e.pageX;
		mouse_y=e.pageY;
	}else{
		mouse_x=document.documentElement.scrollLeft+e.clientX;
		mouse_y=document.documentElement.scrollTop+e.clientY;
	}
    var Element = document.getElementById('deleteBox');
    Element.style.left=(1*mouse_x-170)+"px";
    Element.style.top=(1*mouse_y-80)+"px";
    document.getElementById("deleteDiaryHiddenId").value = resourceId;
    Element.style.display='block';
}


//取消删除
function canlDdiaryDeleteMe()
{
    var Element = document.getElementById('deleteBox');
    Element.style.display='none';
}

//确定删除资源
function shueDiaryDeleteMe(type)
{
	var id = document.getElementById("deleteDiaryHiddenId").value;
	window.location.href=""+path+"/s/myResource.html?type="+type+"&status=del&resourceId="+id;
}
//*************************************resourceIndex
 function init(type)
 {
 	path = document.getElementById("path").value;
 	document.getElementById("queryType").value = type;
 }
 
 
 //**********************************************************resourceInfo
 //删除资源
function diaryDeleteInfo(e,resourceId)
{
	var mouse_x;
    var mouse_y;
    if(!document.all){
		mouse_x=e.pageX;
		mouse_y=e.pageY;
	}else{
		mouse_x=document.documentElement.scrollLeft+e.clientX;
		mouse_y=document.documentElement.scrollTop+e.clientY;
	}
    var Element = document.getElementById('deleteBox');
    Element.style.left=(1*mouse_x-170)+"px";
    Element.style.top=(1*mouse_y-80)+"px";
    document.getElementById("deleteDiaryHiddenId").value = resourceId;
    Element.style.display='block';
}
//取消删除
function canlDdiaryDeleteInfo()
{
    var Element = document.getElementById('deleteBox');
    Element.style.display='none';
}
//确定删除资源
function shueDiaryDeleteInfo(popedom)
{
	var id = document.getElementById("deleteDiaryHiddenId").value;
	window.location.href=""+path+"/s/myResource.html?type="+popedom+"&status=del&resourceId="+id;
}

function initInfo(message)
{
	path = document.getElementById("path").value;
	if(message == "trendResource")
	{
		getScreenByStatus("jsAddScreenInfo","info","","","","","");
    	showScreen("","ScreenInForss","promptBoxInForss",null,260,20);
	 	document.getElementById("p_content").innerHTML="资源转移成功！";
	}
}
 
 
// 锁屏
function trendResourceScreen()
{
 	document.getElementById("resourceType").value="${resource.type}";
 	showScreen('ifr','Screen','waitBox','','',15);
 	
}
//解屏
function hideAlbumScreen()
{
	hideScreen('ifr','Screen','waitBox');
}


function resourceCommend(typeValue,sessionUser,id){
	if(sessionUser != null && sessionUser != "")
	{
		XMLHttp.sendReq('post', ''+path+'/ajax/resourceAjax.html?resourceId='+id+'&operationType='+typeValue, '', checkResult);
		if(typeValue != "popedom" && typeValue != "downResource")
		{
			document.getElementById(typeValue).innerHTML="推荐中";
		}	
	}
	else
	{
		getScreenByStatus("jsAddScreenNologin","noLogin","","","","","");
		showScreen("ifrNoLogins","ScreenNoLogins","waitBoxNoLogins",'','',15);
	}
}

function checkResult(http_request){
/*是否成功请求*/
   if(http_request.responseText!="")
   {
		var results=http_request.responseXML;
		var roots=results.documentElement;
		var ajaxMessage=roots.getAttribute("ajaxMessage");
		var operationType = roots.getAttribute("operationType");
		var message = roots.getAttribute("message");
	
		if(ajaxMessage == "nosession")
		{
			showScreen("ifrNoLogins","ScreenNoLogins","waitBoxNoLogins",'','','');
		}
		document.getElementById(operationType).innerHTML = message;
		if(operationType == "downResource")
		{
			var main = document.getElementById("fileMain").value;
			var filePath = document.getElementById("filePath").value;
			window.location.href=""+main+"/"+filePath+"";
		}
		else if(operationType == "popedom")
		{
			getScreenByStatus("jsAddScreenInfo","info","","","","","");
	    	showScreen("","ScreenInForss","promptBoxInForss",null,260,20);
		 	document.getElementById("p_content").innerHTML="资源设置成功";
		}
	}
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 