function showCalendar(id)

{

	var date = showModalDialog("../editor/popup_calendar.php", "", "help: no; status: no; scroll: no;");

	if (date)

	{

		eval(id).value=date;

	}

}



function showCalendarOut(id)

{

	var date = showModalDialog("../admin/editor/popup_calendar.php", "", "help: no; status: no; scroll: no;");

	if (date)

	{

		eval(id).value=date;

	}

}

function doMark(id)

{

	st=eval('document.all.'+id);

	if(st.className=='cellcheck')

		st.className='celluncheck';

	else

		st.className='cellcheck';

}

function doOpen(file,field,show)

{

	open(file+'?return='+field+'&show='+show,'','width=350,height=350,top=0,left=0,scrollbars,status,resize');

	return false;

}

function doOpenWindow(file,width,height,top,left)

{

	if(width=="")

		width=460;

	if(height=="")

		height=460;

	if(top=="")

		top=0;

	if(left=="")

		left=0;

	open(file,'','width='+width+',height='+height+',top='+top+',left='+top+',scrollbars,status,resize');

	return false;

}



function openImage(vLink, vHeight, vWidth)

{

	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;



	if (sLink == '')

	{

		return false;

	}



	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');

	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');

	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);

	newwin = open('', '_blank', winDef);



	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');

	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', 'Dong lai', '" border=0></a>');

	newwin.document.writeln('</body>');



	if (typeof(vLink.href) != 'undefined')

	{

		return false;

	}

}

var idDIV="imgPopup";

function image_open(text,i)

{ 

	hideDIV(idDIV);

	w = 200;                     

	bgColor = "#FFFFC0";             

	border = "1px dotted #ff0000";   

	var img2=new Image();

	img2.src=text;	

	s = (border ? 'border:' + border + '; ' : '');

	t='<table border=0 title="Click to close" cellspacing=0 onclick="hideDIV(\''+idDIV+'\')" cellpadding=2 width=' + w + '' + (s ? ' style="' + s + '"' : '') + '><tr>' +

		'<td align=center>' +'<img  src='+ text +' >' +

	  '</td></tr></table>';	



	left=((parseInt(getWinX())- parseInt(img2.width))/2)+parseInt(getScrX());

	top1=((parseInt(getWinY())- parseInt(img2.height))/2)+parseInt(getScrY());

	document.getElementById(idDIV).style.left = left;

	document.getElementById(idDIV).style.top = top1;

	document.getElementById(idDIV).innerHTML= t;

	document.getElementById(idDIV).style.backgroundColor = bgColor;

	document.getElementById(idDIV).style.visibility = 'visible';

}

function hideDIV(id)

{

   document.getElementById(id).style.visibility = 'hidden';	

}

function getScrX() {

  var offset = 0;

  if(window.pageXOffset)

    offset = window.pageXOffset;

  else if(document.documentElement && document.documentElement.scrollLeft)

    offset = document.documentElement.scrollLeft;

  else if(document.body && document.body.scrollLeft)

    offset = document.body.scrollLeft;

  return offset;

}

function getScrY() {

  var offset = 0;

  if(window.pageYOffset)

    offset = window.pageYOffset;

  else if(document.documentElement && document.documentElement.scrollTop)

    offset = document.documentElement.scrollTop;

  else if(document.body && document.body.scrollTop)

    offset = document.body.scrollTop;

  return offset;

}

function getWinX() {

  var size = 0;

  if(window.innerWidth)

    size = window.innerWidth;

  else if(document.documentElement && document.documentElement.clientWidth)

    size = document.documentElement.clientWidth;

  else if(document.body && document.body.clientWidth)

    size = document.body.clientWidth;

  else size = screen.width;

  return size;

}

function getWinY() {

  var size = 0;

  if(window.innerHeight)

    size = window.innerHeight;

  else if(document.documentElement && document.documentElement.clientHeight)

    size = document.documentElement.clientHeight;

  else if(document.body && document.body.clientHeight)

    size = document.body.clientHeight;

  else size = screen.height;

  return size;

}

document.write('<div id="'+idDIV+'" style="position:absolute; visibility:hidden"></div>');



