
function changeCurrentObj(parentId,childId){
			var parentObj=$('#'+parentId);
			var children=parentObj.children();
			$.each(children,function(i,n){
				var id=n.id;
				var obj=document.getElementById(id);
				obj.className='';
				if(id==childId){
					obj.className='current';
				}
			})
		}
function jQueryAjax(url,param,container){
	var _html=$('#'+container).html();
	var ctx;	 
	var _array=url.split("/");
	if(_array.length>0){
	ctx=_array[1];
	if(ctx=='a'||ctx=='ap')
		ctx='';
	}
	
	$.ajax({
		 url: url,
		 type: 'POST',
		 dataType: 'html',
		 timeout: 20000,//超时时间设定
		 data:param,//参数设置
		 beforeSend:function(){
		
		$('#'+container).html('<div id="status"><img src="'+ctx+'/images/ajaxload.gif"/>loading.....</div>');
		
		},
		 error: function(){alert('数据请求失败，请重试！');$('#'+container).html(_html)},//错误处理，隐藏进度条
		 success: function(html){
		  //加载成功处理
		  $('#'+container).html(html);
		 }
		});
}
function mCutStr(text, len){
    if(text.length < len){
        return text;
    }else{
        var pos=0;
        for(i=0;i<len;i++){
            (text.substr(i,1).charCodeAt(0) >= 160)?i++:"";
            pos++;
        }
        return text.substr(0,pos)+"..";
    }
}
function favorite(URL, title)
{
    try
    {
        window.external.addFavorite(URL, title);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(title, URL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function openPdf(form,id,ctx,type){
	if(type=="1")
		form.action=ctx+'/ff/showPDF';
	else
		form.action=ctx+'/ff/fileDownload';
	document.getElementById('objId').value=id;
	//form.objId.value=id;
	form.target='_blank';
	form.submit();
}
function downloadBYK(form,id,ctx){
	
	form.action=ctx+'/ff/bykDownload';
	document.getElementById('objId').value=id;

	form.target='_blank';
	form.submit();
}
function openMusicDialog(ctx,fileId){
	
	window.open(ctx+"/dg/openMusicDialog_"+fileId,"_blank","titlebar=0,height=40,width=170");
}
function goToCasLogin(url){
	
    var array=url.split("/");
   
    var realUrl='';
    for(var i=0;i<array.length;i++){
        if(i!=0)
    	realUrl=realUrl+"$"+array[i];
    }
    
	window.location.href="/gotoCasLogin.html?goUrl="+realUrl;
}

