var t_DiglogX,t_DiglogY,t_DiglogW,t_DiglogH;
var t_DialogObject = null;
var regFlag = false;

function gid(id) {
return document.getElementById?document.getElementById(id):null;
}

function gname(name) {
return document.getElementsByTagName?document.getElementsByTagName(name):new Array()
}

function Browser() {
var ua, s, i;
this.isIE = false;
this.isNS = false;
this.isOP = false;
this.isSF = false;
ua = navigator.userAgent.toLowerCase();
s = "opera";
if ((i = ua.indexOf(s)) >= 0) {
   this.isOP = true;return;
}
s = "msie";
if ((i = ua.indexOf(s)) >= 0) {
   this.isIE = true;return;
}
s = "netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
   this.isNS = true;return;
}
s = "gecko";
if ((i = ua.indexOf(s)) >= 0) {
   this.isNS = true;return;
}
s = "safari";
if ((i = ua.indexOf(s)) >= 0) {
   this.isSF = true;return;
}
}

function DialogLoc() {
  var dde = document.documentElement;

  var xScroll, yScroll;  
  if (window.innerHeight && window.scrollMaxY) {  
    xScroll = document.body.scrollWidth;
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
  }

  var ww , wh ;
  if (self.innerHeight) {  // all except Explorer
    ww = self.innerWidth;
    wh = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    ww = document.documentElement.clientWidth;
    wh = document.documentElement.clientHeight;
  } else if (document.body) { // other Explorers
    ww = document.body.clientWidth;
    wh = document.body.clientHeight;
  }  
  
  var bgX,bgY
  if (window.innerWidth) {
	 bgX = window.pageXOffset;
	 bgY = window.pageYOffset;
  } else {
     bgX = dde.scrollLeft;
	 bgY = dde.scrollTop;
  }
  t_DiglogX = ((ww - t_DiglogW)/2) + document.body.scrollLeft;
  t_DiglogY = ((wh - t_DiglogH)/2) + document.body.scrollTop;
  
}

function DialogShow(showdata,ow,oh,w,h) {

var objDialog = document.getElementById(showdata);
t_DialogObject = objDialog;

t_DiglogW = ow;
t_DiglogH = oh;

 

DialogLoc();
// objDialog.id = "DialogMove";
var oS = objDialog.style;
oS.display = "block";
oS.top = t_DiglogY + "px";
oS.left = t_DiglogX + "px";
oS.margin = "0px";
oS.padding = "0px";
oS.width = w + "px";
oS.height = h + "px";
oS.position = "absolute";
oS.zIndex = "230000";
oS.background = "#CCCCCC";
//oS.border = "solid #000 1px";

// objDialog.innerHTML = showdata;
// document.body.appendChild(objDialog);
}

function DialogHide(id) {
	try
	{		
		//window.document.flashResize.wmode = "opaque";
		//window.document.flashResize.Lplay();
		if(!regFlag)
			ScreenClean();
		 
		if (t_DialogObject) 
		{
			t_DialogObject.style.display = "none";
			if (t_DialogObject.id=="HelpVideoContainer")
			{
				t_DialogObject.innerHTML = "";
			}
		}
		if (id != '' && id != 'undefined')
		{	
			var obj = document.getElementById(id);
			if(obj != null)
			{
				obj.style.display = "none";
				obj.style.innerHTML = "";
				regFlag = false;
			}	
		}
	
	}catch(e){}

}

function ScreenConvert() {
var browser = new Browser();
var objScreen = gid("ScreenOver");
if (!objScreen) var objScreen = document.createElement("div");
var oS = objScreen.style;
objScreen.id = "ScreenOver";
oS.display = "block";
oS.top = oS.left = oS.margin = oS.padding = "0px";

var wh;
if (window.innerHeight && window.scrollMaxY) {  
    wh = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    wh = document.body.scrollHeight;
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    wh = document.body.offsetHeight;
  }
	if(navigator.userAgent.toLowerCase().indexOf('msie 7.0')>=0)
	{
		var form1=document.getElementById('aspnetForm');
		if(form1){
		if(form1.scrollHeight)wh=form1.scrollHeight+35;}
	}
oS.width = "100%";
oS.height = wh+"px";
oS.position = "absolute";
oS.zIndex = "220000";
if ((!browser.isSF) && (!browser.isOP)) {
   oS.background ="#181818" ;
   } else {
   oS.background = "#F0F0F0";
}
oS.filter = "alpha(opacity=70)";
oS.opacity = 70/100;
oS.MozOpacity = 70/100;
document.body.appendChild(objScreen);
}



function ScreenClean() {
var objScreen = document.getElementById("ScreenOver");
if (objScreen) objScreen.style.display = "none";
}

//function Report(Type,ID)
function Report()
{
   try
   {
   	  window.document.flashResize.Lpause();
   }
   catch(e)
   {
   
   }
   ScreenConvert();
   DialogShow("DialogMove",377,164,377,164);

}

function ShowFlv(swf)
{
   try
   {
   	  	window.document.flashResize.Lpause();
   }
   catch(e)
   {
   
   }
   ScreenConvert();
   
   DialogShow("HelpVideoContainer",710,512,710,512);
   
   var oS = t_DialogObject.style;
   oS.padding = "0px";
   //oS.border = "solid #000 1px";

   
   var so = new SWFObject(swf, "mymovie", "710px", "512px", "8", "#cccccc");
   so.addParam("quality", "high");
   so.addParam("wmode", "transparent");
   so.addParam("scale", "noscale");
   so.addParam("menu", "false");
   so.addParam("salign", "lt");
   so.addParam("loop", "false");
   so.write("HelpVideoContainer");
}

function addTag()
{
    var objDialog = document.getElementById("DialogMove");
    var allInput = objDialog.getElementsByTagName("INPUT");
    
    var objTagDiv = document.getElementById("tagTextBox");
    var allInputBox = objTagDiv.getElementsByTagName("INPUT");
    
    if (allInput[0].value.length>0)
    {
        allInputBox[0].value = allInput[0].value
	    return DialogHide();
	}
	else
	{
    	var objAlert = gid("divPopTagAlert");
    	var oS = objAlert.style;
    	oS.display = "block";
    	objAlert.innerHTML = "The form field is empty. Please enter your tag below and click \"Add Tag\" to continue.";
    	return false;
    }
}

function CloseTag()
{
	var objAlert = gid("divPopTagAlert");
	var oS = objAlert.style;
	oS.display = "none";
	objAlert.innerHTML = "";
	return DialogHide();
}

function ShowDialog(showdata,ow,oh,w,h){

   try
   {
   	  window.document.flashResize.Lpause();
   }
   catch(e)
   {   
   }
   
   ScreenConvert();
   DialogShow(showdata,ow,oh,w,h);

}

function HideDialog(showdata) {
		return  DialogHide();
}

// Show Slowly
 var ScreenConvertAnimation = function(obj, startOpacity, endOpacity, stepOpacity, playTimeSpan, callback) {
            this.element = obj;
            this.hashcode = "SCA" + ScreenConvertAnimation.__COUNT++;
            this.style = obj.style;
            this.callback = callback;
            eval("ScreenConvertAnimation.all." + this.hashcode + "=this");

            this.startOpacity = startOpacity;
            this.endOpacity = endOpacity;
            this.stepOpacity = stepOpacity;
            this.playTimeSpan = playTimeSpan;
            this.isPlaying = false;

            this.setOpactity = function(v) {
                this.currentOpacity = v;

                this.style.filter = "alpha(opacity=" + v + ")";
                this.style.opacity = v / 100;
                this.style.MozOpacity = v / 100;
            };
            this.setOpactity(this.startOpacity);
            this.currentOpacity = this.startOpacity;

            this.isPlayback = function() {
                return this.stepOpacity > 0 ? (this.currentOpacity < this.endOpacity) : (this.currentOpacity > this.endOpacity);
            };

            this.play = function() {
                if (this.isPlayback()) {
                    this.isPlaying = true;
                    this.setOpactity(this.currentOpacity + this.stepOpacity);
                    this.timer = setTimeout("ScreenConvertAnimation.all." + this.hashcode + ".play();", this.playTimeSpan);
                }
                else {
                    this.isPlaying = false;
                    clearTimeout(this.timer);
                    if (this.callback)
                        if (typeof (this.callback) == "function")
                            this.callback.apply();
                }
            }
        }
        ScreenConvertAnimation.all = {};
        ScreenConvertAnimation.__COUNT = 0;
//

var __Section;
	function FluorItemClick(){
	 	try{
	 		fluor_lista = getJSMovieList();
	 		fluor_lista_key = true;
	 		PlayFluorFlv();

	 	}catch(e){alert(e);}

	 } 

	 var fluor_lista = null;
	 var fluor_lista_key = false;
	 
	 function PlayFluorFlv()
	 {
	 	if(thisMovie("Main") && thisMovie("Main").setFlvList)
	 	{
	 		thisMovie("Main").setFlvList(fluor_lista);
	 		fluor_lista_key = false;
	 	}
	 	
	 	if(fluor_lista_key){
	 		window.setTimeout(PlayFluorFlv, 500);
	 	}
	 }

	 	 function GenerateFlvPlayer()
		 {
		 	var objScreen = document.getElementById("basicModalContent2");
		 	if (!objScreen)
		 	{	 	
				objScreen = document.createElement("div");
				objScreen.setAttribute('id','basicModalContent2');
				objScreen.className='flashwhole';
				document.body.appendChild(objScreen);
			}		 	
			var so = new SWFObject("/SiteCollectionImages/swf/Main.swf", "Main", "800", "450", "9", "#ffffff");
			so.addParam("quality", "high");
			so.addParam("scale", "noscale");
			so.addParam("wmode", "transparent");
			so.addParam("menu", "false");
			so.addParam("salign", "lt");
			so.addParam("loop", "false");
			so.addParam("allowFullScreen","true");
			so.addParam("flashvars","srvPath=/_layouts/css/VideoPlayerDataSource.aspx?section="+escape(__Section));
			so.write("basicModalContent2");
		 	
		 }

	 function ShowModal(sectionValue)
	 {	 	
	 	__Section=sectionValue;
	 	var whole=document.getElementById('FlashContentWhole');
		var objScreen = document.getElementById("basicModalContent2");
	 	if (!objScreen)
	 	{	 	
			objScreen = document.createElement("div");
			objScreen.setAttribute('id','basicModalContent2');
			objScreen.className='flashwhole';
			document.body.appendChild(objScreen);
		}	
	 		
	 	ShowDialog('basicModalContent2',800,450,800,450);
	 	var fay=document.getElementById('ScreenOver');
		document.body.appendChild(document.getElementById('basicModalContent2'));
		var scaobj = new ScreenConvertAnimation(gid('ScreenOver'),0,70,10,1);	
	 	scaobj.play();
	 	
		var ww , wh ;
		  if (self.innerHeight) { 
		    ww = self.innerWidth;
		    wh = self.innerHeight;
		  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		    ww = document.documentElement.clientWidth;
		    wh = document.documentElement.clientHeight;
		  } else if (document.body) { // other Explorers
		    ww = document.body.clientWidth;
		    wh = document.body.clientHeight;
		  }  

		var dde = document.documentElement;
		 var bgX,bgY
		  if (window.innerWidth) {
			 bgX = window.pageXOffset;
			 bgY = window.pageYOffset;
		  } else {
		     bgX = dde.scrollLeft;
			 bgY = dde.scrollTop;
		  }
		  	  
		document.getElementById('basicModalContent2').style.top = ((wh - 450)/2) + document.body.scrollTop;
		GenerateFlvPlayer();
	 }
 	function popupclose()
 	{
 		try
 		{	
 			//document.getElementById("basicModalContent2").innerHTML = "";
 			var scaobj = new ScreenConvertAnimation(gid('ScreenOver'),70,0,-10,1, function () { DialogHide('basicModalContent2');});	
	 		scaobj.play();
	 	}catch(ex){} 	
	 		
 	}
 	function openURL(url)
 	{
 		window.open(url,'_blank','menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,location=yes');
	
 	}

 	window.onresize = function()
    {  
        if (document.body.clientWidth<=860)
        {
            if( document.getElementById('centerbannercontent') != null )
            	document.getElementById('centerbannercontent').style.width=860;
        }
        else
        {
        	if( document.getElementById('centerbannercontent') != null )
            	document.getElementById('centerbannercontent').style.width='auto';
        }
    }
function getVideoPageURL(){
	var updateMetaPara = getUrlParam('updatemeta');
	if(updateMetaPara!=null)
	{
		return window.location.href.replace(/&*updatemeta=\d*/ig,'').replace(/#\d*/g,'');
	}
   return window.location.href.replace(/#\d{0,3}/g,'');
}