
		var strMenus = "";
		var strLastMenu="";
		var isIE = 0;
		var isMac=0;
		var isSafari=0;
		
		function getBrowser()
		{
		    var agt=navigator.userAgent.toLowerCase();
            if (agt.indexOf("opera") != -1) return 'Opera';
            if (agt.indexOf("staroffice") != -1) return 'Star Office';
            if (agt.indexOf("webtv") != -1) return 'WebTV';
            if (agt.indexOf("beonex") != -1) return 'Beonex';
            if (agt.indexOf("chimera") != -1) return 'Chimera';
            if (agt.indexOf("netpositive") != -1) return 'NetPositive';
            if (agt.indexOf("phoenix") != -1) return 'Phoenix';
            if (agt.indexOf("firefox") != -1) return 'Firefox';
            if (agt.indexOf("safari") != -1) return 'Safari';
            if (agt.indexOf("skipstone") != -1) return 'SkipStone';
            if (agt.indexOf("msie") != -1) return 'Internet Explorer';
            if (agt.indexOf("netscape") != -1) return 'Netscape';
            if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
            if (agt.indexOf('\/') != -1) {
            if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
            return navigator.userAgent.substr(0,agt.indexOf('\/'));}
            else return 'Netscape';} else if (agt.indexOf(' ') != -1)
            return navigator.userAgent.substr(0,agt.indexOf(' '));
            else return navigator.userAgent;
        }
        if(getBrowser() == "Safari")
            isSafari=1;

		if(navigator.appVersion.toLowerCase().indexOf("mac")!=-1)
		    isMac=1;
		if(document.all)
			isIE = 1;
		var AdultSizeSelected=0;
		var ChildSizeSelected=0;
		var strColour="";
		var objCatRow=0;
		var ROLLOVERCOLOUR = "mistyrose";
		document.onmouseup=HideTable;

	var extraOffset = 40;
function SetSizeAndLetters(selection)
		{
			//doCostumeSizes();
			SetAlphabetList(selection);
		}
		function SetAlphabetList(mySelection)
		{
			var myLetterDrop;
			var cosAdult;
			var cosChild;
			var sizeSelect;
			if(isIE)
			{
				myLetterDrop = document.all["CatList1_AdultLetter"];
				cosChild = document.all["CatList1_CosSizeC"];
				cosAdult = document.all["CatList1_cosSize"];
			}
			else
			{
				myLetterDrop = document.getElementById("CatList1_AdultLetter");
				cosChild = document.getElementById("CatList1_CosSizeC");
				cosAdult = document.getElementById("CatList1_cosSize");
			}
			switch(mySelection)
			{
				case '4': //child
						myLetterDrop.style.display="none";
						cosChild.style.display="inline";
						cosAdult.style.display="none";
						break;
				case '1':
				case '3':	
					myLetterDrop.style.display="none";
					cosChild.style.display="none";
					cosAdult.style.display="inline";
					myLetterDrop.style.display="none";
					break;
			 	case '2':
			 		cosChild.style.display="none";
					cosAdult.style.display="inline";
					myLetterDrop.style.display="inline";
					break;
			}
			
		}
	function ShowMenu(CatID)
		{
			var tblCat,divCat,nRowPos,nCatBottom,divBottom,rowCat;
			var tbl2,tbl1,myDiv;
			var catlistRow;
			catlistRow = "CatList1_Cr"+CatID;
			if(isIE)
			{
				tblCat = document.all["Ct"];
				divCat = document.all["Cd"];
				rowCat = document.getElementById(catlistRow);
			}
			else
			{
				tblCat = document.getElementById("Ct");//the table with the popup
				divCat =  document.getElementById("Cd");//the div containg the popup table
				rowCat = document.getElementById(catlistRow);//the row on the category list
			
			}
			divCat.style.visibility = "visible";
			
			if(objCatRow != 0)
			    restoreBackColor();
			strMenus = ("Cd");
			
			strColour = rowCat.style.backgroundColor;
			rowCat.style.backgroundColor = ROLLOVERCOLOUR;
			
			objCatRow = rowCat;
			while(tblCat.rows.length > 0)
				tblCat.deleteRow(0); 
			myNewRow =  tblCat.insertRow(tblCat.rows.length);
		    myNewCell = myNewRow.insertCell(0);	
			myNewCell.innerHTML = "Getting items.....";
			postionPop(CatID);

		    GetGroup.GetGroups(CatID+","+GetFilterString(),GetCategoryMembers);
		   
		}
		function GetCategoryMembers(Items)//get category members
		{
			window.status = "Done";	
			var aGroups = Items.split("**");
			var tblCat
			if(isIE)
			    tblCat = document.all["Ct"];
			else
				tblCat = document.getElementById("Ct"/*+aGroups[0]*/);
			while(tblCat.rows.length)
				tblCat.deleteRow(0);
			var i;
			var myNewCell,myNewRow,strHTML,aGroup;
			for(i=1;i < aGroups.length;i++)
			{
				myNewRow =  tblCat.insertRow(tblCat.rows.length);
				myNewCell = myNewRow.insertCell(0);
				aGroup = aGroups[i].split(",,");
				myNewCell.setAttribute('id',"Cc"+aGroup[0]);
				strHTML = "<a onmouseover=\"unsetColour('Cc"+aGroup[0]+"','lavender')\" onmouseout=\"unsetColour('Cc"+aGroup[0]+"','aliceblue')\"";
				strHTML += "href=\"Javascript:GG("+aGroup[0]+",'"+aGroup[1]+"',"+aGroups[0]+")\">"+aGroup[1]+"</a>";
				myNewCell.innerHTML = strHTML;
    		}
    		postionPop(aGroups[0]);

    		
		}
		function postionPop(CatID)
		{
		   // debugger;
		 
			var tblCat,divCat,nRowPos,nCatBottom,divBottom,rowCat;
			var tbl2,tbl1,myDiv
			var sp = document.getElementById("sp"+CatID);
			if(isIE)
			{
				
				tblCat = document.all["Ct"];
				divCat = document.all["Cd"];
				rowCat = document.getElementById("CatList1_TR"+CatID);
			}
			else
			{
				tblCat = document.getElementById("Ct");//the table with the popup
				divCat =  document.getElementById("Cd");//the div containg the popup table 
				rowCat = document.getElementById("CatList1_TR"+CatID);//the row on the category list
				tbl2 = document.getElementById("tblMain");
				tbl1 = document.getElementById("CatList1_Table1");
				myDiv = document.getElementById("oDiv");
			}
			if(isIE)
			{
				divCat.style.left = (tblMain.offsetLeft+CatList1_Table1.clientWidth)+"px";
				//align with item
				nRowPos = extraOffset + rowCat.offsetTop + document.all["oDiv"].offsetTop + tblMain.offsetTop - document.all["oDiv"].scrollTop;
				divCat.style.top = nRowPos + "px";
				nCatBottom = (tblCat.offsetHeight > divCat.offsetHeight)? divCat.offsetHeight : tblCat.offsetHeight;
				divBottom = oDiv.offsetTop + oDiv.clientHeight + tblMain.offsetTop+extraOffset;
			}
			else if(isMac && isSafari)
			{
			    if(event.clientY)
			    {
			        divCat.style.left = (tbl2.offsetLeft+tbl1.offsetLeft+tbl1.offsetWidth)+"px";
			        nRowPos = event.clientY - 20
			        divCat.style.top = nRowPos + "px";
			        nCatBottom = (tblCat.offsetHeight > divCat.offsetHeight)? divCat.offsetHeight : tblCat.offsetHeight;
				    divBottom = myDiv.offsetTop + myDiv.clientHeight + tbl2.offsetTop;
			     }
			}
			else
			{
				divCat.style.left = (tbl2.offsetLeft+tbl1.offsetLeft+tbl1.offsetWidth)+"px";
				//divCat.style.left = 10;
				//align with item
				//alert("rowcat:"+rowCat.offsetTop+"sp:"+ci.offsetTop );
				nRowPos =  rowCat.offsetTop +  myDiv.offsetTop + tbl2.offsetTop -  myDiv.scrollTop;
				
				divCat.style.top = nRowPos + "px";
				nCatBottom = (tblCat.offsetHeight > divCat.offsetHeight)? divCat.offsetHeight : tblCat.offsetHeight;
				divBottom = myDiv.offsetTop + myDiv.clientHeight + tbl2.offsetTop;
			}
			if(nCatBottom + divCat.offsetTop > divBottom)
				divCat.style.top = (divBottom - nCatBottom)+"px";
			//end of positioning
		}
        function getElementPosition(elemID) 
        {
           
            var offsetTrail = document.getElementById(elemID);
            // alert(offsetTrail.clientHeight);
            
            alert();
            
        }
	function setBgColour(strCell)
	{
		try
		{ 			
			var objTblCell = (isIE)?document.all[strCell] : document.getElementById(strCell);
			objTblCell.style.backgroundColor = ROLLOVERCOLOUR;
		}
		catch(errorObject)
		{
			return;
		}
	}
	function unsetColour(strCell,strColour)
	{
		try
		{
			var objTblCell =  (isIE)?document.all[strCell] : document.getElementById(strCell);
			objTblCell.style.backgroundColor = strColour;
		}
		catch(errorObject)
		{
			return;
		}	
	}
		function UpdateShortlist()
		{
			
			var myNewRow;
			var slTable,btnShortlist,strOptions,btnBook;
			if(isIE)
			{
				//myNewRow = document.all.tbShortlist.insertRow();
				slTable = document.all["CatList1_tbShortlist"];
				strOptions = document.all["CatList1_ShortlistSelection"].value;
				myNewRow =  slTable.insertRow();
				btnShortlist = document.all("CatList1_Button2");
				btnBook = document.all("CatList1_btnBook");
			}
			else
			{
				slTable = document.getElementById("CatList1_tbShortlist");
				myNewRow =  slTable.insertRow(slTable.rows.length);
				strOptions = document.getElementById("CatList1_ShortlistSelection").value;
				btnShortlist = document.getElementById("CatList1_Button2");
				btnBook = document.getElementById("CatList1_btnBook");

			}
			var aOptions = strOptions.split("&&");
			if(aOptions.length == 1)
			{
			    DeleteShortlist(aOptions[0]);
			    return;
			} 
			
			
			myNewRow.id = "CatList1_sl"+aOptions[3];
			var strHTML;
			var myNewCell = myNewRow.insertCell(0);
			strHTML = "<a href=\"Javascript:ShowShortlistCostume("+aOptions[3]+")\">";  
			strHTML += aOptions[2]+" ID#"+aOptions[0]+"</a>";
			myNewCell.innerHTML = strHTML;
			myNewCell=myNewRow.insertCell(1);
			strHTML = "<a href=\"Javascript:DelShortlist("+aOptions[3]+")\">";
			strHTML += "<img border=0 src=\"images/delsl.gif\"></a>";
			myNewCell.innerHTML = strHTML;
			btnShortlist.value = "Show Shortlist";
			btnBook.style.display = "inline";
			window.status = "";	
		}
		function DelShortlist(nSID)
		{
		    if(isIE)
			{
				document.all["CatList1_ShortlistSelection"].value = nSID;
				document.all["CatList1_DelShortList"].click();
			}
			else
			{
				document.getElementById("CatList1_ShortlistSelection").value = nSID;
				document.getElementById("CatList1_DelShortList").click();
			}
		}
		function DeleteShortlist(strID)
		{
			
			if(strID != "0")
			{	
				//var aID = strID.split("&");
				//var strIDFormat = aID[0]+"_"+aID[1];
				var i,tbl;
				if(isIE)
				{
					
					i = document.all["CatList1_sl"+strID].rowIndex;
					document.all.CatList1_tbShortlist.deleteRow(i);
					if(document.all.CatList1_tbShortlist.rows.length <= 2)
					    document.all("CatList1_btnBook").style.display = "none";
					window.status = "";
					if(document.all["IsShortlist"] != null)
						document.all["table_"+strID].style.display = "none";
				}
				else
				{
					i = (document.getElementById("sl"+strID)).rowIndex;
					document.getElementById("CatList1_tbShortlist").deleteRow(i);
					window.status = "";
					if(document.getElementById("IsShortlist") != null)
						(document.getElementById("table_"+strID)).style.display = "none";
					if(document.getElementById("CatList1_tbShortlist").rows.length <= 2)
					    document.getElementById("CatList1_tbShortlist").style.display = "none";	
				}	
			}
			else 
				window.status = "Sorry could not delete ... Server error";	
		}
		
	
		function HideTable(e)
		{	
		
			if(strMenus.length)
			{
				
				if(isIE)
				{
					if(ieOut(event.clientX,event.clientY,strMenus))
					{
						document.all["Cd"].style.visibility = "hidden";
						strMenus = "";
						restoreBackColor();
					}
				}
				else if(nnOut(e.clientX,e.clientY,strMenus))
				{
					document.getElementById(strMenus).style.visibility = "hidden";
					strMenus = "";
					objCatRow.style.backgroundColor = strColour;
				}
					
			}
		}
		function restoreBackColor()
		{
		    objCatRow.style.backgroundColor = strColour;
		}
		function nnOut(x,y,theMen)
		{
			if(x<0)return false;
			var subLeftX,subTopY, subRightX,subBottomY,tbl;
			tbl = document.getElementById(theMen);
			subLeftX  = tbl.offsetLeft-4;
			subRightX = subLeftX + tbl.offsetWidth+8;
			subTopY = tbl.scrollHeight;
			subBottomY  = subTopY + tbl.offsetHeight + 4;
			
			if (x > subRightX) 
			{
				return true;
			}/*
			else if (y > subBottomY||y < subTopY) 
			{
				return true;
			}*/
			else 
				return false;
		}
		function ieOut(x,y,theMen)
		{	
			
			if(x<0)return false;
			var subLeftX,subTopY, subRightX,subBottomY,tbl;
			tbl = document.all[theMen];
			subLeftX  = tbl.offsetLeft-4;
			subRightX = subLeftX + tbl.offsetWidth+8;
			subTopY = tbl.scrollHeight;
			subBottomY  = subTopY + tbl.offsetHeight + 4;
			
			if (x > subRightX) 
			{
				return true;
				}
			
			else 
				return false;
		}
		
		function GG(GroupID,strCat,CatID)
		{
			var btnGetGroup;
			var myDiv,divCat; 
	
			var strCategory = "";
	
			if(isIE)
			{	
				if(document.all["Ci"+CatID])
					strCategory = document.all["Ci"+CatID].value + " , Costume:";
				document.all["CatList1_myGroup"].value = GroupID;
				document.all["CatList1_catMessage"].value = strCategory +" "+ strCat;
			
				divCat = document.all["Cd"];
				btnGetGroup = document.all["CatList1_ButtonGG"];
			}
			else
			{	if(document.getElementById("Ci"+CatID))
					strCategory = (document.getElementById("Ci"+CatID)).value+ " , Costume:";
				document.getElementById("CatList1_myGroup").value = GroupID;
				document.getElementById("CatList1_catMessage").value = strCategory +" "+ strCat;
		
				divCat = document.getElementById("Cd");
				btnGetGroup = document.getElementById("CatList1_ButtonGG");
				
			 
			}
		
			btnGetGroup.click();
			divCat.style.visibility = "hidden";
			
		}
		
		function ShowShortlistCostume(SID)
		{
			if(isIE)
			{
				document.all["CatList1_ShortlistSelection"].value = SID;
				document.all["CatList1_ShortListCosutme"].click();
			}
			else
			{
				document.getElementById("CatList1_ShortlistSelection").value = SID;
				document.getElementById("CatList1_ShortListCosutme").click();
			}
		}
		function setDrops()
		{
			load();
		}
		
		function EndRequestHandler(sender, args) {
		
   if (sender._panelsToRefreshIDs[0] == "CatList1$UpdatePanel2")
       UpdateShortlist();
 
}

		function load() {
   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}


function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		GoButton_over = newImage("images2/GoButton-over.gif");
		Retail_over = newImage("images2/Retail-over.gif");
		Contact_over = newImage("images2/Contact-over.gif");
		AboutUs_over = newImage("images2/AboutUs-over.gif");
		preloadFlag = true;
	}
}
function hiddenbooking()
{
    if(event.keyCode)
    {    
        if(event.keyCode == 192)
        {
            var bkBtn = document.getElementById("CatList1_btnBook");
            if(bkBtn)
                bkBtn.click();
        }
            
    }
            
}
document.onkeydown = hiddenbooking;	