//	INITIALIZING  THE FUNCTIONALITY OF THE COMPLETE CODE.
function initialize_menu()
{
createmenu('aro',[['Lambskin Wallets','Lambskinwallet.htm'],['Slim Wallets','SlimWallets.htm'],['Croco Design Wallets','CrocoWallets.htm'],[' Ostrich Design Wallets ','OstrichWallets.htm'],['Color Print Wallets','BombaySheep.htm'],['Biker Wallet','BikerWallet.htm'],['Magic Wallet','MagicWallet.htm'],['Cowhide Selection','chide.htm'],['Ladies Wallets','LadiesWallet.htm'],['Download Catalogue','Catalogues.htm']],left1,top2);

createmenu('aut',[['Bible Case','Bcase.htm'],['Cell Phone Cases','uc.htm'],['Fanny Packs','Fannypacks.htm'],['Organizor Kits','Organizer_kits.htm'],['Ladies Bags','bagsladies.htm']],left2,top2);

createmenu('fit',[['Card Cases','Cardcases.htm'],['Check Book Cover','CheckbookCover.htm'],['Cigarette Case','CGCASE.htm'],['Coin Purse','CoinPurse.HTM'],['Key Cases','KEYCASE.htm'],['Money Clips','MoneyClip.htm'],['Download Catalogue','Catalogues.htm']],left3,top2);

createmenu('hea',[['ID Holder','IDHolder.htm'],['Luggage Tag','LuggageTag.htm'],['Neck Purse','Neck_Purse.htm'],['Passport Cover','PassportCover.htm'],['Skull Cap','Skullcaps.htm'],['Visiting Card Holder','MISC.htm'],['Download Catalogue','Catalogues.htm']],left4,top2);


}

//======================= DO NOT EDIT BELOW THIS LINE ==================================================

////========== GLOBAL VARIABLE SUSED ===================
//2 top position.
top1=59;top2=89;										
//around the house 
left1=3;
//automotive
left2=130;
//Fitness
left3=240;
//H&B
left4=350
//household
left5=420
//koolatron products
left6=565
//kitchen
left7=640
//mis
left8=3
//P&O
left9=150
//R&M
left10=300
//toys
left11=450
//video
left12=500


var total_subcategories = [];			//ARRAY TO STORE THE COUNT OF SUB-CATEGORIES IN A CATEGORY.
var this_layeris_on ='none';			//TO STORE THE VALUE OF CURRENTLY DISPLAYED CATEGORY.
var NS6_diff = 0;									// FOR NS 6 ONWARDS
var layer_width_fixed=140;				//WIDTH OF THE MENU OF SUB-CATEGORIES.
var products_layer_width=140;			//WIDTH OF THE MENU OF PRODUCT LIST.
var xres=0;												//TO ADJUST X-VALUE FOR RESOLUTION.
var original_bgcolor_submenu='#FFFFFF';	//STORE INITIAL BACK-GROUND COLOR OF THE SUB-CATEGORY.
var onmouseover_bgcolor_subbmenu='#CCCCCC'; //STORE ONMOUSEOVER BACK-GROUND COLOR OF THE SUB-CATEGORY.
var initial=0;											//STORE INITIAL VALUE FOR CASCADING THE PRODUCT LIST
var final_val=0;										//STORE FINAL VALUE FOR CASCADING THE PRODUCT LIST
var current_sublayer_on ="none";		//STORE THE VALUE OF THE CURRENTLY DISPLAYED SUB-CATEGORY.
var newindex=0;											//COUNT DURING THE SLIDING OF SUB-CATEGORIES.
var nopifl =14;											//NO OF PRODUCTS IN THE FIRST PRODUCT LIST
var move_left = false;							//CASCADING RIGHT OR LEFT.

if(!document.all && document.getElementById)
	NS6_diff = 0;

if(screen.width == 1024)
{
	xres=114;
	nopifl = 23;
}
									///______________________________________________________-
									
//========================================== CATEGORY METHODS ======================================
																	//CREATE THE SUB-CATEGORY MENU FOR ALL CATEGORIES.
function createmenu(id,captions_array,left_position,top_position)
{
 left_position += NS6_diff+xres;

 for(var i=0;i<captions_array.length;i++)
 {
 document.write('<div id="'+id+i+'" style="position:absolute;font-family: Verdana;font-size: 11px; color: #000000; text-decoration: none; background-color:#FFFFFF; width:'+layer_width_fixed+'px; height:18px; border-color: #666666 #666666 #666666; border-style: solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; visibility:hidden; left:'+left_position+'px; top:'+top_position+'px; z-index:10'+i+'">');

document.write('<a href='+captions_array[i][1]+' class="amenulink"  onmouseover="javascript:product_list(event);"> &#149; '+captions_array[i][0]+'</a></div>');

	top_position+=19;
 }
 total_subcategories[id]=captions_array.length;
}
//_______________________________________________________________________
function highlight_category(index)						//highliting the category.
{
	switch(index)
	{
		case 'aro':{which_category="link1";break;}
		case 'aut':{which_category="link2";break;}
		case 'fit':{which_category="link3";break;}
		case 'hea':{which_category="link4";break;}
		case 'hou':{which_category="link5";break;}
		case 'koo':{which_category="link6";break;}
		case 'kit':{which_category="link7";break;}
		case 'mis':{which_category="link8";break;}
		case 'por':{which_category="link9";break;}
		case 'rel':{which_category="link10";break;}
		case 'toy':{which_category="link11";break;}
		case 'vid':{which_category="link12";break;}
		case 'tod':{which_category="link13";this_layeris_on="tod";break;}
		case 'all':{which_category="link14";this_layeris_on="all";break;}
	}
	camouflage();
	document.getElementById(which_category).style.color="#ffff00";
}
//____________________________________________________________________________________
function camouflage()										/// remove the highlighting of all categories.
{
	for(var ij=1;ij<15;ij++)
	{
		tdss="link"+ij;
		document.getElementById(tdss).style.color="#FFFFFF";
	}
}

///======================================== SUB CATEGORY METHODS====================================
function show_submenu(index)						//SHOW THE SUBCATEGORIES.
{
	if(document.layers) return;
	current_sublayer_on ="none";
	if(window.in_show_time) clearTimeout(in_show_time);
	if(window.sl_time) clearTimeout(sl_time);
	if(this_layeris_on != index)
	{
	if(this_layeris_on!='none')
		hideall_submenu();
	highlight_category(index);
	this_layeris_on=index;
	newindex=0;
	in_show_submenu();	
	}
}
//______________________________________________________________________________--
function in_show_submenu()						//FOR SLIDING APPEARANCE OF SUBCATEGORIES.
{
	if(newindex < total_subcategories[this_layeris_on])
	{
		var ts =  this_layeris_on+newindex;
		document.getElementById(ts).style.visibility ='visible';
		newindex++;
		in_show_time = setTimeout("in_show_submenu()",30);
	}
	else
		if(window.in_show_time) clearTimeout(in_show_time);
}
//______________________________________________________________________________--
function hideall_submenu()					//HIDE ALL SUB-CATEGORIES
{
	hide_product_list();
	camouflage();
	pindex = this_layeris_on;
	for(var j=0;j<total_subcategories[pindex];j++)
	{
		var tds = pindex+j;
		document.getElementById(tds).style.visibility ='hidden';
	}
	this_layeris_on='none';
}
//_________________________________________________________________________________-
document.onclick=hideall_submenu;
//_________________________________________________________________--
//===================================== PRODUCT LIST OF SUB-CATEGORIES ========================

function product_list(e)						//HIGHLIGHT THE SUB-CATEGORY ON MOUSEOVER.
{
	if(document.all)
		source = e.srcElement.parentNode;
	else if(document.getElementById)
		source = e.target.parentNode.parentNode;
	if(current_sublayer_on != source.id)
		hide_product_list();
	source.style.backgroundColor=onmouseover_bgcolor_subbmenu;
	show_product_list(source.offsetLeft,source.offsetTop,source.id)
}
//_________________________________________________________________
function show_product_list(offsetLeft,offsetTop,products_index) //DISPLAY THE PRODUCT LIST.
{
	if(current_sublayer_on != products_index)
	{
	current_sublayer_on = products_index;
	var plist_left = parseInt(offsetLeft)+layer_width_fixed;
	if((parseInt(offsetLeft) > 500 && xres==0) ||(parseInt(offsetLeft) > 615 && xres==114))
		{
		plist_left=parseInt(offsetLeft)-products_layer_width;
		move_left = true;
	}
	else
		move_left=false;
	document.getElementById("plist").style.left = plist_left+'px';
	document.getElementById("plist").style.top = offsetTop+'px';
	if(!move_left)
		initial=plist_left-50;
	else
		initial=plist_left+50;
	final_val = plist_left;
	if(create_product_list(products_index,offsetTop))
		slide_in();
	document.getElementById("plist").style.visibility = 'visible';
	}
}
//____________________________________________________________________________________--
function create_product_list(index,offsetTop)	//CREATE PRODUCT LIST DYNAMICALLY FOR THE SUB-CATEGORY.
{
	var txt='<table cellpadding="0" cellspacing="0"	 width="'+products_layer_width+'" border="0">';
	var extralayer = false;      //check if extra layer required
	var extrai = 0;							// extra count for extra layer.
	
	for(var i=0;i<products[index].length;i++)
	{
		txt+='<tr><td width="10" align="center" valign="top"><b>&middot;</B></td><td><a href="'+products[index][i][0]+'">'+products[index][i][1]+'</a></td></tr>';
		if(i>nopifl && products[index].length > i+1){extralayer = true;extrai = i+1;break;}
	}
	txt+='</table>';
	if(extralayer)
	{
		if(!move_left)
		document.getElementById("extralayer").style.left=
					parseInt(document.getElementById("plist").offsetLeft)+products_layer_width;
		else
		document.getElementById("extralayer").style.left=
					parseInt(document.getElementById("plist").offsetLeft)-products_layer_width;
		document.getElementById("extralayer").style.top=offsetTop;
		var extxt='<table cellpadding="0" cellspacing="0" width="'+products_layer_width+'" border="0">';
		for(var ii=extrai;ii<products[index].length;ii++)
			extxt+='<tr><td width="10" align="center" valign="top"><b>&middot;</B></td><td><a href="'+products[index][ii][0]+'">'+products[index][ii][1]+'</a></td></tr>';
		extxt+='</table>';
		document.getElementById("extralayer").innerHTML=extxt;
		if(current_sublayer_on == 'hea3' && xres==0)
		   document.getElementById("extralayer").style.top= 				parseInt(document.getElementById("extralayer").style.top)-115;		
		document.getElementById("extralayer").style.visibility='visible';	
	}
 document.getElementById("plist").innerHTML=txt;
 return(!extralayer);	
}
//____________________________________________________________________________________--
function slide_in()					//CASCADING THE PRODUCT LIST.
{
	if(window.sl_time) clearTimeout(sl_time);
	if(initial < final_val)
	{
		document.getElementById("plist").style.left = initial+'px';
		initial += 10;
		sl_time = setTimeout("slide_in()",30);
	}
	else
	if(initial > final_val && move_left)
	{
		document.getElementById("plist").style.left = initial+'px';
		initial -= 10;
		sl_time = setTimeout("slide_in()",30);
	}
	else
	{
		if(window.sl_time) clearTimeout(sl_time);
		document.getElementById("plist").style.left = final_val+'px';	
	}
}
//__________________________________________________________________________________________-
function hide_product_list()				//HIDE THE PRODUCT LIST.
{
	if(this_layeris_on!= "none")
	{
		document.getElementById("plist").style.visibility = 'hidden';
		document.getElementById("extralayer").style.visibility='hidden';	
		pindex=this_layeris_on;
		for(var j=0;j<total_subcategories[pindex];j++)
		{
			var tds = pindex+j;
			document.getElementById(tds).style.backgroundColor =original_bgcolor_submenu;
		}
	}
}
//_______________________________________________________________________________________--
