﻿function setEltDisplay(id, disp) {if (!document.getElementById)return false;var elt = document.getElementById(id);if (elt)elt.style.display = disp;return false;}
function showElt(id) {setEltDisplay(id, "");return false;}
function hideElt(id) {setEltDisplay(id, "none");return false;}
function showhide(id) {if (!document.getElementById)return false;var elt = document.getElementById(id);if (elt)if (elt.style.display == "none")elt.style.display = ""; else elt.style.display="none";return false;}
function showDialog(vLink, vWidth, vHeight)
{
return showWindow(vLink, false, true, true, false, false, false, false, true, true, vWidth, vHeight, 0, 0);
}
function showModalDialog(vLink, vWidth, vHeight)
{
return showWindow(vLink, false, false, false, false, false, false, false, true, true, vWidth, vHeight, 0, 0);
}

function showWindow(vLink, vStatus, vResizeable, vScrollbars, vMenubar, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vWidth, vHeight, vTop, vLeft)
{
var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

winDef = '';
winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('menubar=').concat((vMenubar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('height=').concat(vHeight).concat(',');
winDef = winDef.concat('width=').concat(vWidth).concat(',');

if (vCentered)
{
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
}
else
{
	winDef = winDef.concat('top=').concat(vTop).concat(',');
	winDef = winDef.concat('left=').concat(vLeft);
}

open(sLink, '_blank', winDef);

if (typeof(vLink.href) != 'undefined')
{
	return false;
}
}
function popup(url)
{
	window.open(url,'_blank','toolbar=yes, status=yes, location=yes,resizable,width=450,height=450,top=75,left=220,scrollbars=yes');
}
function popupsurvey(url)
{
	window.open(url,'_blank','toolbar=no, status=no, location=no,resizable=no,width=500,height=450,top=75,left=220,scrollbars=no');
}
function OnCmdSubmitClick(Location,Option,w,h)
{
	var objOpt = document.forms[0][Option];
	for (var i = 0; i < objOpt.length; i++)
		if (objOpt[i].checked)
		{
			showDialog('/Controls/Poll/PollResult.aspx?LID=' + Location + '&results=' + objOpt[i].value, w, h);
			return;
		}
	alert('Bạn cần chọn một câu trả lời trước khi nhấn nút!');
}

function OnCmdViewClick(Location,w,h)
{
	showDialog('/Controls/Poll/PollResult.aspx?LID=' + Location + '&results=-1', w, h);
}
var imgLoad = new Image();
imgLoad.src = '/images/spinner.gif';

function sectionToggle(id)
{
    var currentDisplay = $(id).style.display ;
    if ( currentDisplay == "none" )
    {
        Effect.BlindDown(id);
    }
    else
    {
        Element.hide(id);   
        var section = getSectionArray();
        var counter = 0;
        section.each( function(item)
            {
                if ( item.style.display == "none" )
                    counter++ ;
            }
        );
    }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


    function expand(id)
    {
        document.getElementById(id).style.visibility = 'visible';
    }
    function collapse(id)
    {
        document.getElementById(id).style.visibility = 'hidden';
    }

if (window.parent != window) {
    alert('This website violate "The VGP News © Copyright Notice".\r\nClick OK to Access VGP News!');
    window.open(location.href, '_top', '');
}