function sconfirm(strMess,strURL){
	var yn;
	yn=window.confirm(strMess);
	if (yn==true){
		document.location.href=strURL;
		}
}
function askconf(strMess){
	var yn;
	yn=window.confirm(strMess);
	if (yn==true){
		return true;
		}
	return false;
}

function msgBoxAlert(strMess,strURL)
{
	window.alert(strMess);
	document.location.href=strURL;
}
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}
function winopen(url){
	window.open(url);
}

function insertStr(strValue,anh){

	window.opener.document.form1[anh].value=strValue;
}

function popupImage(src, title, note, css, border) {
var ppimgNW;
  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 oncontextmenu="return false" 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('<Font face=Tahoma size=2>'+note+'</Font>');
  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;');     
  if (note=='' || note==null) {addH=26} else {addH=60};
  doc.write('  window.resizeTo(imgW + 8 +' + border*2 +', imgH + ppImgText.offsetHeight + '+addH+' + '+ border*2 +');');
  doc.write('  setTimeout("doResize()",1000);');

  doc.write('}');
  doc.write('doResize(); ');
  doc.write('</' + 'script>');
}
//kiem tra so
  function CheckNum(f) {
       if (isNaN(f.value)) {
	      alert ('Error: Ban nhap \n'+f.value+'\n Trường '+f.name+' phải là kiểu số.');
		  f.value = "";
		  f.focus();
		  return false;
	   }
	   return true;
   }
//kiem tra ngay thang
  function CheckDate(f) {
       if (f.value == "") {
	      return true;
	   }
			   ParseDay = f.value.substring(0, f.value.indexOf("-"));
			   ParseMonth = f.value.substring(f.value.indexOf("-") + 1, f.value.lastIndexOf("-"));
			   ParseYear = f.value.substring(f.value.lastIndexOf("-") + 1, f.value.length);
			   if ((ParseDay <0) || (ParseDay>31) || (ParseDay.length>2) || (ParseMonth <0)||(ParseMonth  >12) || (ParseMonth.length>2)||(ParseYear<1900)||(ParseYear>2099)||(ParseYear.length>4)||(ParseDay=="")) {
			  alert (ParseDay + '-'+ParseMonth+'-'+ParseYear+': Ngay thang khong dung dinh dang dd-mm-yyyy');
		  f.value = "";
		  f.focus();
		  return false;
	   }
	   return true;
   }

  function showDiv( strDiv ) {
	if (document.getElementById(strDiv).style.display == 'block') {
		document.getElementById(strDiv).style.display = 'none';
	} else {
		document.getElementById(strDiv).style.display = 'block';
	}
}
function validate()
{
	at=document.getElementById('txtEmail').value;
	if (at.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
	{
		alert('&#272;&#7883;a ch&#7881; email không h&#7907;p l&#7879;');
		return ;
	}
	showModalDialog('/Newsletter/InfoPage.aspx?txtEmail='+escape(document.getElementById('txtEmail').value),420,200);
}
