var Cat = "MainCat";
function SetDetail(Detail,Pro)
{Pro=Pro.replace(/\W/g,"_");
 Pro=eval(Pro);
 Detail = eval(Detail);
 Detail.innerHTML=Pro;
}//end of function

function CatChanged(Cat)
{  List = eval(List1);
   if (List.value != "SELECT :")
      {addOption(List2,Cat);}
	  else
	  {List = eval(List2);ClearList(List);}//end of if
}//end of function

function DirectSearch(Str,List1,List2)
{if (Str == "")
    {alert("Product Cannot Be Empty");}
 else
    {
	var i=0;var ii =0; var flag=0;var CatPro="";
	 Str = Str.toUpperCase()
	 for (i = 0 ; i < MainCat.length ; i++)
	     {
		  CatPro = MainCat[i]+"";
		  CatPro=CatPro.replace(/\W/g,"_");
		  CatPro = eval(CatPro);
		  for (ii = 0 ; ii < CatPro.length ; ii++)
		      {if (CatPro[ii] == Str){flag=1;break;}}//end of loop+if (inner loop)
		  if (flag==1){break;}//end of if
		 }//End of main Loop (Category Loop)
	if (flag==1)
	   {List1 = eval(List1)
	    List2 = eval(List2)
		List1.options[i].selected = true;
		CatChanged(List1.value)
		List2.options[ii].selected = true;
		alert("Product Has Been Found.. Click GO Button To Continue...");
	   }
	else
	   {alert("Product Not Found");}
	}//end of if
}//end of function

function Search(Action,List1,List2)
{List1 = eval(List1+".value");
 List2 = eval(List2+".value");
// setCookie("CatClicked", List1);
// setCookie("ProClicked", List2);

 if (Action == "Catagory")
    { fn = eval(List1.replace(/\W/g,"_") + "_fn");
	 window.location  = slink +"/"+ fn;
	}
 else
    { fn = eval(List2.replace(/\W/g,"_") + "_fn");
	 window.location  = plink +"/"+ fn;
	}
}//end of function

function addOption (List,Cat)
 {Cat=Cat.replace(/\W/g,"_");
  Cat=eval(Cat);
  List = eval(List);
  //destory old Values
  ClearList(List);
  for(var i=0; i<Cat.length; i++)
    {var newOption=new Option();
      newOption.value=Cat[i];
      newOption.text=Cat[i];
 	  List.options[List.options.length] = newOption;
	}//end of loop
	List.options[0].selected = true;
}//end of function

function ClearList(List)
{while (List.options.length>0) {List.options[0]=null;}//end of while
}//end of if

NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

function expandIt(el) {
    if (!ver4) return;
    if (IE4) {
        whichEl = eval(el + "Child");
        if (whichEl.style.display == "none") {
            whichEl.style.display = "block";
        }
        else {
            whichEl.style.display = "none";
        }
    }
    else {
        whichEl = eval("document." + el + "Child");
        if (whichEl.visibility == "hide") {
            whichEl.visibility = "show";
        }
        else {
            whichEl.visibility = "hide";
        }
    }
}//end of function