﻿var ppimgNW;
var isIE = (navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Windows')!= -1);
function goLanguage(tg){
	if(window.document.all)
	{
		var af=window.document.getElementById("actionForm");
		af.action="GoTo.aspx";
		af.ilang.value=tg.options[tg.selectedIndex].value;
		af.submit(); 			
	}
	else
		window.top.location.assign("GoTo.aspx?ilang=" + tg.options[tg.selectedIndex].value); 
 }
 function goLanguageLink(tg){
	if(window.document.all)
	{
		var af=window.document.getElementById("actionForm");
		af.action="GoTo.aspx";
		af.ilang.value=tg;
		af.submit(); 			
	}
	else
		window.top.location.assign("GoTo.aspx?ilang=" + tg); 
 }
function ec(str){if(encodeURIComponent)return encodeURIComponent(str); if(escape)return escape(str) }
function createRequest(){var C=null;try{C=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{C=new ActiveXObject("Microsoft.XMLHTTP")}catch(sc){C=null}}if(!C&&typeof XMLHttpRequest!="undefined"){C=new XMLHttpRequest()}return C}
function adjustHeight(contentId)
{
	if (document.getElementById(contentId))
	{
		var divContent=document.getElementById(contentId);		
		divContent.Height=window.screen.availHeight;		
	}	
}

/*
function showHideContent(contentId)
{
	if (document.getElementById(contentId))
	{
		var divContent=document.getElementById(contentId);
		if (divContent.style.display=="none")
		{
			divContent.style.display="";			
			event.srcElement.src= event.srcElement.src.replace("plus","minus");
		}
		else
		{
			divContent.style.display="none";
			event.srcElement.src= event.srcElement.src.replace("minus","plus");			
		}
	}
}
*/

/*TuấnHT sửa lỗi để FireFox chạy được, 22.Nov.2008*/
function showHideContent(imgEvent, contentId)
{
	if (document.getElementById(contentId))
	{
		var divContent=document.getElementById(contentId);
		if (divContent.style.display=="none")
		{
			divContent.style.display = "";
			imgEvent.src = imgEvent.src.replace("plus.gif", "minus.gif");
		}
		else
		{
			divContent.style.display = "none";
			imgEvent.src = imgEvent.src.replace("minus.gif", "plus.gif");
		}
	}
}

function showImage(url)
{
	showDialog('ImageView.htm?' + url.substr(url.indexOf('?') + 1), 150, 150);
}

function showDialog(url, width, height)
{
	return showWindow(url, false, true, false, false, false, false, true, true, width, height, 0, 0);
}
function showService(sname)
{
	return showWindow('Services/' + sname + '.htm' , false, true, true, false, false, false, true, true, 150, 150, 0, 0);	
}

function showLCMSImage(imgid)
{
	showWindow('ViewImageHtml.aspx?url=ViewImage.aspx?ArticleLargeId=' + imgid, false, false, true, false, false, false, true, true, 550, 550, 0, 0);
	return false;
}
function showImageViewSize(img,width,height)
{	
	
	//height = height + 10
	showWindow('ViewImageHtml.aspx?url=ViewImage.aspx?img=' + img + '&width=' + width + '&height=' + height, false, false, true, false, false, false, true, true, parseInt(width)+20,parseInt(height)+20,0 ,0 );
	return false;
}
function showFAX(faxName, parentmode)
{
	//alert(intModuleId);
	showWindow('../../ViewImageHtml.aspx?url=ViewImage.aspx?faxnameLarge=' + faxName + '&parentmode=' + parentmode, false, false, true, false, false, false, true, true, 800, 600, 0, 0);
	return false;
}
function showProductImage(imgid)
{
	showWindow('ViewImageHtml.aspx?url=ViewImage.aspx?ttproductthumbid=' + imgid, false, false, true, false, false, false, true, true, 550, 550, 0, 0);
	return false;
}

function showMKProductImage(imgid,name,id,detail)
{
	showWindow('MKViewHTMLImage.aspx?url=ViewImage.aspx?mkproductthumbid=' + imgid + '&name='+ name + '&id='+ id + '&descript=' + detail, false, false, true, false, false, false, true, true, 550, 550, 0, 0);
	return false;
}

function showpnjProductImage(imgid)
{
	showWindow('ViewImageHtml.aspx?url=ViewImage.aspx?mkproductthumbid=' + imgid, false, false, true, false, false, false, true, true, 550, 550, 0, 0);
	return false;
}

function showCategoryImage(imgid)
{
	showWindow('ViewImageHtml.aspx?url=ViewImage.aspx?categoryLargeId=' + imgid, false, false, true, false, false, false, true, true, 550, 550, 0, 0);
	return false;
}

function showEquipment(url)
{
	showWindow('ViewImageHtml.aspx?url='+url, false, false, true, false, false, false, true, true, 550, 550, 0, 0);
	return false;
}


function showWindow(vLink, vStatus, vResizeable, vScrollbars, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vWidth, vHeight, vTop, vLeft)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;
	winDef = '';
	winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('height=').concat(vHeight).concat(',');
	winDef = winDef.concat('width=').concat(vWidth).concat(',');
	if (vCentered)
	{
		winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
		winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	}
	else
	{
		winDef = winDef.concat('top=').concat(vTop).concat(',');
		winDef = winDef.concat('left=').concat(vLeft);
	}
	open(sLink, '_blank', winDef);
	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
function showSlide(imglink)
{
	showWindow(imglink.href, false, false, false, false, false, false, true, true, 700, 560, 0, 0);
	return false;	
}

document.onmouseover = fover;
document.onmouseout = fout;
document.onmousedown = fdown;
document.onmouseup = fup;
document.onclick = fclick;
var f_folderover="#0000FF";
var f_folderout="#000000";

var b_over = "#31659C";//"#4E7DC1";
//"#C1D2EE";
//var fontweight_over = "white"
var b_out = "#639ACE";
//"#D4D0C8";
var b_click = "#00BFBF";
//"#C1D2EE";
var f_over = "#F7AE10";
//"#000000";
//#963455 c
var f_out = "#FFFFFF";
//"#000000";
var f_click = "#000000";
var t_over = "1 solid #0a246a";
var t_out = "1 solid #D4D0C8";

function fclick()
{
	if (document.all)
	{
	var tg = event.srcElement;
		if (tg.xpbutton != null)
		{
			if (tg.url != null) {window.location = tg.url};
			//showModelessWaitingPage();
		}
	}

}
function fup()
{
	
	if (document.all)
	{
	var tg = event.srcElement;
		if (tg.xpbutton != null)
		{
			tg.style.background = b_over;
			tg.style.color = f_over;
			tg.style.border = "1 solid #0057AE";
			tg.hideFocus=true;
			
		}
	}

}
function fdown()
{
	if (document.all)
	{
	var tg = event.srcElement;
		if (tg.xpbutton != null)
		{
			tg.style.background = b_click;
			tg.style.color = f_click;
			tg.style.border ="1 solid #0057AE";
			tg.hideFocus=true;
		}
	}
}
function fover()
{
	if (document.all)
	{
	var tg = event.srcElement;
		if (tg.xpbutton != null)
		{
			tg.style.background = b_over;
			tg.style.color = f_over;
			tg.style.border = "1 solid black";
			tg.hideFocus=true;
		}
		if (tg.xptextbox != null)
		{
			tg.style.border = t_over;
			tg.onfocus = ffocus;
		}
		if (tg.cmsfolder != null)
		{
			tg.style.color = f_folderover;
			tg.hideFocus=true;			
		}
		if(tg.xptoolbar!=null)
		{
			tg.style.border = "2 solid #FFFFFF";
		}
	}
}

function fout()
{
	if (document.all)
	{
	var tg = event.srcElement;
		if (tg.xpbutton != null)
		{
			tg.style.background = b_out;
			tg.style.color = f_out;
			tg.style.border = "1 solid #0057AE";			
			tg.hideFocus=true;
		}
		if (tg.xptextbox != null)
		{
			if (document.activeElement != tg)	tg.style.border = t_out;
		}
		if (tg.cmsfolder != null)
		{
			tg.style.color = f_folderout;
			tg.hideFocus=true;			
		}
		if(tg.xptoolbar!=null)
		{
			tg.style.border = "0";
		}
	}
}
function ffocus()	
{
	if (document.all)
	{
	var tg = event.srcElement;

		if (tg.xptextbox != null)
		{
			tg.style.border = t_over;
			tg.onblur = flfocus;
		}
	}
}
function flfocus()
{
	if (document.all)
	{
	var tg = event.srcElement;
		if (tg.xptextbox != null)
		{
			tg.style.border = t_out;
		}
	}
}
function showWaitingPage()
{
   var width = 150;
   var height = 150;
   var left = (screen.availWidth - width)/2;
   var top = (screen.availHeight - height)/2;
   var features = 'width=' + width + ', height=' + height + ', left=' + left + ', top=' + top;
   window.open('wait.htm', null, features);
}

function showModelessWaitingPage()
{
   var features = 'dialogWidth:150px; dialogHeight:150px; center:yes; status:no; help:no';
   window.showModelessDialog('wait.htm', null, features);
   return true;
}
function popupImage(src, note, title, css, border) {
  if (border==null) border = 0;
  if (note==null) note = '';
  if (ppimgNW != null) ppimgNW.close();

  ppimgNW = window.open('','POPUPIMAGE','width=1,height=1');
  var doc = ppimgNW.document;
  doc.write('<html>');
  doc.write('<head>');

  if (title!=null) doc.write('<title>'+ title +'</title>');
  doc.write('<style> body {'+css+'} #ppImgText{'+ css +'} #ppImg{cursor:hand}</style></head>');
  doc.write('<body leftmargin="0" topmargin="' + border + '">');
  doc.write('<div align="center">');
  doc.write('<img src="' + src + '" id="ppImg" onclick="self.close();" title="Close">');
  doc.write('</div>');
  doc.write('<div style="height:1; width:' + border + '; font-size:4pt;">');
  doc.write('</div>');
  doc.write('<div id="ppImgText" align="center">');
  doc.write(note);
  doc.write('</div>');
  doc.write('</body>');
  doc.write('</html>');

  doc.write('<' + 'script>');
  doc.write('var resized = false;');
  doc.write('function doResize() {');
  doc.write('  var imgW = ppImg.width, imgH = ppImg.height;');     
  doc.write('  window.resizeTo(imgW + 8 +' + border*2 +', imgH + ppImgText.offsetHeight + 26 + '+ border*2 +');');
  doc.write('  setTimeout("doResize()",1000);');

  doc.write('}');
  doc.write('doResize(); ');
  doc.write('</' + 'script>');

}


function writeToday()
{
	var mydate=new Date();
	
	var year = mydate.getYear();
	year = (year < 1000) ? year + 1900 : year;
	var month = mydate.getMonth() + 1;
	month =	(month < 10) ? "0" + month : month;
	var day = mydate.getDate();
	day = (day < 10) ? "0" + day : day;
	var dayofweek = mydate.getDay();
	var hour = mydate.getHours()
	hour =  (hour < 10) ? "0" + hour :hour;	
	var minute=mydate.getMinutes()
	minute =  (minute < 10) ? "0" + minute : minute;
	var dayarray=new Array("Ch&#7911; Nh&#7853;t","Th&#7913; Hai","Th&#7913; Ba","Th&#7913; T&#432;","Th&#7913; N&#259;m","Th&#7913; S&#225;u","Th&#7913; B&#7843;y")
	document.write(dayarray[dayofweek]+", "+day+"/"+month+"/"+year+",&nbsp;"+hour+":"+minute+" (GMT+7)")
}
function writeTime(s)
{
	var mydate=new Date(s)
	
	var year = mydate.getYear();
	year = (year < 1000) ? year + 1900 : year;
	var month = mydate.getMonth() + 1;
	month =	(month < 10) ? "0" + month : month;
	var day = mydate.getDate();
	day = (day < 10) ? "0" + day : day;
	var dayofweek = mydate.getDay();
	var hour = mydate.getHours()
	hour =  (hour < 10) ? "0" + hour :hour;	
	var minute=mydate.getMinutes()
	minute =  (minute < 10) ? "0" + minute : minute;
	var dayarray=new Array("Ch&#7911; Nh&#7853;t","Th&#7913; Hai","Th&#7913; Ba","Th&#7913; T&#432;","Th&#7913; N&#259;m","Th&#7913; S&#225;u","Th&#7913; B&#7843;y")
	document.write(dayarray[dayofweek]+", "+day+"/"+month+"/"+year+",&nbsp;"+hour+":"+minute+" (GMT+7)")
}

function getTodayString(s)
{
	document.write('<span class="LargeTime2">');
	writeToday(s);
	document.write('</span>')
}

function getTimeString(s)
{
	document.write('<span class="LargeTime2">');
	writeTime(s);
	document.write('</span>')
}
function dntruongStartTime(vlang)
{
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
var D = today.getDate();
var M = today.getMonth() + 1;
var Y = today.getFullYear();
var period = "";

//weekdays
var weekday = new Array(7);
if(vlang=='en-US')
{
	weekday[0] = "Sunday";
	weekday[1] = "Monday";
	weekday[2] = "Tuesday";
	weekday[3] = "Wednesday";
	weekday[4] = "Thursday";
	weekday[5] = "Friday";
	weekday[6] = "Saturday";
}
else if(vlang=='vi-VN')
{
	weekday[0] = "Chủ nhật";
	weekday[1] = "Thứ hai";
	weekday[2] = "Thứ ba";
	weekday[3] = "Thứ tư";
	weekday[4] = "Thứ năm";
	weekday[5] = "Thứ sáu";
	weekday[6] = "Thứ bảy";
}

period = bhbaoGetPeriod(h);
h = bhbaoCheckHour(h);
m = bhbaoCheckTime(m);
s = bhbaoCheckTime(s);

if(vlang=='en-US')
{
	document.getElementById('spanWebTimer').innerHTML = "&nbsp;" + weekday[today.getDay()] + ", " + M +"/"+D+"/"+Y+" " + h+":"+m + " " + period;
}
else if(vlang=='vi-VN')
{
	document.getElementById('spanWebTimer').innerHTML = "&nbsp;" + weekday[today.getDay()] + ", " + D +"/"+M+"/"+Y+" " + h+":"+m + " " + period;
}
t = setTimeout("dntruongStartTime('" +vlang+ "')",1000);
}

function bhbaoCheckTime(i)
{
if (i<10) 
  {
  	i="0" + i;
  }
  return i;
}
function bhbaoCheckHour(i)
{
	if (i>12)
		{
			i = i - 12;
		}
	return i;
}
function bhbaoGetPeriod(i)
{
	if (i>12)
		return "CH";
	else return "SA";
}
/*--------------------------*/
/*--------------------------*/
/*--------------------------*/
/* module NTFNew */
var b_userclick=false;
var b_selected ="#CCCCCC";
var b_unselected="#FFFFFF";
var RECYCLE="-1";
function fullname()
{
	findselected_name();
	var txtSelectedFolder =document.getElementById("txtSelectedFolder");
	if(txtSelectedFolder != null)
	{
		txtSelectedFolder.value = document.getElementById(SELECTED_CATEGORYNAME).value;
	}
}
function findselected_name()
{
	var sCurrentID = document.getElementById(SELECTED_CATEGORY).value;
	var tg = document.getElementById(sCurrentID);

	//alert('tg: '+tg+'\ntg.name:'+tg.name+'\ntg.title:'+tg.title);

	if (tg!=null)
	{
		//TuấnHT bổ sung điều kiện, sửa lỗi cho FireFox, 04.Sep.2008
		if (tg.name != undefined) //IE
			document.getElementById(SELECTED_CATEGORYNAME).value = tg.name;
		else //FireFox
			document.getElementById(SELECTED_CATEGORYNAME).value = tg.title;
	}
}

function f_chooseFolder(tg)
{	
	try
	{
		unselect(document.getElementById(SELECTED_CATEGORY).value);
	}catch(e){}
	//update current id into parent form
	document.getElementById(SELECTED_CATEGORY).value = tg.id;
	//select new item
	var parentId= tg.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id;
	parentId = parentId.slice(2,10);
	select(tg.id,parentId);
}
function f_expandclick(tg)
{
	var targetgroup = document.getElementById("cg"+tg.id.substring(3));	
	
	toggle(targetgroup);		
	if (tg.src.indexOf("minus.gif")>0)
		tg.src="LCMSModules/NTFNews/Images/plus.gif"
	else
		tg.src="LCMSModules/NTFNews/Images/minus.gif";
}

function toggle(tgsrc)
{
	if(tgsrc.style.display=="none") 
		tgsrc.style.display=""; 
	else 
		tgsrc.style.display="none";								
}
function expand(tg)
{	
	if (tg!=null)
	{
		
		var img01 = document.getElementById("img"+tg.id.substring(2));
		if (img01!=null) img01.src="LCMSModules/NTFNews/Images/minus.gif";
		
		tg.style.display="";
		if (tg.className!=null)
		{	
			expand(document.getElementById("cg"+tg.className));		
		}		
	}	 	
}
/*
function unselect(nodeid)
{
	var citem = document.getElementById(nodeid);
	if (citem)
	{
		citem.style.background=b_unselected;	
		citem.style.border = "1 solid #F1F1F1";				
	}												
}*/
function select(nodeid,parentId)
{
	var citem = document.getElementById(nodeid);
	if (citem)
	{
		citem.style.background=b_selected;		
		citem.style.border = "1 solid #13646A";			
	}						
}
function findselected()
{	
	var sCurrentID = document.getElementById(SELECTED_CATEGORY).value;
	var tg;
	tg = document.getElementById("cg"+document.getElementById(SELECTED_CATEGORY).value);
	if (tg!=null) 
	{
		expand(tg);		
		f_chooseFolder(document.getElementById(document.getElementById(SELECTED_CATEGORY).value));											
	}	
}
function f_itemclick(tg)
{	
	b_userclick=true;
	window.document.getElementById("currentID").value = tg.id ;	
	if(window.document.getElementById(tg.id+"name")!=null)
	{	window.document.getElementById("txtCategoryName").value = window.document.getElementById(tg.id+"name").innerHTML;	}
	
	select_item(tg.id);
		
	if(window.document.getElementById("selectCategory"))
	{
		var selectItem = window.document.getElementById("selectCategory");
		var idx;
		for(idx=0; idx<selectItem.length; idx++)
		{
			if(selectItem.options[idx].value==tg.id)
			{
				selectItem.options[idx].selected=true;
				break;
			}
		}
	}
	
	b_userclick=false;
	
}

function unselect(nodeid)
{
	var citem = window.document.getElementById(nodeid);
	if (citem)
	{
		citem.style.background=b_unselected;	
		citem.style.border = "1 solid #FFFFFF";				
	}												
}
function select_item(nodeid)
{		
		var citem = window.document.getElementById(nodeid);
				
		if (citem)
		{
			if(window.document.all)
			{
				if(window.document.getElementById("tdLeft") && window.document.getElementById("tdLeft").style.display!="")
				{
					window.document.getElementById("tdLeft").width="30%";
					window.document.getElementById("tdRight").width="70%";
					window.document.getElementById("tdLeft").style.display="";
				}
				citem.focus();
			}
			citem.style.background=b_selected;		
			citem.style.border = "1 solid #13646A";		
			setCookie("currentID",nodeid);			
					
			if(nodeid==RECYCLE)
			{							
				window.document.getElementById("iShow").src = "LCMSModules/NTFNews/RecycleBin.aspx";			
			}
			else
			{			
				window.document.getElementById("iShow").src = "LCMSModules/NTFNews/ListContent.aspx?categoryId=" + nodeid;						
			}
		}
}

function getCookie (sCookieName)
{
    var sName=sCookieName+"=", ichSt, ichEnd;
    var sCookie=document.cookie;

    if ( sCookie.length && ( -1 != (ichSt = sCookie.indexOf(sName)) ) )
    {
        if (-1 == ( ichEnd = sCookie.indexOf(";",ichSt+sName.length) ) )
            ichEnd = sCookie.length;
        return unescape(sCookie.substring(ichSt+sName.length,ichEnd));
    }
    
    return null;
}
   
function setCookie (sName, vValue)
{
	var argv = setCookie.arguments, argc = setCookie.arguments.length;
    var sExpDate = (argc > 2) ? "; expires="+argv[2].toGMTString() : "";
    var sPath = (argc > 3) ? "; path="+argv[3] : "";
    var sDomain = (argc > 4) ? "; domain="+argv[4] : "";
    var sSecure = (argc > 5) && argv[5] ? "; secure" : "";
    document.cookie = sName + "=" + escape(vValue,0) + sExpDate + sPath + sDomain + sSecure + ";";
}

function showWindow(vLink, vStatus, vResizeable, vScrollbars, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vWidth, vHeight, vTop, vLeft)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;
	winDef = '';
	winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('height=').concat(vHeight).concat(',');
	winDef = winDef.concat('width=').concat(vWidth).concat(',');
	if (vCentered)
	{
		winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
		winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	}
	else
	{
		winDef = winDef.concat('top=').concat(vTop).concat(',');
		winDef = winDef.concat('left=').concat(vLeft);
	}
	open(sLink, '_blank', winDef);
	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}

function doShowEditWindow(vUrl)
{	
	showWindow(vUrl, true, true, true, false, false, false, true, true, 750, 550, 0, 0);			
	
}

function OnSearch(e)
{	
	window.document.getElementById("navForm").action="BasicSearch.aspx";
	window.document.getElementById("navForm").submit();
	return true;				
}

function OnASearch(e)
{	
	window.document.getElementById("navForm").action="AdvancedSearch.aspx";
	window.document.getElementById("navForm").submit();
	return true;				
}
function OnFollowupSearch(e)
{	
	window.document.getElementById("navForm").action="FollowUpWork.aspx";
	window.document.getElementById("navForm").submit();
	return true;				
}

function OnAddCategory(e)
{	
	if (document.getElementById("currentID").value>=0)
	{			
		/*window.document.getElementById("navForm").action="LcmsModules/NTFNews/EditCategory.aspx?pcategoryId=" + document.getElementById("currentID").value;
		window.document.getElementById("navForm").submit();*/
		window.document.getElementById("iShow").src = "LcmsModules/NTFNews/EditCategory.aspx?pcategoryId=" + document.getElementById("currentID").value;
		return true;			
	}
	return false;
}

function OnUpdateCategory(e)
{
	if (document.getElementById("currentID").value>0)
	{
		/*window.document.getElementById("navForm").action= "LcmsModules/NTFNews/EditCategory.aspx?categoryId=" + document.getElementById("currentID").value;	
		window.document.getElementById("navForm").submit();*/
		window.document.getElementById("iShow").src = "LcmsModules/NTFNews/EditCategory.aspx?categoryId=" + document.getElementById("currentID").value;
		return true;
	}
	return false;
}

function OnDeleteCategory(e)
{
	if (document.getElementById("currentID").value>0)
	{
		if (confirmDelete())
		{		
			/*window.document.getElementById("navForm").action= "LcmsModules/NTFNews/DeleteCategory.aspx?categoryId=" + document.getElementById("currentID").value;
			window.document.getElementById("navForm").submit();
			*/
			window.document.getElementById("iShow").src = "LcmsModules/NTFNews/DeleteCategory.aspx?categoryId=" + document.getElementById("currentID").value;
			return true;
		}
	}
	return false;
}

function OnMoveCategory(e)
{
	/*var vUrl = "LcmsModules/NTFNews/MoveCategory.aspx?categoryId=" + document.getElementById("currentID").value;
	doShowEditWindow(vUrl);
	return true;
	*/
	if (document.getElementById("currentID").value>0)
	{
		/*window.document.getElementById("navForm").action= "LcmsModules/NTFNews/EditCategory.aspx?categoryId=" + document.getElementById("currentID").value;	
		window.document.getElementById("navForm").submit();*/
		window.document.getElementById("iShow").src = "LcmsModules/NTFNews/MoveCategory.aspx?categoryId=" + document.getElementById("currentID").value;
		return true;
	}
	return false;
}

/*function OnSetSecurity(e, r)
{
	if (document.getElementById("currentID").value>=0)
	{
		window.document.getElementById("navForm").action = "SecurityCategory.aspx?categoryId=" + document.getElementById("currentID").value + "&r=" + r;	
		window.document.getElementById("navForm").submit();
		return true;
	}
	return false;
}
*/
function OnAddNewFile(e)
{
	var vUrl = "EditContent.File.aspx?categoryId=" + document.getElementById("currentID").value;
	doShowEditWindow(vUrl);
	return true;
}
function OnAddNewBook(e)
{
	var vUrl = "EditContent.HardCopy.aspx?categoryId=" + document.getElementById("currentID").value;
	doShowEditWindow(vUrl);
	return true;
}
function OnAddNewContent(e)
{
	var vUrl ="LcmsModules/NTFNews/EditContent.Html.aspx?categoryId=" + document.getElementById("currentID").value;
	doShowEditWindow(vUrl);
	return true;
}
function OnSetSecurity(e, r)
{
	if (document.getElementById("currentID").value>=0)
	{
		window.document.getElementById("iShow").src ="LcmsModules/NTFNews/SecurityCategory.aspx?categoryId=" + document.getElementById("currentID").value + "&r=" + r;
		return true;
	}
	return false;
}
function OnOpenLog(e)
{
	var vUrl ="FootPrintOnDocument.aspx";
	doShowEditWindow(vUrl);
	return true;
}
/* danh cho cay ICD cua Viet Care trong module VietCare_Ho so*/
function f_VietCare_expandclick(tg)
{
	var targetgroup = document.getElementById("cg"+tg.id.substring(3));	
	
	toggle(targetgroup);		
	if (tg.src.indexOf("minus.gif")>0)
		tg.src="Images/VietCare_plus.gif"
	else
		tg.src="Images/VietCare_minus.gif";
}
function ReloadAllWindows()
{
	alert('fhhdh');
	
}
/* NTFNews_ListContent View Sort*/

function doSortBy(tg)
{
	//document.getElementById("navForm_sortBy").value = tg.selectedIndex;
	//document.getElementById("navForm").submit();
	//window.document.getElementById("iShow").src = "LCMSModules/NTFNews/ListContent.aspx?categoryId=" + document.getElementById("currentID").value;
}

//Ham xu ly, chi cho phep go vao nhung ky tu minh muon
//TuấnHT copy 30.Sep.2008
function keyRestrict(e, validchars)
{
	var key='', keychar='';
	key = getKeyCode(e);
	if (key == null) return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	validchars = validchars.toLowerCase();
	if (validchars.indexOf(keychar) != -1)
	return true;
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
	return true;
	return false;
}
function getKeyCode(e)
{
	if (window.event)
		return window.event.keyCode;
	else if (e)
		return e.which;
	else
		return null;
}
//END:: Ham xu ly
//Chi cho phep go vao nhung ky tu minh muon
