﻿var isIE = (document.getElementById && document.all);
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="', (isIE) ? '<%=varClose%>' : '<%=varClose%>', '" border=0></a>');
	newwin.document.writeln('</body>');
	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
function isEmail(str) {
   // EMAIL address validity checker
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function search(){
	var obj = document.frmSearch;
	if (obj.txtSearch.value==''){
		alert('Vui lòng nhập Nội dung tìm kiếm');
		obj.txtSearch.focus();
		return false;
	}
	obj.submit();
}

function checksubmit(){
	var obj = document.frmSearch;
	if (obj.txtSearch.value==''){
		alert('Vui lòng nhập Nội dung tìm kiếm');
		obj.txtSearch.focus();
		return false;
	}
}