var myWidth = 0, myHeight = 0;
function alertSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
}
/* - - - - - - - - - - - - - - - - - - */

function MainPageResize() {
    alertSize();
    var MainTable_ = document.getElementById("MainTable");
    MainTable_.style.height = (myHeight-20) +'px';
}
function HomePageResize() {
		MainPageResize();
    SetHomeFlv();
}
function CenterObjInPage(obj_) {
    alertSize(); 
    obj_.style.top = ((myHeight - findHeight(obj_))/2) +'px';
    obj_.style.left = (((myWidth -20) - findWidth(obj_))/2) +'px';
}

function SetSameHeight(Id_1,Id_2) {
    Id_1_ = document.getElementById(Id_1);
    Id_2_ = document.getElementById(Id_2);
    Id_2_.style.height = findHeight(Id_1_);
}
/* - - - - - - - - - - - - - - - - - - */
var fo;
var flvPlay = "yes";
function FlvPlayer(Box_,Flv_,FlvW_,FlvH_,FlvX_,FlvY_) {
    fo = new SWFObject("/flv/FlvBox.swf", "flashid", FlvW_, FlvH_, "8", "#ffffff");
    fo.addVariable("FLVContentPath", "/flv/"+ Flv_);
    fo.addVariable("FLVAutoPlay", flvPlay);
    fo.addVariable("FLVBufferTime", "7");

    if (FlvX_!=0) fo.addVariable("FLVX", FlvX_);
    if (FlvY_!=0) fo.addVariable("FLVY", FlvY_);

    fo.addVariable("BGPWait", "1");
    fo.addVariable("FLVWait", "1");
    fo.addParam("wmode", "transparent");
    fo.addParam("menu", "false");
    fo.write(Box_);
}

/* - - - - - - - - - - - - - - - - - - */
function SetHomeFlv() {
var BodySxDiv_ , BodySxTd_ ;
BodySxDiv_ = document.getElementById("BodySxDiv");
BodySxTd_ = document.getElementById("BodySxTd");

	if (document.all){ // Explorer
		BodySxDiv_.style.top  = (findPosY(BodySxTd_) ) +'px';
		BodySxDiv_.style.left = findPosX(BodySxTd_) +'px';
	
		BodySxDiv_.style.position='absolute';
	}
	else {
		setTimeout("BodySxDiv_.style.position='relative';",0);
	}
}
/* - - - - - - - - - - - - - - - - - - */
var Divobj;
function ResizeDiv(Box_,DivW,DivH) {
	Divobj = document.getElementById(Box_);
  Divobj.style.height = DivH +'px';
  Divobj.style.width  = DivW +'px';
}
function InitFloatDiv(Box_,DivH,FootH) {
//    if (myWidth==0||myHeight==0){ alertSize(); }
	alertSize(); 
	Divobj = document.getElementById(Box_);
	Divobj.style.top = (myHeight - DivH - FootH) +'px';
	Divobj.style.position='fixed';
}

function InitAbsoluteDiv(Box_) {
//    if (myWidth==0||myHeight==0){ alertSize(); }
	alertSize(); 
	Divobj = document.getElementById(Box_);
	Divobj.style.top = findPosY(Divobj) +'px';
	Divobj.style.left = findPosX(Divobj) +'px';
	Divobj.style.position='absolute';
}
function InitDemoDiv(Box_,DivH) {
//    if (myWidth==0||myHeight==0){ alertSize(); }
	alertSize(); 
	Divobj = document.getElementById(Box_);
	Divobj.style.top = (myHeight - DivH) +'px';
	Divobj.style.left = '5px';
	Divobj.style.position='fixed';
//	Divobj.style.position='absolute';
}
function InitDemoPage(Box_,DivHead) {
//    if (myWidth==0||myHeight==0){ alertSize(); }
	alertSize(); 
	Divobj = document.getElementById(Box_);
  Divobj.style.height = (myHeight) +'px';
  Divobj.style.width = (myWidth) +'px';
}

/* - - - - - - - - - - - - - - - - - - */
function findPosX(obj) {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent) break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj) {
    var curtop = 0;
    if(obj.offsetParent)
        while(1) {
          curtop += obj.offsetTop;
          if(!obj.offsetParent) break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
function findHeight(obj) {
    return obj.offsetHeight;
}

function findWidth(obj) {
    return obj.offsetWidth;
}
  
/* - - - - - - - - - - - - - - - - - - */
