﻿function showWeather()
	{
		t = (screen.height-20)/2;
		l = (screen.width -800)/2;
		window.open("../includes/thoitiet.htm","my_new_window","scrollbars=no, resizable=no, width=800, height=340, top=" + t + ", left=" + l);
	}
	
	function showGoldPrice()
	{
		t = (screen.height +80)/2;
		l = (screen.width +200)/2;	
		window.open("../includes/giavang.htm","my_new_window","scrollbars=no, resizable=no, width=370, height=250, top=" + t + ", left=" + t);
	}
	
function showMoneyRate()
	{
		t = (screen.height +10)/2;
		l = (screen.width  -650)/2;
		window.open("../includes/tygia.htm","my_new_window","scrollbars=no, resizable=no, width=755, height=557, top=" + t + ", left=" + l);
	}
	
	function showStock()
	{		
		t = (screen.height +0)/2;
		l = (screen.width -1000)/2;		
		myWin = open("../includes/chungkhoan.htm", "displayWindow", "scrollbars=yes,width=1000,height=600,status=no,toolbar=no,menubar=no, top=" + t + ", left=" + t);
	}

	function showInfo(zonename)
	{
		t = (screen.height - 350)/2;
		l = (screen.width - 450)/2;		
		window.open("http://www.cand.com.vn/news/BigInfoP.aspx?ZURL=" + zonename,"my_new_window","scrollbars=yes, resizable=no, width=450, height=350, top=" + t + ", left=" + t);
	}
function chkFrmRegMail(obj){
	if(obj.txtMailName.value=="")
	{
		alert("Bạn chưa nhập họ tên.");
		obj.txtMailName.focus();
		return false;
	}
	if(obj.txtMailAddress.value=="")
	{
		alert("Bạn chưa nhập địa chỉ email.");
		obj.txtMailAddress.focus();
		return false;
	}
	if (obj.txtMailAddress.value.indexOf('@',0)==-1 || obj.txtMailAddress.value.indexOf('.')==-1)
	{
		alert ("Địa chỉ email nhập sai quy cách.");
		obj.txtMailAddress.focus();
		return false;
	}
	return true;
}
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 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, note, title, 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=35} 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>');
}
