 var varTimer=0;
 var varScrolled=0;
 var varBladeScrollin=0;

 var arrImages=new Array();
 
 function fnRollIn(button){
  document.getElementById(button).src="images/2_"+ button +".jpg";
 }

 function fnRollOut(button){
  document.getElementById(button).src="images/1_"+ button +".jpg";
 }
 
 function fnMouseDown(button){
  document.getElementById(button).src="images/3_"+ button +".jpg";
 }
 
 function fnRollInArrows(tmpId){
  if(varScrolled==0){ 
   if(tmpId=='idArrowRight'){
	  button="right_arrow";
	 } else {
	  button="left_arrow";
	 }
   document.getElementById(tmpId).src="images/over_"+ button +"jpg";
	}	
 }
 
 function fnRollOutArrows(tmpId){
  if(varScrolled==0){
   if(tmpId=='idArrowRight'){
	  button="right_arrow";
	 } else {
	  button="left_arrow";
	 } 
   document.getElementById(tmpId).src="images/"+ button +".jpg";
	}	
 }  

 function fnDoScrollRight(){
  if(varScrolled<560){
	 varScrolled=varScrolled+1;
   tmpScrollBy=1;
   document.getElementById("idPortfolio").scrollLeft=document.getElementById("idPortfolio").scrollLeft+tmpScrollBy;
   clearTimeout(varTimer);
   varTimer=setTimeout('fnDoScrollRight();', 1);

	 if(document.getElementById("idPortfolio").scrollLeft >= 1680){
	  document.getElementById('idArrowRight').style.display="none";
	 }	 

	} else {
	 clearTimeout(varTimer);
	 varScrolled=0;
	 fnRollOutArrows('idArrowRight');
	} 
 } 
 
 function fnScrollRight(){
  if((varScrolled==0)&&(document.getElementById("idPortfolio").scrollLeft != 1680)){ 
	 document.getElementById('idArrowLeft').style.display="block";
   clearTimeout(varTimer);
   varTimer=setTimeout('fnDoScrollRight();', 1);
	}
 }

 function fnDoScrollLeft(){
  if(varScrolled<560){
	 varScrolled=varScrolled+1;
   tmpScrollBy=1;
   document.getElementById("idPortfolio").scrollLeft=document.getElementById("idPortfolio").scrollLeft-tmpScrollBy;
   clearTimeout(varTimer);
   varTimer=setTimeout('fnDoScrollLeft();', 1);

	 if(document.getElementById("idPortfolio").scrollLeft <= 0){
	  document.getElementById('idArrowLeft').style.display="none";
	 }	 

	} else {
	 clearTimeout(varTimer);
	 varScrolled=0;
	 fnRollOutArrows('idArrowLeft');	 
	} 
 } 
 
 function fnScrollLeft(){
  if((varScrolled==0)&&(document.getElementById("idPortfolio").scrollLeft != 0)){
	 document.getElementById('idArrowRight').style.display="block";	
   clearTimeout(varTimer);
   varTimer=setTimeout('fnDoScrollLeft();', 1);
	}
 }
 
 function fnPortfolioLoad(){
  document.getElementById("idPortfolio").scrollLeft=0;
  document.getElementById('idArrowLeft').style.display="none";		
 }
 
 function fnBlade(tmpId){
  if(varBladeScrollin==0){
    varBladeScrollin=1;
    
  	switch(tmpId){
  	 case 'WebDevelopment' : document.getElementById('idHR'+tmpId).style.display="block";
  	  break;
  	}
   
    document.getElementById('idContent'+tmpId).style.display="block";
    document.getElementById('idBackToTop'+tmpId).style.display="block";	
  	
  	fnDoScrollBlade(tmpId);
	}
 }
 
 function fnDoScrollBlade(tmpId){

	switch(tmpId){
	 case 'GraphicDesign' : tmpTop=16;
	  break;
	 case 'WebDevelopment' : tmpTop=76;
	  break;
	 case 'CMS' : tmpTop=138;
	  break;				
	} 
	
  if(document.getElementById('idBladeWrap').scrollTop<tmpTop){
   tmpScrollBy=1;
   document.getElementById('idBladeWrap').scrollTop=document.getElementById("idBladeWrap").scrollTop+tmpScrollBy;
   clearTimeout(varTimer);
   varTimer=setTimeout('fnDoScrollBlade("'+tmpId+'");', 1);
	} else {
	 clearTimeout(varTimer);
	 varBladeScrollin=0;
	 fnServiceRollOut(tmpId);
	} 
 }  

 function fnScrollBackBlades(){

  tmpTop=0;

  if(document.getElementById('idBladeWrap').scrollTop>tmpTop){
   tmpScrollBy=1;
   document.getElementById('idBladeWrap').scrollTop=document.getElementById("idBladeWrap").scrollTop-tmpScrollBy;
   clearTimeout(varTimer);
   varTimer=setTimeout('fnScrollBackBlades();', 1);
	} else {
	 clearTimeout(varTimer);
	 varBladeScrollin=0;
	} 
 } 
 
 function fnCloseBlades(){
  if(varBladeScrollin==0){
	varBladeScrollin=1;
    document.getElementById('idContentGraphicDesign').style.display="none";
    document.getElementById('idContentWebDevelopment').style.display="none";
    document.getElementById('idContentCMS').style.display="none";
    document.getElementById('idBackToTopGraphicDesign').style.display="none";
    document.getElementById('idBackToTopWebDevelopment').style.display="none";
    document.getElementById('idBackToTopCMS').style.display="none";
    document.getElementById('idHRWebDevelopment').style.display="none";
    fnScrollBackBlades();	
	}
 }
 
 function fnServiceRollIn(button){
  if(varBladeScrollin==0){
   document.getElementById(button).src="images/over_"+ button +".gif";
	}
 }

 function fnServiceRollOut(button){
  if(varBladeScrollin==0){ 
   document.getElementById(button).src="images/"+ button +".gif";
	}
 }
