if (!window.Zoomlight)
	window.Zoomlight = {};

Zoomlight.Scene = function() 
{
}
//var new
var rotateWeatherT=500;
var loopMax=2;
var tInterval;
var loopNum=0;
var weatherFlag=0;

/////////////////////////////////////////////////////////////////
//var play sub
var sub1;
var sub2;
var sub3;
var sub4;
var sub5;
var time1;
var time2;
var time3;
var time4;
var time5;
var title1="media/CVC_Intro01.wmv";
var title2="media/RonStiver02.wmv";
var title3="media/RonStiver03.wmv";
var title4="media/Indiana30sec.wmv";
var title5="media/Indiana60sec.wmv";
var timeIn;
var subIn;

var arrayInt;//setIntArray


var SubTitleNum;
var endS=" ";
var SubTitleCount=0;

var arrayTime=time1; //global pass time to SetInt 
var arrayTitle=sub1; //global pass text to SetInt 
///////////////////////////////////////////////////////////////



var maxM;
var maxTR;
var countM=1;
var countTR=1;
var countIM=1;
var strTR;
var strTRT;
var strTRL;
var strIR;
var strM;
var strVol;
//var images instead of movie
var strIM;
var strIntMovArr;
var strIMT;
var maxIM;
//var Controls
var media;
var textRight;

var imageRight;
var AnImageRight;
var canvaImage;
var imageMedia;
///end var new

var count=1;
var count1=10;
var str="OOO";
/////////TESTLIST
var COUNT_TEST_1=0;
/////////ANIMATION////////
var strTextRight="BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST BMV TV TEST";


var strMedia1="media/BMVTV_intro.wmv";


var timer;
var countTextR=1;

var testMedia="0";
var ImageOn=2;
//var media;

//////////////////////////

/////////LEFT ////
var strIL;
var strILin;
var strTL;
var strSL;
var strWeather;
var maxW=0;
var countWeather=0;
var maxIL;
var countIL=1;
var SetMesrectLeft;
var AnSetMesrectLeft;
var imageLeft;
var imageLeftIn;
var textLeft;
var AnImLeft;
var SetLogoX;
var WidthLeft;
var strImLeft="imagesL/csstate.jpg";
var strImLeftIn="imagesL/logo_1in.png";
//LIST////////////////////
var imageNext;
var strList="Person1 \n Person2 \n Person3 "; 
var strListNew= new Array("LINDSAY C \nNASSER A \nANDREA L \nMARK F \nESMERALDA S", "WILLARD I \nKODY H \nKEITH F \nPARAMVIR S \nDUSTIN B",
"ANDREW B \nJAMIE G \nTERRA S \nDANE D \nGAIL Z", "ANDREW B \nJAMIE G \nMATTHEW J \nSHAUN Y \nKELLEY S"); 
var counterListIdle=0;
//var maxList;
//var maxListNew;
//var listLenth=5;
var flagList=1; 
var textList;
var AnList;
//////////////////////////
//var settingsDoc = null;
var mediaCol;
////SCROLL//////////
var AnScroll;
var SetScroll;
var maxScroll=0;
var maxScrollNew=0;
var countScroll=0;
var textScroll;
var strScroll;
var strScrollshift;
var flagScroll=0;
var strScrollNew;
var strScrollshiftNew;
////////////"CARUSEL"///////	

Zoomlight.Scene.prototype =
{

	handleLoad: function(plugIn, userContext, rootElement) 
	{    
	
	this.plugIn = plugIn;
				
		//LEFT////
		SetMesrectLeft = plugIn.content.findName("SetMesrectLeft");		
		AnSetMesrectLeft = plugIn.content.findName("AnSetMesrectLeft");					
		AnTextLeft = plugIn.content.findName("AnTextLeft");	
	    AnImLeft=plugIn.content.findName("AnImLeft");
	    SetLogoX=plugIn.content.findName("SetLogoX");			
		textLeft=plugIn.content.findName("textLeft");
		imageLeft=plugIn.content.findName("imageLeft");	
		imageLeftIn=plugIn.content.findName("imageLeftIn");	
		////ANIMATION
		

		WidthLeft=plugIn.content.findName("WidthLeft");
		
	    
		
		
	    //LIST//
		AnList = plugIn.content.findName("AnList");	
		textList=plugIn.content.findName("list1");
		imageNext=plugIn.content.findName("next");	
		//SCROLL//
		textScroll=plugIn.content.findName("textScroll");
		AnScroll=plugIn.content.findName("AnScroll");
		SetScroll=plugIn.content.findName("SetScroll");		
		//RIGHT//		
		AnImageRight = plugIn.content.findName("AnImageRight");
		imageRight=plugIn.content.findName("imageRight");		
		canvaImage=plugIn.content.findName("canvaImageMedia1");			
		imageMedia=	plugIn.content.findName("logoB");
		textRight=plugIn.content.findName("textRight");		
		media=plugIn.content.findName("media");
		this.SetMesrect = plugIn.content.findName("SetMesrect");
		this.AnSetMesrect = plugIn.content.findName("AnSetMesrect");
		this.AnTextRight = plugIn.content.findName("AnTextRight");		
		
		 //LEFT//
	    imageLeft.Source=strImLeft;
	    imageLeft.addEventListener("ImageFailed", Silverlight.createDelegate(this, this.handleImFailed));	
		imageLeftIn.Source="";
	    SetMesrectLeft.From=0;
	    SetMesrectLeft.To=356;
	    AnSetMesrectLeft.Begin();	
		AnImLeft.Begin();		
		//LIST///	
		imageNext.Source=fileBMWTV;
		textList.Text="";
		//SCROLL//
		AnScroll.addEventListener("Completed", Silverlight.createDelegate(this, this.scrollEnd));
		textScroll.Text=strScrollIn;
		SetScroll.To=scrollToIn;
	    AnScroll.Begin();
	    //RIGHT//		
		media.addEventListener("MediaFailed", Silverlight.createDelegate(this, this.handleMediaFailed));	
		media.addEventListener("CurrentStateChanged", Silverlight.createDelegate(this, this.handleChanged));	
		media.addEventListener("MediaEnded", Silverlight.createDelegate(this, this.handleMediaEnded));	  
	    media.addEventListener("MediaOpened", Silverlight.createDelegate(this, this.handleMediaOpened));
	    media.source="media/BMVTV_intro.wmv";
        textRight.Text=" ";
        this.SetMesrect.From=0;
	    this.SetMesrect.To=120;
	    this.AnSetMesrect.Begin();	         
	    this.AnTextRight.Begin();
	     AnImageRight.Begin();    
	   /////////////////////////////////////////////////////////////////////////////////////////////////////	    
	    			
		
		var timerCookie = setInterval(Silverlight.createDelegate(this, this.ReDrawList), 10001);
		var timerCookie1 = setInterval(Silverlight.createDelegate(this, ReDrawLeft), 15000);
			
		///////////TEST_UPDATE_LIST////////////////////////////	
		//var timerCookieTestListUpdate = setInterval(Silverlight.createDelegate(this, this.updateListTest), 15000);	
		///////////////////////////////////////////////////////
		
     //INIT. ARRAYS
     strM = new Array();
     strVol = new Array();  
     strTR = new Array();
     strTRT = new Array();
     strTRL = new Array();
     strIR = new Array();
     strIM= new Array();
     strIntMovArr= new Array();
     strIMT= new Array();
     //LEFT
     strIL= new Array();
     strILin= new Array();
     strTL= new Array();
     strSL= new Array(); 
     strWeather= new Array();   
     //SCROLL//
     strScroll=new Array();
     strScrollshift=new Array();
     strScrollNew=new Array();
     strScrollshiftNew=new Array();
     //LIST
     //strList=new Array(); 
     //strListNew=new Array();
     //TITLE
     sub1=new Array();
     time1=new Array();
     sub2=new Array();
     time2=new Array();
     sub3=new Array();
     time3=new Array();
     sub4=new Array();
     time4=new Array();
     sub5=new Array();
     time5=new Array();
     arrayInt=new Array();
     
     //LOAD DATA
     var tv=GetXml( "Data.xml", SettingsLoaded ); 
     var tv1=GetXml( "RssData.xml", ScrollLoaded );
      
     
     ///////TEST////////////////////////
     //var theContent = plugIn.content.createFromXaml("<Image  Canvas.Left='20' Canvas.Top='20' Source='logo150.png'/>	");  
     //var root = plugIn.content.findName("root");
     //root.children.insert(0, theContent);
     //////END TEST///////////////////
     
     //this.imageLeft.SetValue("Canvas.Top", "100");
     //var test11=this.imageLeft.GetValue("Canvas.Top");		
     //this.imageLeft.SetValue("Canvas.ZIndex", 1);
     //var test11=this.imageLeft.GetValue("Canvas.ZIndex");
},	
 handleImFailed: function(){
 ReDrawLeft() ;
 },
 //TEST_LIST_UPDATE 
 //updateListTest: function(){ 
 //COUNT_TEST_1++; 
 //var strListIn;
 //if(COUNT_TEST_1<5){
 //strListIn="Test " + COUNT_TEST_1;
 //}
 //else {
// if(COUNT_TEST_1>=5&&COUNT_TEST_1<8){
 //strListIn="[NUL]";
 //}
 //else {strListIn="Test " + COUNT_TEST_1;}
 //}
 //updateList(strListIn); 
 //}, 
 //END TEST LIST UPDATE
  
   scrollEnd: function(sender, eventArgs) {    
	textScroll.SetValue("Canvas.Left", "1360");
	var t=setTimeout("beginScroll()",10000);		
   }, 	
	
	
	ReDrawList: function(){	
	//if(flagList==1){
	updateListvar();
	//}
	
	//if(strList=="[NUL]")
	//{
	//imageNext.Source=fileBMWTV;
	//textList.text="";	
	//} 	
	//else{	
	imageNext.Source=fileNext;	
	textList.text=strList;
	AnList.Begin();
	//}    
    },
     		
	handleChanged: function(sender, eventArgs) {	
	},
	
	handleMediaOpened: function(sender, eventArgs) {	
	sender.findName("media").play();
	},
		
	handleMediaFailed: function(sender, eventArgs) {
	if(countM!==maxM){
	countM=countM+1;	
	}
	else{	
	countM=1;		
	}	
	mediaEndCont();
	//alert("media");	
	},
	
	handleMediaEnded: function(sender, eventArgs) {		
	mediaEnd();	
	this.SetMesrect.From=0;
	this.SetMesrect.To=120;
	this.AnSetMesrect.Begin();
	this.AnTextRight.Begin();
	
	
	}	
}	 

function searchInterRight(position){
 var num=-1; 
 var k=strIntMovArr.length; 
 for(var i=0; i<strIntMovArr.length; i++){
 if(position==strIntMovArr[i]){
 num=i;
 }
 }
 return num;
 } 
 function interupt(){  
 canvaImage.SetValue("Canvas.ZIndex",3);
 media.SetValue("Canvas.ZIndex", 2);
 
 if(countIM!==maxIM){
	countIM=countIM+1;	
	}
	else{	
	countIM=1;		
	}
 textRight.Text=" ";
 imageMedia.source="";
 imageRight.source=""; 
 imageMedia.source = strIM[countIM-1];
 imageMedia.width="950";
 imageMedia.height="537";
 
 //textRight=strIMT[countIM-1];
 var t=setTimeout("mediaEndCont()",15000);
 
 }




 function mediaEnd(){
 //if it is image in play list
 var interuption=searchInterRight(countM-1);
 if(interuption==-1){
 mediaEndCont();
 }
 else{ 
	interupt();
	}	
 }
 
 
 function mediaEndCont(){
  // textRight.Text = str1;
   imageMedia.width="112";
   imageMedia.height="112";
   imageMedia.source="";
   canvaImage.SetValue("Canvas.ZIndex",2);
   media.SetValue("Canvas.ZIndex", 3);
    var MovieName;
	var str="";	
	var sub;
	var sub2;
	var sub3;
	var str1="";	
	var str2="";
	var sl;
	var inum;
	var str3;
	//if in the list of interaprions then show image	
	if(countM!==maxM){
	countM=countM+1;	
	}
	else{	
	countM=1;		
	}
	
	str=strM[countM];
	
	sl=str.length;
	
	sub=str.substr(sl-3,3);
	
	
	if(sub=="[s]"){
	//code for sync. str
	sub=str.substr(0,sl-7);
	
	sub2=str.substr(sl-7,4);
	//alert("SUB1" + sub2);
	sub2=sub2.substr(1,2);
	//alert("SUB2" + sub2);
	
	inum=parseInt(sub2);
	
		
		
		
	media.source = sub;
	// interop...
	//window.external.ZoneMediaChanged("MAIN",sub);////////////////////////////////////////////
	// ...interop
	media.volume = strVol[countM-1];
	str2=strTRT[inum];
	textRight.SetValue("Canvas.Top", str2);
	str2=strTRL[inum];
	textRight.SetValue("Canvas.Left", str2);
	str1=strTR[inum];
	sl=str1.length;
	//code if image
	sub2=str1.substr(sl-6,3);
	
	///
	
	///
	if(sub2=="[i]"){
	//if image
	sub3=str1.substr(sl-10,4);
	sub3=sub3.substr(1,2);
	
	inum=parseInt(sub3); 
	
	str1=str1.substr(0,sl-10);	
	textRight.Text = str1;
	imageRight.source = strIR[inum];
	AnImageRight.begin();	
	}//end if image
	else{
	str3=str1.substr(0,sl-3);	
	textRight.Text = str3;
	imageRight.source = "";
	}
	}// end if sync
	
	
	
	//if not sync
	else{
	media.source = str;
	//media.volume = strVol[countM-1];//////?
	//////////
	//////////
	MovieName=str;
	
	/////////
	/////////
	
	// interop...
	//window.external.ZoneMediaChanged("MAIN",str);////////////////////////////////////////
	// ...interop
	if(MovieName==title1||MovieName==title2||MovieName==title3||MovieName==title4||MovieName==title5){
	if(MovieName==title1||MovieName==title2||MovieName==title3){
	imageRight.source = "images/logo150.png";
	textRight.SetValue("Canvas.Top", "570");	
	}
	else{
	if(MovieName==title4){
	imageRight.source = "imagesL/indianaDriver.png";
	}
	else{
	imageRight.source = "imagesL/indianaDriver.png";
	}
	//http://localhost:3214/textRight.color="black";	
	//textRight.SetValue("FontSize", "35");	
	textRight.SetValue("Canvas.Top", "570");
	textRight.SetValue("Canvas.Left", "150");
	textRight.SetValue("Width", "810");	
	}
	textRight.Text = " ";	
	showtitles(MovieName);
	}
	else{
	/////////////////////
	////////////////////
	if(countTR!==maxTR){
	countTR=countTR+1;	
	}
	else{	
	countTR=1;		
	}
	
	str1=strTR[countTR-1];	
	sl=str1.length;
	sub=str1.substr(sl-3,3);
	
	
	if(sub=="[s]"){
	if(countTR!==maxTR){
	countTR=countTR+1;	
	}
	else{	
	countTR=1;		
	}
	proc( countTR);
	}
	
	else {
	proc( countTR);
	}	
	}//end else not sync.	
	////////////////
	///////////////
	}//end else not titlessub
	////////////////
	
	}// end method
	//////////
	//////////
	
	
	function showtitles(MovieName){	
	if(MovieName==title1){
	showtitlesR(sub1,time1);	
	}
	
	if(MovieName==title2){
	showtitlesR(sub2,time2);		
	}
	if(MovieName==title3){
	showtitlesR(sub3,time3);	
	}
	if(MovieName==title4){
	showtitlesR(sub4,time4);	
	}
	if(MovieName==title5){
	showtitlesR(sub5,time5);	
	}				
	}
	
	function showtitlesR(arrayInSubt, arrayInTimet){
	SubTitleCount=0;
	arrayTime=arrayInTimet;
	arrayTitle=arrayInSubt;
	var lengthA=arrayTime.length;
	var delay=0;
	for(var i=0; i<lengthA; i++){
	delay=CalcMili(arrayTime[i]);
	arrayInt[i]=setTimeout("changeSubtitle(arrayTitle)", delay);
	}
	}
	
	function changeSubtitle(arrayInSub){
	//textRight.SetValue("Canvas.Top", "570");
	var length_loc=arrayInSub.length;
	if(SubTitleCount<length_loc){
	textRight.Text=arrayInSub[SubTitleCount];	
	clearTimeout(arrayInt[SubTitleCount]);
	arrayInt[SubTitleCount]=null;
	SubTitleCount++;
	}
	else{
	textRight.Text=" ";	
	textRight.SetValue("Foreground", "#FFFFFFFF");
	textRight.SetValue("FontSize", "35");	
	textRight.SetValue("Width", "770");	
	textRight.SetValue("Canvas.Left", "160");
	clearTimeout(arrayInt[SubTitleCount]);
	arrayInt[SubTitleCount]=null;
	SubTitleCount=0;
	}
	}
	
	
	function showtitles1(){//old
	SubTitleCount=0;
	arrayTime=time1;
	arrayTitle=sub1;
	var lengthA=arrayTime.length;
	var delay=0;
	for(var i=0; i<lengthA; i++){
	delay=CalcMili(arrayTime[i]);
	arrayInt[i]=setInterval("changeSubtitle(arrayTitle)", delay);
	}
	}
	
	
	function  CalcMili(fnum){
	var sec=fnum;
	var min=parseInt(fnum);
	var timeMili;
	sec=parseInt((fnum-min)*10000);
	min=min*60*1000;
	sec=sec*10;
	timeMili=min+sec;	
	return timeMili;
	}
	
	
	function changeSub( textIn, loopn){
	textRight.Text=textIn;	
	clearInterval(arrayInt[loopn]);
	arrayInt[loopn]=null;
	
	}
	
///////////////////////////////////	
	
	function proc(countTR){
	var str1=strTR[countTR-1];
	textRight.Text = str1;
	var str2=strTRT[countTR-1];
	textRight.SetValue("Canvas.Top", str2);
	str2=strTRL[countTR-1];
	textRight.SetValue("Canvas.Left", str2);
	imageRight.source = "";
	}
	
function showImage(sender){
var canvasImage=sender.findName("canvaImageMedia1");
var media=sender.findName("media");
media.SetValue("Canvas.ZIndex", 2);
canvasImage.SetValue("Canvas.ZIndex", 3);
var a=sender
var t=setTimeout("returnToMedia('a')",5000);
}
function returnToMedia(sender){
alert("5sec");
var canvasImage=sender.findName("canvaImageMedia1");
var media=sender.findName("media");
media.SetValue("Canvas.ZIndex", 3);
canvasImage.SetValue("Canvas.ZIndex", 2);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		

//update List from file
function ListUpdatedFile (xml){
var name; 
var counter=0; 
var	settingsDoc1 = xml;
var atrib;	
var	mediaCols=xml.getElementsByTagName( "LineNum" ); 
if(mediaCols.length==0){      
       var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
       xmlDoc.async="false";
       xmlDoc.load("RssData.xml");
       mediaCols = xmlDoc.getElementsByTagName('ScrollTxt');
       }
       
    if(mediaCols.length>0) { 
    maxListNew=mediaCols.length;       
	for( var i=0; i<mediaCols.length;i++){
	if(mediaCols[i].firstChild!==null){
	 strListNew[counter]=mediaCols[i].firstChild.nodeValue;	
	 counter++;
	 } 
	 else {maxScrollNew--;} 
	 }
	 } 
}

function ScrollUpdated (xml){
var name; 
var counter=0; 
var	settingsDoc1 = xml;
var atrib;	
var	mediaCols=xml.getElementsByTagName( "ScrollTxt" ); 
if(mediaCols.length==0){      
       var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
       xmlDoc.async="false";
       xmlDoc.load("RssData.xml");
       mediaCols = xmlDoc.getElementsByTagName('ScrollTxt');
       }
       
    if(mediaCols.length>0) { 
    maxScrollNew=mediaCols.length;       
	for( var i=0; i<mediaCols.length;i++){
	if(mediaCols[i].firstChild!==null){
	 strScrollNew[counter]=mediaCols[i].firstChild.nodeValue;
	 atrib=	mediaCols[i].attributes;	 
	 if(mediaCols[i].attributes!==null&&atrib.getNamedItem("shift")!==null){	
	 strScrollshiftNew[counter]=atrib.getNamedItem("shift").nodeValue;
	 }	
	 else {
	 strScrollshiftNew[counter]=1;
	}	
	 counter++;
	 } 
	 else {maxScrollNew--;} 
	 }
	 } 
}



//update RSS from main Appl raeding file.  funct. are call by main appl
	function updateRss(){	
    var tv2=GetXml( "RssData.xml", ScrollUpdated );
    var t=setTimeout("changeRssFlag()",100);   
    return 1;
	}
	
	function changeRssFlag(){	  
    flagScroll=1;    
	}	
	function updateScrollvar(){
	if(maxScrollNew!==0){
	maxScroll=maxScrollNew;
	for(var i=0;i<maxScroll;i++){
	strScroll[i]=strScrollNew[i];	
	 //TO DO CHECK FOR NULL
	strScrollshift[i]=strScrollshiftNew[i];	
	}
	countScroll=0;
	}
	flagScroll=0;
	}
//End update RSS 

//update List raeding file  funct. are call by main appl NOT ACTIVE NOW
	/*function updateList(){	
    var tv2=GetXml( "DataList.xml",ListUpdated );
    var t=setTimeout("changeListFlag()",102);   
    return 1;
	}	
	function changeListFlag(){	  
    flagList=1;
	}	
	function updateListvar(){	
	if(maxListNew!==0){
	maxList=maxListNew;	
	for(var i=0;i<maxList;i++){
	strList[i]=strListNew[i];	
	}	
	}
	flagList=0;
	}*/
	
	function updateList(strListIn){	   
    var t=setTimeout("changeListFlag()",101); 
    strListNew=strListIn;
   
	}	
	function changeListFlag(){	  
    flagList=1;
	}	
	function updateListvar(){
	
	if(counterListIdle<4){	
	strList=strListNew[counterListIdle];	
	counterListIdle++;
	}
	else
	{	
	  counterListIdle=0;
	  strList=strListNew[counterListIdle];	 
	  counterListIdle++;
	}
	
	}
//End update LIST from main Appl
//SCROLL
function beginScroll(){
      var strLenth; 
   var xs; 
   if(flagScroll==1){updateScrollvar();} 
   if(maxScroll!==0){
     if(countScroll!==maxScroll){
	     countScroll=countScroll+1;	
	    }
	     else{	
	    countScroll=1;		
	    }
	// interop...
	//window.external.ZoneMediaChanged("MSG",countScroll);///////////////////////////////////
	// ...interop
	 var lenthatr=parseInt(strScrollshift[countScroll-1]);	  
	 if(lenthatr<=0)	 {
	 xS=lenthatr;
	  
	 }
	 else{ 
	 strLenth=strScroll[countScroll-1].length;
	 xS= xScroll(strLenth);
	 }
	  
	 var timeS= timeScroll(xS);
	 var strS=strScroll[countScroll-1];	
	 textScroll.Text=strS;
	 SetScroll.To=xS;
	 SetScroll.Duration=timeS;	
	 }
	else {
	 textScroll.Text=strScrollIn;
	 SetScroll.To= scrollToIn;
	 SetScroll.Duration=scrollTimeIn;	 
	 }		
	AnScroll.Begin();   
 }      
  //LEFT
     function ReDrawLeft(){	
	   imageLeftIn.Source="";
	   textLeft.Text="";   
	   //var parName=window.external.LeftChanged();
	   ////TEST VALUES//TO COMENT ////
	   var parName="[NUL]";	  
	   ////////////////
	   var sl=parName.length;
	   var parType=parName.substr(0,5);	   	 
	   if(parType=="[NUL]")
	   {
	   ReDrawLeftLocal();
	   }
	   else{
	   parName=parName.substr(5,sl-5);
	   imageLeft.Source=parName;	   
	   SetMesrectLeft.From=0;
	   SetMesrectLeft.To=356;

	// interop...
	//window.external.ZoneMediaChanged("AD",parName);////////////////////////////////////////
	// ...interop

	   AnSetMesrectLeft.Begin();
	   AnImLeft.Begin();
	   if(parName="images/logozoom.png")
	   {
	     textLeft.Text="www.zoominfosystems.com";
	     AnTextLeft.Begin();  
	   }
	   }	  
	}
	
	 function ReDrawLeftLocal(){
	   
	   var PassCount;
	   SetMesrectLeft.From=0;
	   SetMesrectLeft.To=356;
	   AnSetMesrectLeft.Begin();     
	   var animIm=0;
	   var animT=0;	    
	   if(countIL!==maxIL)
	   {
	     countIL++;	
	   }
	   else
	   {	
	    countIL=1;		
	   }
	 
	   var ImageName=strIL[countIL-1];
	   var Folder=ImageName.substring(0,7);
	   //PassCount=countIL;
       if(Folder=="weather"){
      
       
	// interop...
	//window.external.ZoneMediaChanged("AD","radar");////////////////////////////////////////////////
	// ...interop

	   ShowWeatherMap();
	   
	   
	  
	   }// end if weather
	   else{
	  
	   RedrawLeftLocal1();
	   
	   	   
	   }
	   }

	   
	  
	   
	   
	   function ShowWeatherMap(){
	   countWeather=0;
	  
	  // imageLeft.Source=strIL[PassCount-1];
	   AnImLeft.Begin();	    
	   tInterval=setInterval("changeWeatherImage()",rotateWeatherT);
	  
	   }
	   
	   
	   function   changeWeatherImage(){	  
	   
	   imageLeft.Source=strWeather[countWeather];
	   countWeather++;
	   if(countWeather==maxW){
	   if(loopNum!==loopMax-1)
	   {
	   loopNum++;
	   countWeather=0;
	   }
	   else{
	  
	   clearInterval(tInterval);	   
	   tInterval=null;
	   loopNum=0;
	   countWeather=0;
	   //alert("kkk");
	   
	   }
	   }
	   }

	   
	  function RedrawLeftLocal1(){
	  var animIm=0;
	   var animT=0;	 
	 
	   imageLeft.Source=strIL[countIL-1];
	// interop...
	//window.external.ZoneMediaChanged("AD",strIL[countIL-1]);///////////////////////////////////////////////
	// ...interop

	   //set The Image size	 
	   var setSize=0;
	   if(setSize==1){  
	   imageLeft.Height=360;	   
	   imageLeft.SetValue("Canvas.Top", "20");   
	   imageLeft.SetValue("Canvas.Left", "20");
	   WidthLeft.SetValue("Value","325");
	   }	    
	   var num=searchSyncLeft(countIL-1);
	   
	   if(num!==-1){
	    //if text or image present
	    var posImIn=strSL[num+1];
	    if(posImIn!==1000){
	    imageLeftIn.Source=strILin[posImIn];
	    animIm=1;
	    }
	    var posT=strSL[num+2];
	    if(posT!==1000){
	    textLeft.Text=strTL[posT];
	    animT=1;
	    }
	    }//end if 
	       
	    AnImLeft.Begin();
	    if(animIm==1)
	    {	    
	      SetLogoX.Begin();
	    }
	    if(animT==1)
	    {
	      AnTextLeft.Begin();  
	    }
	  
	}	
	
 function searchSyncLeft(position){
 var num=-1;
 for(var i=0; i<strSL.length; i=i+3){
   if(position==strSL[i]){
      num=i;
   }
 }
 return num;
 }
 //END LEFT 
 function weatherOff(){
 weatherFlag=1;
 } 
 function weatherOn(){
 weatherFlag=0;
 }    
	   
	
		
	

