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 dropCategory(obj){

	if(obj.className == "on"){

		obj.className = "off";

		document.frmTemp.objdrop.value = "";	

	}

	else{

		obj.className = "on";

		if(document.frmTemp.objdrop.value != ""){

			identity=document.getElementById(document.frmTemp.objdrop.value);

			identity.className = "off";

		}

		document.frmTemp.objdrop.value = obj.id;

	}

}


function dropCategory1(obj){

		obj.className = "on";

		if(document.frmTemp.objdrop.value != ""){

			identity=document.getElementById(document.frmTemp.objdrop.value);

			identity.className = "on";

		}

		document.frmTemp.objdrop.value = obj.id;

	}

function dropCategory2(obj){

		obj.className = "off";

		if(document.frmTemp.objdrop.value != ""){

			identity=document.getElementById(document.frmTemp.objdrop.value);

			identity.className = "off";

		}

		document.frmTemp.objdrop.value = obj.id;

	}

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>');

}



var __logoIndex = 0;

function displayAd(ide,lnk,img,tgt,ttl,tp,thispage,wdth,hght) {

	var flag = 0;

	var flashWidth , flashHeight;

	var html = '';

	var sImg;

	var imgLogo='';

	flashWidth = 220;

	flashHeight = 60;		



	if (wdth==null || wdth=='' || wdth=='0' || wdth==0) wdth = null;

	else flashWidth = wdth;



	if (hght==null || hght=='' || hght=='0' || hght==0) hght = null;

	else flashHeight = hght;



	if (img.match(/\.swf$/i) != null) {	// this is a Flash file

		sImg = '';		

		// tag <a href>... </a> is just for show link

		// send both [clickTAG] and [clickTag] (Case sensitive) and [link] to flash.swf for sure

		sImg += '<a href="' + lnk + '" target="_blank">'; 	

		sImg += '<object id="oFlash" swliveconnect=true width="'+ flashWidth +'" height="'+ flashHeight +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">';

		if (tp!=-1 & lnk != '') lnk = "/pcworld/adclick.asp?id=" + ide + "&thisPage=" + thispage;

		lnk = escape(lnk); 

		lnk = '?clickTAG=' + lnk + '&clickTag=' + lnk + '&link=' + lnk;

		sImg += '<param name="movie" value="'+ img + lnk + '">';

		sImg += '<param name="quality" value="high"><param name="menu" value="false">';

		sImg += '<embed name="oFlash" src="'+ img + lnk + '"  quality="high" width="' + flashWidth + '" height="' + flashHeight + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object></a>';

	} 

	else if (img.match(/\.flv$/i) != null) {	// this is a Flash video

		if (wdth == null){wdth =220;}

		if (hght == null){hght =160;}

		sImg = '';

		sImg += '<a href="' + lnk + '" target="_blank">';

		sImg += '<object width="' + wdth + '" height="' + hght + '"><param name="allowscriptaccess" value="always"/><param name="movie" value="/pcworld/flv_player.swf"/>';

		if (tp!=-1 & lnk != ''){		

			lnk = "/pcworld/adclick.asp?id=" + ide + "&thisPage=" + thispage;	

			imgLogo = "&logo=/pcworld/images/flv_nextlogo.gif";

		}

		sImg += '<param name="flashvars" value="width=' + wdth + '&height=' + hght + '&file=' + img + imgLogo + '&linkfromdisplay=true&overstretch=true&autostart=true&controlbar=none&controlbarsize=0&displayheight=' + hght + '&repeat=true&usefullscreen=false&link=' + escape(lnk) + '&linktarget=' + tgt + '"/>';

		sImg += '<embed allowscriptaccess="always" src="/pcworld/flv_player.swf" FLASHVARS="width=' + wdth + '&height=' + hght + '&file=' + img + imgLogo + '&linkfromdisplay=true&overstretch=true&autostart=true&controlbar=none&controlbarsize=0&displayheight=' + hght + '&repeat=true&usefullscreen=false&link=' + escape(lnk) + '&linktarget=' + tgt + '" type="application/x-shockwave-flash" width="' + wdth + '" height="' + hght + '"></embed></object>';

	} else {

		wdth = (wdth!=null) ? wdth = ' width="'  + wdth + '" ' : wdth = '';

		hght = (hght!=null) ? hght = ' height="' + hght + '" ' : hght = '';

		sImg = img.match(/\.(gif|jpg|png)$/i)!=null ? '<img src="' + img + '" border=0 ' + wdth + hght + '>' : '<font size=2>' + ttl + '</font>';

	}

	var reOpens = /\&\$popup[ ]*=[ ]*\[[^\]]*\]/i;

	var opens = lnk.match(reOpens);

	

	if (tp==-1){	// Khong dem hits

		if (opens != null) {

			var wfeat = opens[0].match(/\[[^\]]*\]/)[0];

			wfeat = wfeat.substring(1, wfeat.length-1);

			var wlnk = lnk.replace(reOpens, '');

			html += '<a class=8blue href="'+ (wlnk!=''?wlnk:'#') +'">'+ sImg +'< class=testlabsearch /a>';

		} 

		else 

		{

	     if (lnk!='') { 

	      if (lnk.match("window.open")!=null){

	      	//eval(lnk);

			html += '<a class=8blue href="'+ '#' +'" onclick="'+lnk +'">'+ sImg +'</a>';

		  }

	      else 

			html += '<a class=8blue href="'+ lnk +'" onclick="window.open(\''+ lnk +'\',\''+ tgt +'\');return false;">'+ sImg +'</a>';

		 }

	     else  

			html += sImg ;

	    }

	}	

	else {  // Dem hits & lay thong tin client

		if (opens != null) {

			var wfeat = opens[0].match(/\[[^\]]*\]/)[0];

			wfeat = wfeat.substring(1, wfeat.length-1);

			var wlnk = lnk.replace(reOpens, '');

			html += '<a class=8blue href="'+ (wlnk!=''?wlnk:'#') +'" onclick="window.open(\'/pcworld/adclick.asp?id='+ ide +'&thisPage='+ thispage + '\',\'_blank\',\''+ wfeat +'\');return false;">'+ sImg +'< class=testlabsearch /a>';			

		} 

		else // html += '<a class=8blue href="'+ (lnk!=''?lnk:'#') +'" onclick="window.open(\'/pcworld/adclick.asp?'+ ide +'\',\''+ tgt +'\');return false;">'+ sImg +'</a>';

		{

	     if (lnk!='') { 

	      if (lnk.match("window.open")!=null) 

			html += '<a class=8blue href="'+ '#' +'" onclick="adclickpop(\''+ide+'\',\''+thispage+'\',\''+tgt+'\',\''+lnk+'\');">'+ sImg +'</a>';

	      else 

			html += '<a class=8blue href="'+ lnk +'" onclick="window.open(\'/pcworld/adclick.asp?id='+ ide +'&thisPage='+ thispage + '\',\''+ tgt +'\');return false;">'+ sImg +'</a>';

		 }

	     else  

			html += '<a class=8blue href="'+ '#' +'" onclick="adclicknull(\''+ide+'\',\''+thispage+'\',\''+tgt+'\');">'+ sImg +'</a>';

	    }

		/*if (tp == 2) { // AD View

		    flag = 1;

			hitViewad(ide,thispage);

		}*/

	}	



	document.write(html);

	if (flag == 1)

	   document.write('<input type="hidden" id="inputViewAd">');	

}