var activePage=0;
var xmlDoc;
var FirstTime=1;
var readyToChange=0;
var Counter=0;




	 


 function MovePav(str){
       
	   if(document.getElementById('image')){ image1=document.getElementById('image'); idnew="newimage"; idold="image"; }
	   if(document.getElementById('newimage')){ image1=document.getElementById('newimage'); idnew="image"; idold="newimage";  }
       
	   client1=document.getElementById('client');
       project1=document.getElementById('project');
       description1=document.getElementById('description');
	   

      
       
       //newimage=document.createElement('img');
	   newimage=new Image();
       newimage.setAttribute('id',idnew);    
	   
       
       
	   
	   if(str=="next"){ activePage++; }
	   if(str=="prev"){ activePage--; }
	   if(activePage>=IMAGE.length){ activePage=IMAGE.length-1;  return ;}
       if(activePage<0){ activePage=0; return ;}
	  
       container=document.getElementById('tempCaontainerPav');
       container.style.display="none";
       
       document.getElementById('imagePreloader').style.display="block";	   
            
       if(navigator.appName.search('Microsoft')>=0){ newimage.attachEvent('onload',ApproveChange); }else{
       newimage.setAttribute('onload','ApproveChange()'); }
       
       
       newimage.src=IMAGE[activePage];
      
       
       if(document.getElementById('theMotherLoad')){   oldlink=document.getElementById('theMotherLoad'); lkold="theMotherLoad"; lknew="newMotherLoad"; }
	   if(document.getElementById('newMotherLoad')){   oldlink=document.getElementById('newMotherLoad'); lnold="newMotherLoad"; lknew="theMotherLoad"; }
       
       obj=document.getElementById('beforTable');
	   
	
	   link=document.createElement('a');
       link.setAttribute('id',lknew);
       link.setAttribute('href',LINKS[activePage]);  
	   link.setAttribute('target',"blank");
       link.appendChild(newimage);
       
       container.removeChild(oldlink);
	   container.insertBefore(link,obj);
       
       
       ImageWork();
       // setTimeout('ImageWork("'+idnew+'")',1000);
	   
	
      }
      
function ApproveChange(){
	
	readyToChange=1;
	
}
      
function ImageWork(){
	   
	if(readyToChange==1){
       
       
       
       container=document.getElementById('tempCaontainerPav');
       
       

        
	  	
	    
	    document.getElementById('imagePreloader').style.display="none";
	    container.style.display="block";
	   ShowNextPav(); }else{ setTimeout('ImageWork()',100);  }
	   }
	
	



function ShowNextPav(){
	FirstTime=0;   
	
       
	   client1=document.getElementById('client');
       project1=document.getElementById('project');
       description1=document.getElementById('description');
       
       
	
       
	   client1.innerHTML=CLIENT[activePage];
	   project1.innerHTML=PROJECT[activePage];
	   description1.innerHTML=DESCRIPTION[activePage]; 
	  
	   readyToChange=0;
     
} 