﻿// JScript File


var step = 0;
var change = 0;
var Repitation = 0;
var laststep = 78; // pos.length;
var id;
var newpos;
var leftR=560;
var leftL=360;
var topR=300;
var topL=300;
var left=60;
var NoofSelCards=0;
var SelCard1="";
var SelCard2="";
var SelCard3="";
var Deck= new Array(78); 
        

var timer;

function PageLoad()
{
    var i;
        for ( i = 0; i <= 77; i++)
        {
            Deck[i] = i;
        }
        shuffle(Deck);
}

function animate()
{
   window.document.getElementById("BtnShuffel").disabled ="true";
   if(step == (laststep) || Repitation == 1 )
    {
        if ( Repitation == 0) 
            {
                step = 0;
            }
                
        Repitation = 1;
        //alert("Over");
        if(step < (laststep))
        {
        id = "card" + (step);
        window.document.getElementById(id).style.left = left;
        window.document.getElementById(id).style.top = 150;
        left=left+10;
        }
    }    
   id = "card" + (step);
   if (Repitation == 0 )
    {
        if ((step % 2) == 0)
        {
            window.document.getElementById(id).style.left = leftR;
            window.document.getElementById(id).style.top = topR;
            leftR=leftR+1;
            topR=topR+1;
        }
        else
        {
            window.document.getElementById(id).style.left = leftL;
            window.document.getElementById(id).style.top = topL;
            leftL=leftL-1;
            topL=topL+1;
        }    
    }
   timer = setTimeout("animate()",50);
   step++;

}


function stopAnimation()
{
    //alert("Animation stoped");
    clearTimeout(timer);
    change = 0;
    step =0;
    Reset();
    window.document.getElementById("BtnShuffel").disabled =""; 
         
}



function playSound(name)
{
   sound.location.href=name;
}


function movetoFront(card)
{
  for (var i = 0; i <= 77; i++)
  {
    var id = "card" + i;
    if(card.id == id) document.getElementById(id).style.zIndex = 77;
    else
    {
       var index = document.getElementById(id).style.zIndex;
       if(index > 0) document.getElementById(id).style.zIndex = index - 1;
    }
  }
}

function movetoBack(card)
{
  for (var i = 0; i <= 77; i++)
  {
    var id = "card" + i;
    if(card.id == id) document.getElementById(id).style.zIndex = 0;
    else
    {
       var index = document.getElementById(id).style.zIndex;
       if(index < 9) document.getElementById(id).style.zIndex = index + 1;
    }
  }
}


function StartAni()
{
    var i;
    var temp="";
   Repitation=0;
   leftR=560;
   leftL=360;
   topR=300;
   topL=300;
   left=60;
   step=0;    
   shuffle(Deck);
   Reset();
   animate();
   setTimeout("stopAnimation()",10000);

}


function ChangeBak(card)
{
     document.getElementById(card.id).style.border= "red thin solid";
     id = "ContentTitle";
     if (card.id == "Img1")
        { 
        document.getElementById(id).value="Divisions";
        document.getElementById("ContentTxt").value= "JISL manufactuers wide range of products and to complement the range, we represent world renowned global players, in India. Today, we have five business divisions to cater to varied needs of industry.";
        }   
        
     if (card.id == "Img2" )
        {
        document.getElementById(id).value="The Company";  
        document.getElementById("ContentTxt").value= "JAY INSTRUMENTS & SYSTEMS PVT. LTD., ( JISL ) started in the year 1987 as an Electronics Division of Jaysynth group, derives its strength from the entrepreneurial vision of our Chairman Shri Sharadbhai Kothari. Jaysynth Group, founded in the year 1971, started with a humble beginning of manufacturing “Dyes and Pigments” and the co. in no time became a known name in the field.  All this was made possible with the quality products and meeting the expectations of our customers from competitive prices to prompt shipments to after sales service.";
        }    
            
    if (card.id == "Img3")
        { 
            document.getElementById(id).value="D & D"; 
            
            document.getElementById("ContentTxt").value= "JISL believes in technology upgradation to meet customers’ demanding needs and price expectation. We invest significant portion of our earnings in D&D. We have a team of Design and Software Engineers, who work in tandem with Projects & Application Engineers to develop customer focused solutions.";
        }                                     
    if ( card.id == "Img4" )
        {
         document.getElementById(id).value="ISO";
         document.getElementById("ContentTxt").value= "IT is ISO certified company";  
        }   
    if (card.id == "Img5" )
        {
         document.getElementById(id).value="Philosophy";
         document.getElementById("ContentTxt").value= "We believe in a “THINK BIG” philosophy and its our dream to excel in whatever we do to meet the expectations of the customer offering the best quality products and value for money.  Continuous efforts are on to maintain the faith kept on us by our customers. We value concerns of our esteemed customers as they are the one who keeps us in business.";   
         }
     if ( card.id == "Img6" )
        { 
         document.getElementById(id).value="Network"; 
         document.getElementById("ContentTxt").value= "With its Headquarters at Mumbai, the products are  sold/serviced through its branch offices in Mumbai , Chennai, Ahmedabad, New Delhi and Hubli.Besides these offices, associates/dealers, Resident Engineers have been appointed in many of the major cities / towns of India. All these locations ensure close proximity with our customers to extend prompt and efficient service and fulfill customers’ expectations of quick response.New territories are constantly being explored to increase our Sales / Service network.";
         }
     if ( card.id == "Img7" )
        { 
         document.getElementById(id).value="Compititive Edge";
         document.getElementById("ContentTxt").value= "LEARNING…….We believe that the future belongs to those who adapt to the ever changing business environment and only those organizations which adapt faster through “Learning “ stays ahead.Our organization has the commitment and always keen to learn with a focus on innovation, improved performance to create a competitive edge."; 
        }   
    if  ( card.id == "Img8" )
        { 
         document.getElementById(id).value= "The People";
         document.getElementById("ContentTxt").value= "People are our greatest “Assets”. Our organization is professionally managed  and at the core of the company, we are proud to have well qualified people having knowledge and experience in all aspects of their domain.  All the responsible people in various departments have earned their positions in the company by their sheer hard work and performance. Our people are committed to a high standards of customer service with courteous and knowledgeable technical support thereby maintaining a long term relationships."; 
         }             
}

function NormalBak(card)
{
     document.getElementById(card.id).style.border= "gray thin solid";

}

function DisplayLoc(Obj)
{
    //if ( document.getElementById(Obj.id).selectedindex.value == 1)
        id=document.getElementById(Obj.id).options[document.getElementById(Obj.id).selectedIndex].value;
        
         
        if ( id == "Delhi")
        {
            //document.getElementById("BranchAddr").value ="809, Arunachal Building, 19 Barakhamba Road,    New Delhi- 110001.    Tel: 011-23713490/ 23737993              Fax: 011-23713490";
            document.getElementById("BranchAddr").value ="809, Arunachal Building, 19 Barakhamba Road,    New Delhi- 110001.";
        } 
        if ( id == "Mumbai")
        {
            //document.getElementById("BranchAddr").value ="E-16, Everest, Tardeo Road, Mumbai- 400034. Tel: 91-22-235226207 Fax: 91-22-23526210";
            document.getElementById("BranchAddr").value ="E-16, Everest,     Tardeo Road,        Mumbai- 400034.";
        } 
        if ( id == "Ahmedabad")
        {
            //document.getElementById("BranchAddr").value ="606, Anand Mangal Complex- 111,          Opp. core House, Ambavadi, Ahmedabad- 380006.                Tel: 079 - 26463981      Fax: 079 - 26460234";
            document.getElementById("BranchAddr").value ="606,                Anand Mangal Complex-111,Opp. core House, Ambavadi,       Ahmedabad- 380006.";
        } 
        if ( id == "Chennai")
        {
            //document.getElementById("BranchAddr").value ="JVL Arcade, 3rd floor, 199 North Usman Road, T.Nagar,          Chennai- 600017.     Tel: 044-28142429/ 28142911             Fax: 044 28142429";
            document.getElementById("BranchAddr").value ="JVL Arcade, 3rd floor, 199 North Usman Road,  T. Nagar,          Chennai- 600017.";
        } 
        if ( id == "Hubli")
        {
            //document.getElementById("BranchAddr").value ="27, 2nd floor, Laxmi Complex, Neeligin Road, Hubli- 480029.       Tel: 0836- 2352678      Fax: 0836- 2254946";
            document.getElementById("BranchAddr").value ="27, 2nd floor,        Laxmi Complex,     Neeligin Road,      Hubli- 480029.";
        } 
        if ( id == "Tirupur")
        {
            //document.getElementById("BranchAddr").value ="S.F. No. 106, Parapalayam, Mangalam Road, Tirupur- 641604. Tel: 0421- 2241403";
            document.getElementById("BranchAddr").value ="S.F. No. 106, Parapalayam,     Mangalam Road,    Tirupur- 641604.";
        }    
}

function CardSelected(card)
{   
        var TempVar="";
        NoofSelCards=NoofSelCards+1;
        TempVar=card.id;
        TempVar=Deck[TempVar.substring(4,TempVar.length)];
        
        if (NoofSelCards > 3)
        {
            if ((TempVar)== SelCard1 ||(TempVar)== SelCard2 ||(TempVar)== SelCard3 )
            {
                window.document.getElementById("txtMsg").value="";
            }
            else
            {
                window.document.getElementById("txtMsg").value="Plase select only 3 cards.";  
            }    
        }
        else
        {
            window.document.getElementById("txtMsg").value="";
            if (NoofSelCards == 1)
            {
                window.document.getElementById(card.id).style.left = 250;
                SelCard1= card.id;
                SelCard1=Deck[SelCard1.substring(4,SelCard1.length)];
            }
             if (NoofSelCards == 2)
            {
                window.document.getElementById(card.id).style.left = 400;
                SelCard2= card.id;
                SelCard2=Deck[SelCard2.substring(4,SelCard2.length)];
            }
             if (NoofSelCards == 3)
            {
                window.document.getElementById(card.id).style.left = 550;
                SelCard3= card.id;
                SelCard3=Deck[SelCard3.substring(4,SelCard3.length)];
            }  
            window.document.getElementById(card.id).style.top = 300;  
        }   
}

function Reset()
{
  window.document.getElementById("txtMsg").value="" 
  NoofSelCards=0;
  SelCard1= "";
  SelCard2= "";
  SelCard3= "";
  var Templeft=60;  
  for (var k = 0; k <= 77; k++)
  {
    var id = "card" + k; 
    window.document.getElementById(id).style.left = Templeft;
    window.document.getElementById(id).style.top = 150;
    Templeft=Templeft+10;
   } 
}

function NextPage()
{
    if ( SelCard1 == "" || SelCard2 == "" || SelCard3 == "")
    {
      window.document.getElementById("txtMsg").value="Please select 3 cards.";  
    }
    else
    {
     //window.document.getElementById("txtMsg").value=SelCard1 + "  " + SelCard2 + "  " +SelCard3;  
     window.location="/Tarot78/AspxFiles/SelectedTarot.aspx";
     

    }
    ShowSession()
}




shuffle = function(o){ //v1.0
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};

function ShowSession()
{
var colorHolder = document.getElementById("hdfMyColor");
var color = colorHolder.value;
//alert(color);
}