// JavaScript Document
var myWidth;
var myHeight;
var screenX;
var screenY;
var posscroll;

function fnInit(news)
{
	//getSize();
	//left = (myWidth/2)-450;
	//alert(left);
	//setLeft(left);
	if(news==1) contentLoad('rssReader.php?URL=http://www.thaisarn.com/rssnews/technology.xml','rssDisplay');
	//contentLoad2('rssReader.php?URL=http://www.nectec.or.th/index.php?option=com_rss&feed=RSS2.0&no_html=1','rssDisplay2');
}
function setLeft(left)
{
	if(left < 0) left=0;
	obj = document.getElementById('main');
	obj.style.marginLeft = left+'px';
}
function getSize() {
  //var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
	posscroll = window.pageYOffset;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
	posscroll = document.documentElement.scrollTop ;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
	posscroll = document.body.scrollTop ;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );

  //document.title='Width = ' + myWidth+' Height = ' + myHeight;
}

function getPosScroll() {
  //var myWidth = 0, myHeight = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Non-IE
    posscroll = window.pageYOffset;
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    //IE 6+ in 'standards compliant mode'
    posscroll = document.documentElement.scrollTop ;
  } else if( document.body && document.body.scrollTop ) {
    //IE 4 compatible
    posscroll = document.body.scrollTop ;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
}


function jsOpenPopup()
{
	getSize();
	
	divObj = document.getElementById('popup');
	divbg = document.getElementById('bgPopup');
	index = document.getElementById('indexPage');
	//screenY = window.innerHeight;
	//screenX = screen.width;
	var posX = (myWidth/2)-(677/2);
	var posY = (myHeight/2)-(472/2);
	/* disable -- scrollbar --*/
	//posscroll = window.pageYOffset;
	//alert('posscroll = '+posscroll+' posY = '+posY);
	index.style.overflow="hidden";
	/* bckgrond popup */
	divbg.className='bg_popup_on';
	/* normal popoup */
	divObj.style.left = posX+"px";
	posY = posY+posscroll;
	divObj.style.top = posY+'px';
	divObj.style.height = 472+'px';
	divObj.style.width = 677+'px';
	divObj.style.display='Block';
	divObj.style.backgroundColor='#FFF';
	divObj.style.zIndex="2000";
}

function jsClosePopup()
{
	index = document.getElementById('indexPage');
	index.style.overflow="auto";
	divObj = document.getElementById('popup');
	divObj.style.left = "0px";
	divObj.style.top =  "0px";
	divObj.style.height = "0px";
	divObj.style.width = "0px";
	divObj.style.display='none';
	divObj.style.backgroundColor="#FFF";
	/* bg */
	divObj = document.getElementById('bgPopup');
	divbg.className='bg_popup_off';
}

function jsConfirmDelete(url,div)
{
	jsOpenPopup();
	loadPopup(url,div);
}

function jsDelete(url,div)
{
	jsOpenPopup();
	contentLoad(url,div);
	jsClosePopup();
}

