// JavaScript Document


function setTab(obj)
{
	//alert('coming');
	obj.style.cursor=  "Pointer";
	//alert ("url('images/" + obj.id + "_over.jpg')");
	obj.style.backgroundImage = "url('images/" + obj.id + "_over.jpg')";
	
	if(obj.id == 'about')
	{
		//alert('comin');
		//obj.style.backgroundImage = "url('images/" + obj.id + "_over.jpg')";
		document.getElementById("aboutstrip").style.display = "inline";
			document.getElementById("portfoliostrip").style.display = "none";
	}
	else if(obj.id == 'portfolio')
	{
		//alert(obj.id);
		//document.getElementById("portfoliostrip").style.display = "inline";
		document.getElementById("portfoliostrip").style.display = "block";
		document.getElementById("aboutstrip").style.display = "none";
	}
	
}

function resetTab(obj)
{
	
	obj.style.backgroundImage = "url('images/" + obj.id + "_back.jpg')";
	
	if(obj.id == 'about')
	{
	document.getElementById("aboutstrip").style.display = "none";
	}
	else if(obj.id == 'portfolio')
	{
		document.getElementById("portfoliostrip").style.display = "none";
	}
	
}

function openTab(obj)
{
	window.open(obj +".html","_self");
	
}

function hoverImg(obj)
{
	obj.style.cursor=  "Pointer";
	obj.style.backgroundImage = "url('images/" + obj.id + "_over.gif')";
}

function normalImg(obj)
{
	obj.style.backgroundImage = "url('images/" + obj.id + "_back.gif')";
}

function openDownload()
{
    window.open("pdfdownload.php", "_self");
}


var srcId;
function openSubPage(pageURL, subtabURL, subtabButton)
{
	//document.getElementById(subtabButton).style.display = "block";
	//alert(subtabButton);
//document.getElementById(subtabButton).style.backgroundImage = "url('images/" + subtabButton+ "_over.jpg')";
    window.open (pageURL + ".html?subtab=" + subtabURL + "=" +subtabButton, "_self");
	
	//document.getElementById(id).styel.backgroundImage = "url('images/" + id + "_over.jpg')";
}


/*function openSubPage(pageURL, subtabURL)
{

    window.open (pageURL + ".html?subtab=" + subtabURL, "_self");
}*/




var homeTab = "overall";
var curArrayIndex = 0;
var curArrayIndexNext = 1;
var curArrayMax = 5;
var timeoutId;

var curdecreasePos = 911;
var curincreasePos = 0;
var iLoopCount = 0;
var setText = 0;

   
   
   var overall_Picture = new Array("web_1.png","web_2.jpg","web_3.jpg","web_4.jpg","web_5.jpg");
  
  
  
  
function navigatePicture(currentTab)
{
	//alert('comin');
    var stopStatus = "false";
    window.clearInterval(timeoutId);
    window.clearTimeout(timeoutId);
    
  
  /*  if (setText == 1)
    {
        document.getElementById("firstPicture").style.display = "none";
        document.getElementById("secondPicture").style.display = "none";
        document.getElementById("newline_text").style.display = "block";
        timeoutId = window.setInterval("increamentiLoopCount('newlineText');", 100);
    }
    else
    {
        document.getElementById("firstPicture").style.display = "block";
        document.getElementById("secondPicture").style.display = "block";
        document.getElementById("newline_text").style.display = "none";    
    } */
    
    
    curdecreasePos = 911;
    curincreasePos = 0;
    
    if (currentTab != homeTab)
    {
        homeTab = currentTab;
        setText = 0;
        curArrayIndex = 0;
        curArrayIndexNext = 1;
         if (currentTab == "overall" )
        curArrayMax = 5;
       // else if (currentTab == "web" )
          //  curArrayMax = 8;
       // else if (currentTab == "graphic" )
            //curArrayMax = 5;
      //  else if (currentTab == "corporateid")
           // curArrayMax = 5;
     //   else if (currentTab == "threeddesign")
           // curArrayMax = 3;
        document.getElementById("firstpicture").style.width = "911px";
        document.getElementById("secondpicture").style.width = "0px"; 
        
       // document.getElementById("web").style.backgroundImage = "url('images/home/homeTab.gif')";
       // document.getElementById("graphic").style.backgroundImage = "url('images/home/homeTab.gif')";
       // document.getElementById("corporateid").style.backgroundImage = "url('images/home/homeTab.gif')";
       // document.getElementById("threeddesign").style.backgroundImage = "url('images/home/homeTab.gif')";
        
        if (homeTab != "overall")
        document.getElementById(homeTab).style.backgroundImage = "url('images/home/homeTab_over.gif')";
    }
   
    document.getElementById("firstpicture").style.width = "911px";
    document.getElementById("secondpicture").style.width = "0px";
    
    document.getElementById("firstpicture").style.backgroundImage = "url('images/" + eval ( homeTab + "_Picture[" + curArrayIndex + "]"  ) + "')";
  //  document.getElementById("firstText").innerHTML = eval( homeTab + "_Text[" + curArrayIndex + "]" );
   // alert("url('images/" + eval ( homeTab + "_Picture[" + curArrayIndex + "]"  ) + "')");
    document.getElementById("secondpicture").style.backgroundImage = "url('images/" + eval ( homeTab + "_Picture[" + curArrayIndexNext + "]" )+ "')";
    
    if (setText == 0)
    timeoutId = window.setInterval("increamentLoop();", 15);
        
    
    if (setText == 1)
    {
    if (window.navigator.appName == "Microsoft Internet Explorer")
    timeoutId = window.setTimeout("movePicture();", 150);
    else
    timeoutId = window.setTimeout("movePicture();", 1);
    }
}

function increamentLoop()
{
	
    if (iLoopCount == 40)
    {
		
        iLoopCount = 0;
        window.clearInterval (timeoutId);
		
         setText = 1;
        navigatePicture(homeTab);
     
       
    }
    else
    {
         
		iLoopCount++;
		
    }
        
}

  
  

function movePicture()
{
	
    if (window.navigator.appName == "Microsoft Internet Explorer")
    {
	
        curdecreasePos = curdecreasePos - 50;
        curincreasePos = curincreasePos + 50;
        if (curdecreasePos < 50)
        {
			
            curdecreasePos = 0;
            curincreasePos = 911;
        }
    }
    else
    {
		
        curdecreasePos = curdecreasePos - 3;
        curincreasePos = curincreasePos + 3;
        if (curdecreasePos < 3)
        {
            curdecreasePos = 0;
            curincreasePos = 911;
        }    
    }
    
    
    
    document.getElementById("firstpicture").style.width = curdecreasePos + "px";
    document.getElementById("secondpicture").style.width = curincreasePos + "px";
    
   /* if (curdecreasePos < 150)
    {
     document.getElementById("firstText").innerHTML = eval( homeTab + "_Text[" + curArrayIndexNext + "]" );
    }*/
    
    if (curdecreasePos == 0)
    {
        window.clearTimeout(timeoutId);
    //    document.getElementById("firstText").innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + eval( homeTab + "_Text[" + curArrayIndex + "]" );
        timeoutId = window.setInterval("increamentiLoopCount();", 10);
       
    }
    else
    {
 
    if (window.navigator.appName == "Microsoft Internet Explorer")
        timeoutId = window.setTimeout("movePicture();", 150);
    else
        timeoutId = window.setTimeout("movePicture();", 1);
     
    }
        
}

function increamentiLoopCount()
{   

        if (iLoopCount == 500)
        {   
            
            window.clearInterval(timeoutId);
			
            iLoopCount = 0;

           // if (srcTab == "normal")
        //    {
            curArrayIndex = curArrayIndex + 1;
    
            if (curArrayIndex > curArrayMax)
                curArrayIndex = 0;
                 
            curArrayIndexNext = curArrayIndexNext + 1;
            
            if (curArrayIndexNext > curArrayMax)
                curArrayIndexNext = 0;
            // }
           //  else
           //  setText = 0;
            navigatePicture(homeTab);
         }  
         else
            iLoopCount++;
			
}