/* 0 - Search
1 - Results
2 - Report Used Sales
3 - Edit Ownership Information
4 - Edit Customer Information
5 - Communication
6 - Owner History
7 - Household
8 - Family Key
9 - Administration
10 - Online Log */

var tabsHeaderTable;
var selectedTabIndex;
var selectedTabID;
var selectedTabName;

function loadtabs()
{   //alert(" currentTab:" + currentTab) + "loadtabs:" + document.forms[0].name);
    
    var currentTab = document.forms[0].currentTab.value;
    var lang       = document.forms[0].language.value;
    //alert("loadtabs() currentTab:" +  currentTab + " lang:" + lang);
    
    var tabNames;
    if(lang == "fr" || lang == "French")
       tabNames = new Array("Recherche","Résultats","Le rapport A Utilisé Vente","Editer les Informations de Possession","Editer Informations Clientèles","Communication","Histoire de propriétaire","Ménage","Familie Key","Adminstration","Journal en ligne");
    else
	tabNames  = new Array("Clearance","New Arrival","BridalCollection","Kid Dresses", "Men's Wear","Ponchos and Shawls", "Kurtis", "Suit", "Skirts", "Lenghas", "Sarees", "Chania Choli", "Jewelry", "Accessories", "Contact", "Return Policy" );
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
	    //alert("currentTab:" + currentTab);
	    
	    if(currentTab == 0)
	    {
            //alert("currentTab 0 if " + currentTab);
            if(i == 2 || i == 9|| i == 10)
            {
               tabCell.className="tabCell"; 
			   tabCell.onmousedown = tabCellOnMouseDown; 
			   tabCell.onmouseover = tabCellOnMouseOver; 
			   tabCell.onmouseout  = tabCellOnMouseOut;  
            }
            else if(i == 0)
            {
               tabCell.className="tabCellSelected";         
			   tabCell.onmousedown = tabCellOnMouseDown; 
			   tabCell.onmouseover = tabCellOnMouseOver; 
			   tabCell.onmouseout  = tabCellOnMouseOut;  
            }
	    //            else 
            //{
            //   tabCell.className="tabCellDisabled"; 
	    // }
	    }

		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onclick     = tabCellOnClick;     
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}

function tabCellOnMouseDown()
{
	tabCell=this;
	if(tabCell.className=="tabCellSelected")
		return;
		
	tabCell.className="tabCellMouseDown";
}

function tabCellOnMouseOver()
{
    var tabId  = this.id;
	var tabCell= this;
	var currClassName = this.clasName;
    //alert(this.className);

	if(tabCell.className=="tabCellSelected") 
	   return;
	tabCell.className="tabCellMouseOver";
}

function tabCellOnMouseOut()
{
   var currentTab = document.forms[0].currentTab.value;
   var tabCell=this;
   var cn = this.className;
   //alert("mouseout cn:" + cn);
	
   if(tabCell.className=="tabCellSelected")
		return;
	
   if(currentTab == 0 && (this.id ==2 || this.id == 9 || this.id == 10))
      tabCell.className="tabCell";
   else
      tabCell.className = "tabCellDisabled";
}

function tabCellOnClick()
{
	var selectTab = this.id;
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	var currentTab = document.forms[0].currentTab.value;
	alert("tabCellOnClick: currentTab:" + currentTab + " selectTab:" + selectTab);
	loadSelectedTab(currentTab,selectTab);	
}

function loadSelectedTab(currentTab,nextTab)
{
   //alert("loadSelectedTab This document contains: " + document.forms.length + " forms.");
      
   //alert("documentform:" + document.forms[0].name + " loadSelectedTab nextTab:" + nextTab);
   if(nextTab == 0){
      url="/cgi/alltest.pl?type=summer_clearance&prodId=101000&pageNo=1";
   }
   if(nextTab == 1){
      url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";
   }
   if(nextTab == 2){
      url="/cgi/alltest.pl?type=bridalcollection^bridewear&prodId=1501000&pageNo=1&tabMenu=bridaltabs";
   }
   if(nextTab == 3){
      url="/cgi/alltest.pl?type=kidsdresses&prodId=1101000&pageNo=1";
   }
   if(nextTab == 4){
      url="?type=mensdresses&prodId=1301000&pageNo=1";
   }
  if(nextTab == 5){
      url="/cgi/alltest.pl?type=ponchosshawls&prodId=1001000&pageNo=1";
   }
  if(nextTab == 6){
      url="/cgi/alltest.pl?type=kurtis^embroidary&prodId=301000&pageNo=1&tabMenu=kurtitabs";
   }
  if(nextTab == 7){
      url="/cgi/alltest.pl?type=suits^25-50&prodId=405000&pageNo=1&tabMenu=suittabs";
   }
 if(nextTab == 8){
      url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";
   }
 if(nextTab == 9){
      url="/cgi/alltest.pl?type=lenghas&prodId=601000&pageNo=1";
   }
 if(nextTab == 10){
      url="/cgi/alltest.pl?type=sarees&prodId=701000&pageNo=1";
   }
 if(nextTab == 11){
      url="/cgi/alltest.pl?type=chaniacholi&prodId=1001000&pageNo=1";
   }
 if(nextTab == 12){
      url="/cgi/alltest.pl?type=jewelry^50off&prodId=818000&pageNo=1&tabMenu=jewelrytabs";
   }
 if(nextTab == 13){
      url="/cgi/alltest.pl?type=accessories&prodId=901000&pageNo=1";
   }
 if(nextTab == 14){
      url="/cgi/contact.pl";
   }
 if(nextTab == 15){
      url="/cgi/return.pl";
   }
   document.location.href=url;
   
  
   
}

function selectTab(tabId)
{
	alert("tabId:" + tabId);
	tabsHeaderTable= document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	for(i=0;i<tabsHeaderCells.length;i++)
	{
	  if(tabsHeaderCells[i].id == tabId)
	     tabsHeaderCells[i].className ="tabCellSelected";
	  else
	     tabsHeaderCells[i].className="tabCell"
	  alert("id:" + tabsHeaderCells[i].id);
	}
}

function bridaltabs(currentTab,lang)
{
    var tabNames;
    if(lang == "fr" || lang == "French")
       tabNames = new Array("S-ID USers","T-Id/Online Log Users","Utilities","Return to CCNA");
    else
       tabNames  = new Array("Bride Wear","Groom Wear","Accessories","Return to Main");
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		//tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onclick     = bridaltabCellOnClick;     
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}

function bridaltabCellOnClick()
{
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	
    if(this.id == 0) url="/cgi/alltest.pl?type=bridalcollection^bridewear&prodId=1501000&pageNo=1&tabMenu=bridaltabs";	
    if(this.id == 1) url="/cgi/alltest.pl?type=bridalcollection^groomwear&prodId=1502000&pageNo=1&tabMenu=bridaltabs";	
    if(this.id == 2) url="/cgi/alltest.pl?type=bridalcollection^bridalaccessories&prodId=1503000&pageNo=1&tabMenu=bridaltabs";	
    if(this.id == 3) url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";	
    document.location.href=url;
}


function kurtitabs(currentTab,lang)
{
    var tabNames;
    if(lang == "fr" || lang == "French")
       tabNames = new Array("S-ID USers","T-Id/Online Log Users","Utilities","Return to CCNA");
    else
	tabNames  = new Array("Embroided","Printed","Cotton","Woolen","Return to Main");
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		//tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onclick     = kurtitabCellOnClick;     
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}

function kurtitabCellOnClick()
{
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	
    if(this.id == 0) url="/cgi/alltest.pl?type=kurtis^embroidary&prodId=301000&pageNo=1&tabMenu=kurtitabs";	
    if(this.id == 1) url="/cgi/alltest.pl?type=kurtis^printed,kurtis^plussize&prodId=303000&pageNo=1&tabMenu=kurtitabs";	
    if(this.id == 2) url="/cgi/alltest.pl?type=kurtis^cotton&prodId=304000&pageNo=1&tabMenu=kurtitabs";	
    if(this.id == 3) url="/cgi/alltest.pl?type=kurtis^woolen&prodId=310000&pageNo=1&tabMenu=kurtitabs";		
    if(this.id == 4) url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";	
    document.location.href=url;
}


function suittabs(currentTab,lang)
{
    var tabNames;
    if(lang == "fr" || lang == "French")
       tabNames = new Array("S-ID USers","T-Id/Online Log Users","Utilities","Return to CCNA");
    else
	tabNames  = new Array("$25-$50","Anarkali","Chudidar","Pantsuit","Salwar","Return to Main");
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		//tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onclick     = suittabCellOnClick;     
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}

function suittabCellOnClick()
{
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	
    if(this.id == 0) url="/cgi/alltest.pl?type=suits^25-50&prodId=405000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 1) url="/cgi/alltest.pl?type=suits^anarkali&prodId=406000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 2) url="/cgi/alltest.pl?type=suits^chudidar&prodId=401000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 3) url="/cgi/alltest.pl?type=suits^pantsuit&prodId=402000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 4) url="/cgi/alltest.pl?type=suits^salwar&prodId=404000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 5) url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";	
    document.location.href=url;
}





function skirttabs(currentTab,lang)
{
    var tabNames;
    if(lang == "fr" || lang == "French")
       tabNames = new Array("S-ID USers","T-Id/Online Log Users","Utilities","Return to CCNA");
    else
	tabNames  = new Array("Cotton","Silk","Return to Main");
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		//tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onclick     = suittabCellOnClick;     
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}

function skirttabCellOnClick()
{
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	
    if(this.id == 0) url="/cgi/alltest.pl?type=skirts^cotton&prodId=501000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 1) url="/cgi/alltest.pl?type=skirts^silk&prodId=502000&pageNo=1&tabMenu=suittabs";	
    if(this.id == 4) url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";	
    document.location.href=url;
}



function jewelrytabs(currentTab,lang)
{
    var tabNames;
    if(lang == "fr" || lang == "French")
       tabNames = new Array("S-ID USers","T-Id/Online Log Users","Utilities","Return to CCNA");
    else
	tabNames  = new Array("50% Off","Anklets","Armlets", "Bangles", "Bindis/Tattos", "Bracelets", "Broaches", "Errings", "Finger Rings", "Gold Plated Sets","Hair Clips","Key Chains","Mangal Sutras","Necklace Sets","Pearl Sets","Pendant Sets","Tikkas","Victorian Jewelry","Watches","Return to Main"  );
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		//tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onclick     = jewelrytabCellOnClick;     
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}

function jewelrytabCellOnClick()
{
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	
    if(this.id == 0) url="/cgi/alltest.pl?type=jewelry^50off&prodId=818000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 1) url="/cgi/alltest.pl?type=jewelry^anklets&prodId=801000&pageNo=1&tabMenu=jewelrytabs"; 
    if(this.id == 2) url="/cgi/alltest.pl?type=jewelry^armlets&prodId=802000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 3) url="/cgi/alltest.pl?type=jewelry^bangles&prodId=803000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 4) url="/cgi/alltest.pl?type=jewelry^bindistattoos&prodId=804000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 5) url="/cgi/alltest.pl?type=jewelry^bracelets&prodId=805000&pageNo=1tabMenu=jewelrytabs";
    if(this.id == 6) url="/cgi/alltest.pl?type=jewelry^broaches&prodId=806000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 7) url="/cgi/alltest.pl?type=jewelry^earrings&prodId=807000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 8) url="/cgi/alltest.pl?type=jewelry^fingerrings&prodId=808000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 9) url="/cgi/alltest.pl?type=jewelry^goldplatedsets&prodId=809000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 10) url="/cgi/alltest.pl?type=jewelry^hairclips&prodId=810000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 11) url="/cgi/alltest.pl?type=jewelry^keychains&prodId=811000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 12) url="/cgi/alltest.pl?type=jewelry^mangalsutras&prodId=812000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 13) url="/cgi/alltest.pl?type=jewelry^necklacesets&prodId=813000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 14) url="/cgi/alltest.pl?type=jewelry^pearlsets&prodId=814000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 15) url="/cgi/alltest.pl?type=jewelry^pendantsets&prodId=815000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 16) url="/cgi/alltest.pl?type=jewelry^tikkas&prodId=816000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 17) url="/cgi/alltest.pl?type=jewelry^victorianjewelry&prodId=819000&pageNo=1&tabMenu=jewelrytabs";
    if(this.id == 18) url="/cgi/alltest.pl?type=jewelry^watches&prodId=817000&pageNo=1&tabMenu=jewelrytabs";	
    if(this.id == 19) url="/cgi/alltest.pl?type=arrival&prodId=201000&pageNo=1";
	
    document.location.href=url;
}




function loadOnlineLogtabs()
{
    var currentTab=document.forms[0].currentTab.value;
    var lang = document.forms[0].language.value;
    var tabNames;
   // alert('language ' + lang);
    if(lang == "fr" || lang == "French")
      tabNames  = new Array("Critèresa","VINLookup","CustomerLookup", "réintégrer CCNA");
    else
    	tabNames = new Array("Criteria","VINLookup","CustomerLookup","Return to CCNA");
     
 
    tabsHeaderTable   = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow = tabsHeaderTable.rows[0];
    
    for(i=0;i<tabNames.length;i++)
	{
	//alert('Current tab ' + currentTab);
		var tabCell        = tabsHeaderRow.insertCell(i);
		tabCell.id         = i;
		tabCell.innerText  = tabNames[i];
		tabCell.name       = "tabMenuCell";
		tabCell.innerHTML  = tabNames[i];
		//tabCell.onmouseover= tabCellOnMouseOver;
		
		if(i == currentTab)
			tabCell.className="tabCellSelected";         
		else
			tabCell.className="tabCell"; 
			
		if(i==-1)
		{
			tabCell.onmouseover= function(){this.style.cursor='move'};
			tabCell.onmouseout = function(){this.style.cursor='default'};
		}
		else
		{
			tabCell.onmousedown = tabCellOnMouseDown; 
			tabCell.onclick     = onLineLogtabCellOnClick;     
			tabCell.onmouseover = tabCellOnMouseOver; 
			tabCell.onmouseout  = tabCellOnMouseOut;  
		}
		if(i==0)
			tabCell.style.border="thin none";
	}
}


function onLineLogtabCellOnClick()
{
	tabsHeaderTable     = document.getElementById("tabsHeaderTable");
	var tabsHeaderRow   = tabsHeaderTable.rows[0];
	var tabsHeaderCells = tabsHeaderRow.cells;
	
	this.className ="tabCellSelected";
	
    if(this.id == 0) OnlineLog("initOnlineLog");	
    if(this.id == 3) InitSearch();	
   
}


