/*Copyright by Nguyen Duc Minh*/;
function mCopyright()
{
	if(top.location!=window.location)top.location=window.location
	if((''+window.location).toLowerCase().indexOf('cache')>5)
	{
		window.status='Developed by Nguyen Duc Minh and mCMS group - http://www.onip.vn/';
		document.getElementById('mCMS').style.display='block'
	}
	else
		{
			var mc=0;
			mS = function()
			{
				mc=mc+1;
				if(mc>=18)
				{
				    window.status='Developed by Nguyen Duc Minh and mCMS group - http://www.onip.vn/';
    				if(mc==20){window.status='';mc=0;}
				}
				window.setTimeout('mS()',1000);
			}
			mS();
		}
}
function mRunAdv(v,d,a,s,w,h)
{
	var A=a.split('|')
	a=A.length;
	var c=0;
	d=document.getElementById(d);
	C=function()
	{
		var B=A[c++].split(',');
		if(c==a)c=0;
		if(v==8)
		{
			if(B[2]==1) d.innerHTML = "<a target='mAdv' href='/vi/quangcao/" + B[0] + "/'><img src='/mfiles/quangcao/" + B[1] + "' width='"+w+"' height='"+h+"' class='"+s+"'></a>";
			else d.innerHTML = "<embed src='/mfiles/quangcao/"+B[1] + "' quality='high' width='"+w+"' height='"+h+"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed>";
        }
		else
        {
			if(B[2]==1) d.innerHTML = "<a target='mAdv' href='/en/adv/" + B[0] + "/'><img src='/mfiles/adv/" + B[1] + "' width='"+w+"' height='"+h+"' class='"+s+"'></a>";
			else d.innerHTML = "<embed src='/mfiles/adv/"+B[1] + "' quality='high' width='"+w+"' height='"+h+"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed>";
		}
		setTimeout("C()",B[3]);
	}
	C();
}
function mAdvExt()
{
	var mL=document.getElementById('mAdvExtL');
	var mR=document.getElementById('mAdvExtR');
	var mT=document.getElementById('mAdvTop');
	var m1=0;var m2=0;var m3=0;var m4=0;var m5=0;
	mM = function()
	{
		if(m4-m3>1)
		{
			m4=m4-Math.min(Math.pow(2,Math.min(Math.round((m4-m3)/50),8)),m4-m3);
			if(mL!=null)mL.style.top=m4+m1;
			if(mR!=null)mR.style.top=m4+m2;
			setTimeout('mM()',1);
		}
		else
		{
			if(m3-m4>0)
			{
				m4=m4+Math.min(Math.pow(2,Math.min(Math.round((m3-m4)/50),8)),m3-m4);
				if(mL!=null)mL.style.top=m4+m1;
				if(mR!=null)mR.style.top=m4+m2;
				setTimeout('mM()',1);
			}
			else m5=0;
		}
	}
	function mS()
	{
		if(m5==0)m4=m3;
		if(document.documentElement&&document.documentElement.scrollTop)m3=document.documentElement.scrollTop;
		else if(document.body){m3=document.body.scrollTop;}
		if(m5==0){m5=1;mM();}
	}
	function mD()
	{
		if(document.body.clientWidth>994)
		{
			var m0=document.body.clientHeight;
			if(document.documentElement&&document.documentElement.scrollTop)m3=document.documentElement.scrollTop;
			else if(document.body)m3=document.body.scrollTop;
			if(mL!=null)
			{
				mL.style.visibility='visible';
				mL.style.left=document.body.clientWidth/2-389-document.getElementById('mTbExtL').clientWidth;
				m1=document.getElementById('mTbExtL').clientHeight;
				if(m1>=m0)m1=0;else m1=Math.round((m0-m1)/2);
				mL.style.top=m3+m1;
			}
			if(mR!=null)
			{
				mR.style.visibility='visible';
				mR.style.left=document.body.clientWidth/2+388;
				m2=document.getElementById('mTbExtR').clientHeight;
				if(m2>=m0)m2=0;else m2=Math.round((m0-m2)/2);
				mR.style.top=m3+m2;
			}
			mS();
		}
		else
		{
			if(mL!=null)mL.style.visibility='hidden';
			if(mR!=null)mR.style.visibility='hidden';
		}
        if(mT!=null) mA();
	}
	function mA()
	{
		var m8 = m9 = 0;
		var mP=document.getElementById('mTop');
		if (mP.offsetParent) 
		{
			m8 = mP.offsetLeft
			m9 = mP.offsetTop
			while (mP = mP.offsetParent) 
			{
				m8 += mP.offsetLeft
				m9 += mP.offsetTop
			}
		}
		mT.style.top=m9+22;
		mT.style.left=m8+286;
	}
	window.onload=function(){if((mL!=null)||(mR!=null)||(mT!=null)){window.onresize=mD;window.onscroll=mS;mD();}};
}
var mG=0;
mCL = function ()
{
}
function mMenu(m,n)
{
	try
	{
		var M=document.getElementById('mS'+m);
	        var A=document.getElementById('mS0');
		if(mG!=m)
		{
			try{document.getElementById('mS'+mG).style.display='none';A.style.display='none';}
			catch(es){}
			mG=m;
		}
		var j=1;
		if(M==null) return;
		mCL = function ()
		{
			if(j==2){M.style.display='none';A.style.display='none';}
			else {M.style.display='block';A.style.display='block';}
		}
		if(n==1) 
		{
			var m8 = m9 = 0;
			var P=document.getElementById('mM'+m);
			if (P.offsetParent) 
			{
				m8 = P.offsetLeft
				m9 = P.offsetTop
				if(document.all){m8+=1;m9+=1;};
				while (P = P.offsetParent) 
				{
					m8 += P.offsetLeft
					m9 += P.offsetTop
				}
			}
			M.style.top=m9-1;
			M.style.left=m8+140;
			A.style.top=m9-1;
			A.style.left=m8+135;
			setTimeout('mCL()','10');
		}
		else {j=2;setTimeout('mCL()','1000');}
	}
	catch(e){}
}
function mVN(m)
{
	try
	{
		var i=1;
		C = function ()
		{
			if(i==2)
			{
				try{frames[0].window.document.mForm.m[parent.mVm].checked=true;}
				catch(ef){}
				try{window.document.mForm.m[mVm].checked=true;}
				catch(ep){}
				v.style.display='none';
			}
	        }
		v=document.getElementById('mVN');
		if(m==1) 
		{
			v.style.display='block';
			document.forms[0].m[mVm].checked=true;
		}
		else {i=2;setTimeout('C()','1000');}
	}
	catch(ee){}
}
function mVoteClick(m0,m1,m2,m3)
{
	var m4='';var m5=0;var mObj;
	if(m0==1) mObj=document.getElementById('mL'+m2);
	else if(m0==3)mObj=document.getElementById('mR'+m2);
	else mObj=document.getElementById('mM'+m2);
	for(mc=0;mc<mObj.mVq.length;mc++)
	{
		if(mObj.mVq[mc].checked){++m5;m4=m4+'T'+mObj.mVq[mc].value;}
	}
	if(m3==m5)
	{
		mObj.mVoteBtn.disabled=true;
		if(m1==8)
		{
			mViewClick(8,m2);
			mAjax(null,'/vi/binhchon/'+m2+'/bophieu/'+m4+'/');
		}
		else 
		{
			mViewClick(2,m2);
			mAjax(null,'/en/voting/'+m2+'/vote/'+m4+'/');
		}
	}
	else
	{
		if(m1==8)alert('Xin vui l\u00F2ng ch\u1ECDn '+m3+' \u0111áp án');
		else alert('Please select only '+m3+' answer(s)');
	}
}
function mViewClick(m1,m2)
{
	if(m1==8)mOpen('/vi/binhchon/'+m2+'/','_mVoting');
	else mOpen('/en/voting/'+m2+'/','_mVoting');
}
function mOpen(m1)
{
	window.showModalDialog(m1,'window','center:on;resizable:off;scroll:off;status:off;dialogHeight:200px;dialogWidth:200px;');
}
function mAjax(m1,m2)
{
	var m3;
	try{m3=new ActiveXObject('Msxml2.XMLHTTP');}
	catch(e)
	{
		try{m3=new XMLHttpRequest();}
		catch (e)
		{
			try{m3=new ActiveXObject('Microsoft.XMLHTTP');}
			catch(e)
			{
				alert('Your browser do not support ajax - Trình duy\u1EC7t c\u1EE7a b\u1EA1n không h\u1ED7 tr\u1EE3 ajax.');
				return false;
			}
		}
	}
	m3.onreadystatechange=function()
	{
		if(m3.readyState==4) if(m1!=null) m1.innerHTML=m3.responseText;
	};
	m3.open('GET',m2,true);m3.send(null);
}
var mGe=0;
function mGetExt(m1,m2,m3)
{
	var mObj=document.getElementById('mContentExt');
	if(m1==8)
	{
		switch(m2)
		{
			case 1: if(mGe!=1) {mObj.innerHTML='<iframe src="/vi/guibanbe/" border="0" frameborder="0" class="m96"></iframe>';mGe=1;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
			case 2: if(mGe!=2) {mObj.innerHTML='<iframe src="/vi/phanhoi/banbientap/" border="0" frameborder="0" class="m97"></iframe>';mGe=2;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
			case 3: if(mGe!=3) {mObj.innerHTML='<iframe src="/vi/phanhoi/baiviet/'+m3+'/" border="0" frameborder="0" class="m98"></iframe>';mGe=3;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
			case 4: if(mGe!=4) {mAjax(mObj,'/vi/phanhoi/baiviet/'+m3+'/01/');mGe=4;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
		}
	}
	else
	{
		switch(m2)
		{
			case 1: if(mGe!=1) {mObj.innerHTML='<iframe src="/en/sendtofriend/" border="0" frameborder="0" class="m96"></iframe>';mGe=1;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
			case 2: if(mGe!=2) {mObj.innerHTML='<iframe src="/en/feedback/editorialstaff/" border="0" frameborder="0" class="m97"></iframe>';mGe=2;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
			case 3: if(mGe!=3) {mObj.innerHTML='<iframe src="/en/feedback/article/'+m3+'/" border="0" frameborder="0" class="m98"></iframe>';mGe=3;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
			case 4: if(mGe!=4) {mAjax(mObj,'/en/feedback/article/'+m3+'/01/');mGe=4;}
				    else {mObj.innerHTML='';mGe=0;}
				    break;
		}
	}
}
function mGold(m)
{
	a=document.mGPER;
	b=a.mYear.options[a.mYear.selectedIndex].text+'/';
	c=a.mMonth.options[a.mMonth.selectedIndex].text;
	if(c.length==1) b+='0'+c+'/';
	else b+=c+'/';
	c=a.mDay.options[a.mDay.selectedIndex].text;
	if(c.length==1) b+='0'+c+'/';
	else b+=c+'/';
	if(m==8)window.location='/vi/giavang-tygia/'+b;
	else window.location='/en/goldandexchange/'+b;
}
function mToSearchPage(m,n)
{
    a=document.mForm;
    if(n==0)
    {
        s=document.forms['mSP'].mPg;
        a.mPageId.value=s.options[s.selectedIndex].value;
    }
    else a.mPageId.value=n;
    a.mSubmit.click();
}
function mExtGoTo(m1,m2,m3)
{
	if(m3=='P')
	{
		mObj=document.forms['mReply'].mPg;
		m3=mObj.options[mObj.selectedIndex].value;
	}
	var mObj=document.getElementById('mContentExt');
	if(m1==8)
	{
		mAjax(mObj,'/vi/phanhoi/baiviet/'+m2+'/T'+m3+'/');mGe=4;
		m3=''+window.location;window.location=m3.replace('#bandocviet','')+'#bandocviet'
	}
	else 
	{
		mAjax(mObj,'/en/feedback/article/'+m2+'/P'+m3+'/');mGe=4;
		m3=''+window.location;window.location=m3.replace('#discussion','')+'#discussion'
	}
}

function mLinkTo()
{
	mObj=document.forms['mLink'].mP;
	m1=mObj.options[mObj.selectedIndex].value;
	if(m1.length>0) window.open(m1,'_mLink');
}
function mResize(id)
{
	mObj=document.getElementById(id);
    if(document.all)
    {
        window.dialogWidth=mObj.clientWidth+60+'px';
        window.dialogHeight=mObj.clientHeight+60+'px';
    }
    else
    {
	    this.window.resizeTo(mObj.clientWidth+60,mObj.clientHeight+80);
	    this.window.moveTo((screen.width-mObj.clientWidth-60)/2,(screen.height-mObj.clientHeight-80)/2);
    }
}
function mEventChangePage(m1)
{
	mObj=document.forms['mEvt'].mPg;
	window.location=m1+'/'+mObj.options[mObj.selectedIndex].value+'/';
}
mCopyright();mAdvExt();
            