function openpage(pageurl, pagename, pagewidth, pageheight) 
{                                          
	var attr;                                          
	attr="width="+pagewidth+",height="+pageheight+",scrollbars=yes,status=no,title=yes,toolbars=yes,resizable=no";
	window.open(pageurl, pagename, attr);                                          
}

function popup(pageurl, pagewidth, pageheight) 
{                                          
	var attr;                                          
	attr="width="+pagewidth+",height="+pageheight+",scrollbars=yes,status=no,title=yes,toolbars=yes,resizable=no";
	window.open(pageurl, 'canhcam', attr);                                          
}

function FloatTopDiv()
{
	startX = document.body.clientWidth - 100, startY = 0;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	if (document.body.clientWidth < 980) startX = -1003;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x + "px";this.style.top=y + "px";};
		el.x = startX;
		el.y = startY;
		return el;
	}
	window.stayTopLeft=function()
	{
		if (document.body.clientWidth < 980)
		{
			ftlObj.x = - 100;ftlObj.y = 0;	ftlObj.sP(ftlObj.x, ftlObj.y);
		}		
		else
		{
		if (document.documentElement && document.documentElement.scrollTop)
			var pY = ns ? pageYOffset : document.documentElement.scrollTop;
		else if (document.body)
			var pY = ns ? pageYOffset : document.body.scrollTop;
		if (document.body.scrollTop > 32){startY = 3} else {startY = 0};
		if (document.body.clientWidth >= 1002)
		{
			ftlObj.x = document.body.clientWidth /2 + 411;ftlObj.y += (pY + startY - ftlObj.y)/32;ftlObj.sP(ftlObj.x, ftlObj.y);
		}
		else
		{	
		ftlObj.x  = startX;
		ftlObj.y += (pY + startY - ftlObj.y)/32;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		}
		}
		setTimeout("stayTopLeft()", 1);
	}
	ftlObj = ml("divAdRight");
	stayTopLeft();
}
function FloatTopDiv2()
{
	startX2 = document.body.clientWidth - 995, startY2 = 0;
	var ns2 = (navigator.appName.indexOf("Netscape") != -1);
	var d2 = document;
	if (document.body.clientWidth < 980) startX2 = -100;
	function ml2(id)
	{
		var el2=d2.getElementById?d2.getElementById(id):d2.all?d2.all[id]:d2.layers[id];
		if(d2.layers)el2.style=el2;
		el2.sP=function(x,y){this.style.left=x + "px";this.style.top=y + "px";};
		el2.x = startX2;
		el2.y = startY2;
		return el2;
	}
	window.stayTopLeft2=function()
	{
		if (document.body.clientWidth < 980)
		{
			ftlObj2.x = - 100;ftlObj2.y = 0;	ftlObj2.sP(ftlObj2.x, ftlObj2.y);
		}
		else
		{
		if (document.documentElement && document.documentElement.scrollTop)
			var pY2 = ns2 ? pageYOffset : document.documentElement.scrollTop;
		else if (document.body)
			var pY2 = ns2 ? pageYOffset : document.body.scrollTop;
		if (document.body.scrollTop > 32){startY2 = 3} else {startY2 = 0};
		if (document.body.clientWidth >= 1002)
		{
			ftlObj2.x =  document.body.clientWidth /2 - 411 - 150;ftlObj2.y += (pY2 + startY2 - ftlObj2.y)/32;	ftlObj2.sP(ftlObj2.x, ftlObj2.y);
		}
		else
		{				
		ftlObj2.x  = startX2;
		ftlObj2.y += (pY2 + startY2 - ftlObj2.y)/32;
		ftlObj2.sP(ftlObj2.x, ftlObj2.y);
		}
		}
		setTimeout("stayTopLeft2()", 1);
	}
	ftlObj2 = ml2("divAdLeft");
	stayTopLeft2();	
}
function ShowAdDivLeft()
{
	var objAdDivLeft  = document.getElementById("divAdLeft");
	if (document.body.clientWidth < 980)
	{
		objAdDivLeft.style.left  = - 100 + "px";
	}
	else
	{
		objAdDivLeft.style.left  = 0 + "px";
	}
	FloatTopDiv2();
}
function ShowAdDivRight()
{
	var objAdDivRight = document.getElementById("divAdRight");
	if (document.body.clientWidth < 980)
	{
		objAdDivRight.style.left = 980 + "px";
	}
	else
	{
		objAdDivRight.style.left = (document.body.clientWidth - 100) + "px";
	}
	FloatTopDiv();
}

function popupImageCC(src, note, title, css, border) 
{
	var ppimgNW;
    if (border==null) border = 0;
    if (ppimgNW != null) ppimgNW.close();
    ppimgNW = window.open('','_blank','width=50,height=50');
    var doc = ppimgNW.document;
    doc.write('<html>');
    doc.write('<head>');
    doc.write('<title>Image</title>');
	doc.write('</head>');
    doc.write('<body leftmargin="0" topmargin="' + border + '">');
    doc.write('<div align="center">');
	doc.write('<img src="' + src + '" id="ppImg" onclick="self.close();" title="?óng l?i" onload="scaleimage(this)">');
    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('</div>');
    doc.write('</body>');
    doc.write('</html>');
    doc.write('<' + 'script>');
    doc.write('function scaleimage(imgid)');
    doc.write('{');
    doc.write('     var w=imgid.width;');
    doc.write('    var h=imgid.height;');
    doc.write('   if(w>900)');
    doc.write('   {');
    doc.write('              imgid.style.width=900 + "px"; ');               
    doc.write('              imgid.style.height=parseInt(h*900/w) + "px";');
    doc.write('              w=imgid.width;');
    doc.write('              h=imgid.height;');                
    doc.write('     }');
    doc.write('   if(h>700)');
    doc.write('   {');
    doc.write('              imgid.style.width=parseInt(w*700/h) + "px";');
    doc.write('              imgid.style.height=700 + "px";');
    doc.write('    }');
    doc.write(' }');
    doc.write('function doResize() {');
    doc.write('  var imgW = ppImg.width, imgH = ppImg.height;');     
    doc.write('  window.resizeTo(imgW + 8 +' + border*2 +', imgH + ppImgText.offsetHeight + 26 + '+ border*2 +');');
    doc.write('  setTimeout(\'doResize()\', 1000);');
    doc.write('}');
    doc.write('doResize(); ');
    doc.write('</' + 'script>');
}
//function scaleimage(imgid)
//{
//    var w=imgid.width;
//    var h=imgid.height;
//    var tlw=w/600;
//    var tlh=h/600;
//    if((tlw>1) || (tlh>1))
//    {
//        if(tlw>1)
//        {
//            if (tlw>tlh)
//            {
//                imgid.width=600;                
//            }
//            else
//            {
//                imgid.width=parseInt(w/tlh);
//                imgid.height=600;
//            }
//        }
//        else
//        {
//            imgid.height=600;
//        }
//    }
//}
/*thu hinh*/
//    doc.write('   var tlw=w/900;');
//    doc.write('   var tlh=h/700;');
//    doc.write('   if((tlw>1) || (tlh>1))');
//    doc.write('   {');
//    doc.write('       if(tlw>1)');
//    doc.write('       {');
//    doc.write('          if (tlw>tlh)');
//    doc.write('          {');
//    doc.write('              imgid.style.width=700 + "px"; ');               
//    doc.write('          }');
//    doc.write('          else');
//    doc.write('          {');
//    doc.write('              imgid.style.width=parseInt(w/tlh) + "px";');
//    doc.write('              imgid.style.height=700 + "px";');
//    doc.write('          }');
//    doc.write('      }');
//    doc.write('      else');
//    doc.write('      {');
//    doc.write('          imgid.style.height=700 + "px";');
//    doc.write('     }');



