﻿// JScript File

//used to position popups
var posleft = 0;
var posright = 0;

function getOptionPosition(curelem)
{    
    for (posleft = 0, postop = 0; curelem.offsetParent; curelem = curelem.offsetParent) 
	{
		posleft += curelem.offsetLeft;
		postop += curelem.offsetTop;
	}
}

var prevfunction = null;
//Used when only selecting function, then qty
function selQty(rownum, productid, lockFunction, tlprice, tprice, PercentSaved, productsplit)
{        
    var cursel = document.getElementById("trfunction" + rownum);        
    if (prevfunction != null){
        prevfunction.style.backgroundColor = '#f0efef';
        prevfunction.style.color = 'black';
    }
    cursel.style.backgroundColor = '#666666';
    cursel.style.color = '#ffffff';
      
    prevfunction = cursel;
    
    //Show select header        
    document.getElementById("headfunction").style.display = "none";
    document.getElementById("headfunctionInactive").style.display = "";

    document.getElementById("headqty").style.display = "";
    document.getElementById("headqtyInactive").style.display = "none";
    
    //fill 'select qty box
    var lprice = tlprice.replace('$','');
    lprice = lprice.replace(',','');
    var price = tprice.replace('$','');
    price = price.replace(',','');
    var difprice = lprice - price;  
    
    document.getElementById("tdDispList").innerHTML = tlprice + " Each";
    document.getElementById("tdDispPrice").innerHTML = tprice + " Each";
    if (difprice > 0)
        document.getElementById("tdDispSave").innerHTML = formatCurrency(difprice) + " (" + PercentSaved + "%)";
    document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = productid;
    document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";
    document.getElementById("total").value = "";
    document.getElementById("hidprice").value = price;       
	
    document.getElementById("tdprice").style.display = "";
    
    var selItemtxt;
    //selItemtxt = document.getElementById("manufacturer").value + " ";
    //selItemtxt += lockFunction.substring(0,lockFunction.indexOf("(")-1);
    //selItemtxt += productsplit;
    //if (document.getElementById("design").value != "")
	//	selItemtxt += " " + document.getElementById("design").value;
	//if (document.getElementById("finish").value != "")
	//	selItemtxt += " " + document.getElementById("finish").value;
	//selItemtxt += " " + document.getElementById("suffix").value;
    //document.getElementById("selItem").innerHTML = selItemtxt;
}


var prevStep1 = null
function step1(rownum,val,skipStep2)
{        
    var field = document.getElementById("hidstep1").value;
	var field2 = document.getElementById("hidstep2").value;
	var field3 = document.getElementById("hidstep3").value;
	
	var cursel = document.getElementById("trstep1" + rownum);        
	if (prevStep1 != null){
		prevStep1.style.backgroundColor = '#f0efef';
		prevStep1.style.color = 'black';
	}
	cursel.style.backgroundColor = '#666666';
	cursel.style.color = '#ffffff';
	cursel.style.color = '#ffffff';
        
	prevStep1 = cursel;
		
	//Show select header        
	document.getElementById("head" + field + "Active").style.display = "none";
	document.getElementById("head" + field + "Inactive").style.display = "";

	var fieldpos;
	if (field == "function")
		fieldpos = 1; 
	else if (field == "size")
		fieldpos = 2; 
	else if (field == "finish")
		fieldpos = 3;
		
	else if	(field == "product")//latches
	    fieldpos = 1;
	else if (field == "manufacturer")//latches
	    fieldpos = 2;
	else if (field == "backset")//latches
	    fieldpos = 11;
	else if (field == "handle")//latches
	    fieldpos = 12;    
	else if (field == "strike")//latches
	    fieldpos = 13;       
	else if (field == "hand")
	    fieldpos = 5;
	    
	var field2pos;
	if (field2 == "size")
		field2pos = 2; 
	else if (field2 == "finish")
		field2pos = 3;
	else if (field2 == "hand")
		field2pos = 5;	
	else if (field2 == "strike")//latches
	    field2pos = 13;   
	
	var field3pos;
	if (field3 == "size")
		field3pos = 2;
	else if (field3 == "finish")
		field3pos = 3; 
					
	var lprice, price, difprice;
	var count = 0;
	
	//used for selected item
	var tcount = -1;
	var tx = -1;
	
	var tproduct, tfinish, tBackset;
	
	//if skipStep2 = "yes" then skip step2 and show step3 
	if (skipStep2 == "yes")
	{
	    document.getElementById("tdstep2outer").style.display = "none";
	    
	    document.getElementById("head" + field3 + "Active").innerHTML = "<img src='images/select/2selectfinishactive.gif' alt='select finish'>";
	    document.getElementById("head" + field3 + "Inactive").innerHTML = "<img src='images/select/2selectfinishinactive.gif' alt='select finish'>";
	    document.getElementById("head" + field3 + "Active").style.display = "";
		document.getElementById("head" + field3 + "Inactive").style.display = "none";
		
		document.getElementById("headqty").innerHTML = "<img src='images/select/3selectqtycartactive.gif' alt='select Qty/Add to cart'>";
		document.getElementById("headqty").style.display = "none";
		document.getElementById("headqtyInactive").style.display = "none";
	
		//clear sel qty box
		document.getElementById("tdDispSave").innerHTML = "";
		document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = "";
		//document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";
		//document.getElementById("total").value = "";
		//document.getElementById("hidprice").value = ""; 	
		document.getElementById("tdprice").style.display = "none";
    
		prevStep3 = null;
			
    	intxt = "<table border=0 cellspacing=0 cellpadding=0 width='100'>";
		intxt += "<tr><td valign='top'><div class='sizehead'>" + field3 + "</div></td>";
		
		var x;
		//check if we should add column for price
		var numrows = 0;
		for (x=0;x<itemArray.length;x++)
		{
			//check if item matches 1st and 2nd field
			if (itemArray[x][fieldpos] == val)
				numrows ++;
		}
		
		if (numrows > 1)
		    intxt += "<td nowrap><div class='sizehead2'>Price Ea</div></td>";
		intxt += "</tr>";		
		
		var count = 0;
		for (var x=0;x<itemArray.length;x++){
			//check if item matches 1st and 2nd field
			if (itemArray[x][fieldpos] == val){
				intxt += "<tr class='quantityundefined' id=trstep3" + count + " onmouseover='showHover(this);' onmouseout='showHover(this);' style='cursor:pointer;"
				
				//if (document.getElementById(field3).value == itemArray[x][field3pos]){//then select item
				if (document.getElementById('userselected').value == 'no' && (document.getElementById(field3).value == itemArray[x][field3pos])){//then select item
					intxt += "background-color: #666666;color:white;' onclick='step3(" + count + "," + x + ");'>";
					tcount = count;
					tx = x;
				}
				else
				{
					intxt += "background-color: #f0efef;' onclick='setUserSelected();step3(" + count + "," + x + ");'>";					
				    if (numrows == 1)//then select item because there is only 1 row
					{
					    tcount = count;
					    tx = x;
					}
				}
				
				
				intxt += "<td colspan=2><table class='quantityundefined' style='width:100%'><tr>"
				intxt += "<td nowrap>" + itemArray[x][field3pos] 
				if (field3 == 'finish' && itemArray[x][4] != '')
					intxt += " " + itemArray[x][4];
				intxt += "</td>";		
				if (numrows > 1)
				    intxt += "<td align='right'>" + itemArray[x][7] + "</td>";
				intxt += "</tr></table>"
				intxt += "</td></tr>";			
				count ++;
			}
		}
		intxt += "</table>"
		
		document.getElementById("tdstep3").innerHTML = intxt;
		document.getElementById("tdstep3").style.display = "";
	}
	//if field2 = "" then show select qty	
	else if (field2 == "")
	{
	    document.getElementById("headqty").style.display = "";
		document.getElementById("headqtyInactive").style.display = "none";
				
	    for (var x=0;x<itemArray.length;x++){
			if (itemArray[x][fieldpos] == val){   
				tlprice = itemArray[x][6];
				tprice = itemArray[x][7];       
				PercentSaved = itemArray[x][8]; 
				productid = itemArray[x][0];  
				//curproduct = itemArray[x][1]; 
				urlname = itemArray[x][9];
				tproduct = itemArray[x][10];
				tfinish = itemArray[x][3];
				tBackset = itemArray[x][11];
			}
		}
        
		lprice = tlprice.replace('$','');
		lprice = lprice.replace(',','');
		price = tprice.replace('$','');
		price = price.replace(',','');
		difprice = lprice - price; 
        
		document.getElementById("tdDispList").innerHTML = tlprice + " Each";
		document.getElementById("tdDispPrice").innerHTML = tprice + " Each";
		if (difprice > 0)
			document.getElementById("tdDispSave").innerHTML = formatCurrency(difprice) + " (" + PercentSaved + "%)";
		document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = productid;
		document.getElementById("ctl00_uxPlaceHolder_hidurlname").value = urlname;
		//document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";
		//document.getElementById("total").value = "";
		//document.getElementById("hidprice").value = price;       
		
		document.getElementById("tdprice").style.display = "";
		
		if (document.getElementById("ctl00_uxPlaceHolder_hasoptions").value == "yes")
		{
		    document.getElementById("ctl00_uxPlaceHolder_imgaddViewOptions").value = "Add / View Options";   
		}
		else
		{
		    document.getElementById("ctl00_uxPlaceHolder_imgaddViewOptions").value = "View / Add to Cart";
		}
		
		//resetOptions();
	}
    else{
		document.getElementById("tdstep2outer").style.display = "";
		
		var numsteps = document.getElementById("numsteps").value;      
		
		document.getElementById("head" + field3 + "Active").innerHTML = "<img src='images/select/3select" + field3 + "active.gif' alt='select finish'>";
	    document.getElementById("head" + field3 + "Inactive").innerHTML = "<img src='images/select/3select" + field3 + "inactive.gif' alt='select finish'>";
	    		                  
        document.getElementById("headqty").innerHTML = "<img src='images/select/" + numsteps + "selectqtycartactive.gif' alt='select Qty/Add to cart'>";
        		
		document.getElementById("head" + field2 + "Active").style.display = "";
		document.getElementById("head" + field2 + "Inactive").style.display = "none";
		
		if (field3 != ""){
			document.getElementById("head" + field3 + "Active").style.display = "none";
			document.getElementById("head" + field3 + "Inactive").style.display = "none";
		}
		
		document.getElementById("headqty").style.display = "none";
		document.getElementById("headqtyInactive").style.display = "none";
		
    	//clear column 3
    	document.getElementById("tdstep3").innerHTML = "";
		document.getElementById("tdstep3").style.display = "none";
    
		//clear sel qty box
		document.getElementById("tdDispSave").innerHTML = "";
		document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = "";
		//document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";
		//document.getElementById("total").value = "";
		//document.getElementById("hidprice").value = ""; 	
		document.getElementById("tdprice").style.display = "none";
		//resetOptions();
            
		prevStep2 = null;
    
    	var field2pos;
		if (field2 == "size")
			field2pos = 2; 
		else if (field2 == "finish")
			field2pos = 3;
		else if (field2 == "hand")
			field2pos = 5;
	    else if (field2 == "strike")//latches
	        field2pos = 13;          
		
		var field3pos;
		if (field3 == "size")
			field3pos = 2;
		else if (field3 == "finish")
			field3pos = 3; 

				
		intxt = "<table border=0 cellspacing=0 cellpadding=0 width='100%'>";
		intxt += "<tr><td valign='top' width='100%'><div class='sizehead'>" + field2 + "</div></td>";
		
		//check if we should add column for price
		var numrows = 0;
		for (x=0;x<itemArray.length;x++)
		{
			if (itemArray[x][fieldpos] == val)
			    numrows ++;
		}
				
		if (field3 == "" && numrows > 1)
			intxt += "<td width='100%' nowrap><div class='sizehead2'>Price Ea</div></td>";
		intxt += "</tr>";
		
		var prevrow = "";		
		
		for (var x=0;x<itemArray.length;x++){
			if (itemArray[x][fieldpos] == val){
				//alert(prevrow);
				if (prevrow != itemArray[x][field2pos]){ 
					curproduct = itemArray[x][1]; 
					intxt += "<tr class='quantityundefined' id=trstep2" + count + " onmouseover='showHover(this);' onmouseout='showHover(this);' style='cursor:pointer;"
										
					//if (document.getElementById(field2).value == itemArray[x][field2pos]){//then select item
					if (document.getElementById('userselected').value == 'no' && (document.getElementById(field2).value == itemArray[x][field2pos])){//then select item
						intxt += "background-color: #666666;color:white;' onclick='step2(" + count + "," + x + ");'>";
						tcount = count;
						tx = x;
					}
					else
					{
						intxt += "background-color: #f0efef;' onclick='setUserSelected();step2(" + count + "," + x + ");'>";
						if (numrows == 1)//then select item because there is only 1 row
						{
						    tcount = count;
						    tx = x;
						}
					}
					
					
					intxt += "<td colspan=2><table class='quantityundefined' style='width:100%'><tr>";
					if (field2 == 'size'){
						intxt += "<td><img src='images/website/question.gif' ";
	                    intxt += " onmouseover='showsize(this," + x + ")' onmouseout='showsize(this)'>";					
					}
					intxt += "<td nowrap width='100%'>" + itemArray[x][field2pos];
					if (field2 == 'finish' && itemArray[x][4] != '')
						intxt += " " + itemArray[x][4];					
					
					intxt += "</td>";		
					if (field3 == "" && numrows > 1)		
						intxt += "<td>" + itemArray[x][7] + "</td>";
					intxt += "</tr></table>"
					intxt += "</td></tr>";		
					
					tproduct = itemArray[x][10];
					tBackset = itemArray[x][11];
				}			
				prevrow = itemArray[x][field2pos];
				count ++;
			}
		}
		intxt += "</table>"
		
		//alert(intxt);
		document.getElementById("tdstep2").innerHTML = intxt;
		document.getElementById("tdstep2").style.display = "";
    }
    
    var selItemtxt = "";
	selItemtxt = "ABH";
	if (document.getElementById("level1").value == "1")//Overhead Holders And Stops
	{
	    if (document.getElementById("series").value == '3500'){ 
	        selItemtxt += " " + document.getElementById("series").value;
	        selItemtxt += " " + val;
	        selItemtxt += " " + document.getElementById("suffix").value;
	    }
	    else
	    {
	        selItemtxt += " " + document.getElementById("series").value;
	        selItemtxt += " " + document.getElementById("suffix").value;
	        selItemtxt += " " + val;
	    } 
	}
	else
	{
	    if (document.getElementById("series").value == '6000' || document.getElementById("series").value == '6100')//show backset from previous page
	    {   
	        selItemtxt += " " + document.getElementById("series").value + " " + tBackset;
	        selItemtxt += " " + val;
	        selItemtxt += " " + document.getElementById("suffix").value;
	    }	    	
	    else if (document.getElementById("series").value == '6700')
	    {
	        selItemtxt += " " + tproduct;
	        selItemtxt += " " + document.getElementById("suffix").value;
	        selItemtxt += " from " + val;
	    }
	    else if (document.getElementById("series").value == '6400-6500'){
	        selItemtxt += " " + tproduct;
	        selItemtxt += " " + document.getElementById("suffix").value;
	    }
	    else if (document.getElementById("series").value == 'Extensions')//Electromagnetic Extensions
	    {
	        selItemtxt += " " + tproduct;
	        selItemtxt += " " + tfinish;
	        selItemtxt += " " + val;
	        selItemtxt += " " + document.getElementById("suffix").value;
	    }
	    else
	    {
            selItemtxt += " " + tproduct;     	            
	        selItemtxt += " " + val;
	        selItemtxt += " " + document.getElementById("suffix").value;
	    }
	}	
	
    document.getElementById("selItem").innerHTML = selItemtxt;
    			
	if (tcount > -1)//then select item
		step2(tcount,tx);
}   

var prevStep2 = null; 
function step2(rownum, arrnum)
{		
	var cursel = document.getElementById("trstep2" + rownum);        

	if (prevStep2 != null){
		prevStep2.style.backgroundColor = '#f0efef';
		prevStep2.style.color = 'black';
	}
	prevStep2 = cursel;
		
	if (cursel)	//if element exists (If we skipped step2 then it does not exist)
	{
	    cursel.style.backgroundColor = '#666666';
	    cursel.style.color = '#ffffff';
	}
	
	var field = document.getElementById("hidstep1").value;
	var field2 = document.getElementById("hidstep2").value;
	var field3 = document.getElementById("hidstep3").value;
						
	if (field == "function")
		fieldpos = 1; 
	else if (field == "size")
		fieldpos = 2; 
	else if (field == "finish")
		fieldpos = 3;
		
	else if	(field == "product")//latches
	    fieldpos = 1;
	else if (field == "manufacturer")//latches
	    fieldpos = 2;
    else if (field == "backset")//latches
	    fieldpos = 11;
	else if (field == "handle")//latches
	    fieldpos = 12;    
	else if (field == "strike")//latches
	    fieldpos = 13;      
	else if (field == "hand")
	    fieldpos = 5;
	
	var field2pos;
	if (field2 == "size")
		field2pos = 2; 
	else if (field2 == "finish")
		field2pos = 3;
	else if (field2 == "hand")
		field2pos = 5;	
	else if (field2 == "strike")//latches
	    field2pos = 13;   
	
	var field3pos;
	if (field3 == "size")
		field3pos = 2;
	else if (field3 == "finish")
		field3pos = 3; 
	
	//Show select header        
	document.getElementById("head" + field + "Active").style.display = "none";
	document.getElementById("head" + field + "Inactive").style.display = "";
	document.getElementById("head" + field2 + "Active").style.display = "none";
	document.getElementById("head" + field2 + "Inactive").style.display = "";
	
	var tcount = -1;
	var tx = -1;
	
	var tproduct = itemArray[arrnum][10];
	var tBackset = itemArray[arrnum][11];
	   
    if (field3 == ""){ //then show select qty
		document.getElementById("headqty").style.display = "";
		document.getElementById("headqtyInactive").style.display = "none";
		//fill 'select qty box
		var lprice = itemArray[arrnum][6].replace('$','');
		lprice = lprice.replace(',','');
		var price = itemArray[arrnum][7].replace('$','');
		price = price.replace(',','');
		var difprice = lprice - price; 
        
		document.getElementById("tdDispList").innerHTML = itemArray[arrnum][6] + " Each";
		document.getElementById("tdDispPrice").innerHTML = itemArray[arrnum][7] + " Each";
		if (difprice > 0)
			document.getElementById("tdDispSave").innerHTML = formatCurrency(difprice) + " (" + itemArray[arrnum][8] + "%)";
		document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = itemArray[arrnum][0];
		document.getElementById("ctl00_uxPlaceHolder_hidurlname").value = itemArray[arrnum][9];
		//document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";
		//document.getElementById("total").value = "";
		//document.getElementById("hidprice").value = price;    
		
		//resetOptions();   
		
		document.getElementById("tdprice").style.display = "";
		
		if (document.getElementById("ctl00_uxPlaceHolder_hasoptions").value == "yes")
		{
		    document.getElementById("ctl00_uxPlaceHolder_imgaddViewOptions").value = "Add / View Options";   
		}
		else
		{
		    document.getElementById("ctl00_uxPlaceHolder_imgaddViewOptions").value = "View / Add to Cart";
		}
	}
	
	else{//1 more column
		document.getElementById("head" + field3 + "Active").style.display = "";
		document.getElementById("head" + field3 + "Inactive").style.display = "none";
		
		document.getElementById("headqty").style.display = "none";
		document.getElementById("headqtyInactive").style.display = "none";
	
		//clear sel qty box
		document.getElementById("tdDispSave").innerHTML = "";
		document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = "";
		//document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";
		//document.getElementById("total").value = "";
		//document.getElementById("hidprice").value = ""; 	
		document.getElementById("tdprice").style.display = "none";
    
		prevStep3 = null;
			
    	intxt = "<table border=0 cellspacing=0 cellpadding=0 width='100'>";
		intxt += "<tr><td valign='top'><div class='sizehead'>" + field3 + "</div></td>";
		
		var x;
		//check if we should add column for price
		var numrows = 0;
		for (x=0;x<itemArray.length;x++)
		{
			//check if item matches 1st and 2nd field
			if (itemArray[x][fieldpos] == itemArray[arrnum][fieldpos] && itemArray[x][field2pos] == itemArray[arrnum][field2pos])
				numrows ++;
		}
		
		if (numrows > 1)
		    intxt += "<td nowrap><div class='sizehead2'>Price Ea</div></td>";
		intxt += "</tr>";		
		
		var count = 0;
		for (var x=0;x<itemArray.length;x++){
			//check if item matches 1st and 2nd field
			if (itemArray[x][fieldpos] == itemArray[arrnum][fieldpos] && itemArray[x][field2pos] == itemArray[arrnum][field2pos]){
				intxt += "<tr class='quantityundefined' id=trstep3" + count + " onmouseover='showHover(this);' onmouseout='showHover(this);' style='cursor:pointer;"
				
				//if (document.getElementById(field3).value == itemArray[x][field3pos]){//then select item
				if (document.getElementById('userselected').value == 'no' && (document.getElementById(field3).value == itemArray[x][field3pos])){//then select item
					intxt += "background-color: #666666;color:white;' onclick='step3(" + count + "," + x + ");'>";
					tcount = count;
					tx = x;
				}
				else
				{
					intxt += "background-color: #f0efef;' onclick='setUserSelected();step3(" + count + "," + x + ");'>";					
				    if (numrows == 1)//then select item because there is only 1 row
					{
					    tcount = count;
					    tx = x;
					}
				}
				
				
				intxt += "<td colspan=2><table class='quantityundefined' style='width:100%'><tr>"
				intxt += "<td nowrap>" + itemArray[x][field3pos] 
				if (field3 == 'finish' && itemArray[x][4] != '')
					intxt += " " + itemArray[x][4];
				intxt += "</td>";		
				if (numrows > 1)
				    intxt += "<td align='right'>" + itemArray[x][7] + "</td>";
				intxt += "</tr></table>"
				intxt += "</td></tr>";			
				count ++;
			}
		}
		intxt += "</table>"
		
		document.getElementById("tdstep3").innerHTML = intxt;
		document.getElementById("tdstep3").style.display = "";
    }
    
    var selItemtxt = "";
	selItemtxt = "ABH";	

	if (document.getElementById("level1").value == "1")//Overhead Holders And Stops
	{
	    if (document.getElementById("series").value == '3500'){ 
	        selItemtxt += " " + document.getElementById("series").value;	
	        selItemtxt += " " + itemArray[arrnum][fieldpos];
	        selItemtxt += " " + itemArray[arrnum][field2pos];
	        selItemtxt += " " + document.getElementById("suffix").value;
	    }
	    else{
	        selItemtxt += " " + itemArray[arrnum][field2pos];
            selItemtxt += " " + document.getElementById("suffix").value;
            selItemtxt += " " + itemArray[arrnum][fieldpos];
        }
    }
	else if (document.getElementById("series").value == '6700'){
	    selItemtxt += " " + tproduct;
	    selItemtxt += " " + itemArray[arrnum][field2pos];
	    selItemtxt += " " + document.getElementById("suffix").value;
	    selItemtxt += " from " + itemArray[arrnum][fieldpos];
	}
	else if (document.getElementById("series").value == '6400-6500'){
	    selItemtxt += " " + tproduct;
	    selItemtxt += " " + itemArray[arrnum][field2pos];
	    selItemtxt += " " + document.getElementById("suffix").value;
	}
	else if (document.getElementById("series").value == '6000' || document.getElementById("series").value == '6100')//show backset from previous page
	{
	    selItemtxt += " " + document.getElementById("series").value + " " + tBackset;	            
        selItemtxt += " " + itemArray[arrnum][fieldpos];
        selItemtxt += " " + itemArray[arrnum][field2pos];
        selItemtxt += " " + document.getElementById("suffix").value;
    }
	else
	{	 
        selItemtxt += " " + tproduct;
            
        selItemtxt += " " + itemArray[arrnum][fieldpos];
        selItemtxt += " " + itemArray[arrnum][field2pos];
        selItemtxt += " " + document.getElementById("suffix").value;
	}
	
    document.getElementById("selItem").innerHTML = selItemtxt;
    
    if (tcount > -1)//then select item
		step3(tcount,tx);
}

var prevStep3 = null; 
function step3(rownum, arrnum)
{		
    var cursel = document.getElementById("trstep3" + rownum);        

	if (prevStep3 != null){
		prevStep3.style.backgroundColor = '#f0efef';
		prevStep3.style.color = 'black';
	}
	prevStep3 = cursel;
		
	cursel.style.backgroundColor = '#666666';
	cursel.style.color = '#ffffff';
	
	var field = document.getElementById("hidstep1").value;
	var field2 = document.getElementById("hidstep2").value;
	var field3 = document.getElementById("hidstep3").value;
	
	var fieldpos;
	if (field == "function")
		fieldpos = 1; 
	else if (field == "size")
		fieldpos = 2; 
	else if (field == "finish")
		fieldpos = 3;

	else if	(field == "product")//latches
	    fieldpos = 1;
	else if (field == "manufacturer")//latches
	    fieldpos = 2;
    else if (field == "backset")//latches
	    fieldpos = 11;
	else if (field == "handle")//latches
	    fieldpos = 12;    
	else if (field == "strike")//latches
	    fieldpos = 13;    
	else if (field == "hand")
	    fieldpos = 5;
			
	var field2pos;
	if (field2 == "size")
		field2pos = 2; 
	else if (field2 == "finish")
		field2pos = 3;
	else if (field2 == "hand")
	    field2pos = 5;
	else if (field2 == "strike")//latches
	    field2pos = 13;   
	        	
	var field3pos;
	if (field3 == "size")
		field3pos = 2;
	else if (field3 == "finish")
		field3pos = 3; 
				
	document.getElementById("head" + field3 + "Active").style.display = "none";
	document.getElementById("head" + field3 + "Inactive").style.display = "";
		
	document.getElementById("headqty").style.display = "";
	document.getElementById("headqtyInactive").style.display = "none";
   
    var tproduct = itemArray[arrnum][10];
	var tBackset = itemArray[arrnum][11];   
   
	//fill 'select qty box
	var lprice = itemArray[arrnum][6].replace('$','');
	lprice = lprice.replace(',','');
	var price = itemArray[arrnum][7].replace('$','');
	price = price.replace(',','');
	var difprice = lprice - price; 
    
	document.getElementById("tdDispList").innerHTML = itemArray[arrnum][6] + " Each";
	document.getElementById("tdDispPrice").innerHTML = itemArray[arrnum][7] + " Each";
	if (difprice > 0)
		document.getElementById("tdDispSave").innerHTML = formatCurrency(difprice) + " (" + itemArray[arrnum][8] + "%)";
	document.getElementById("ctl00_uxPlaceHolder_hidproductid").value = itemArray[arrnum][0];
	document.getElementById("ctl00_uxPlaceHolder_hidurlname").value = itemArray[arrnum][9];
	//document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";	
	//document.getElementById("total").value = "";
	//document.getElementById("hidprice").value = price;       
	
	//resetOptions();
	
	document.getElementById("tdprice").style.display = "";
	
	if (document.getElementById("ctl00_uxPlaceHolder_hasoptions").value == "yes")
	{
	    document.getElementById("ctl00_uxPlaceHolder_imgaddViewOptions").value = "Add / View Options";   
	}
	else
	{
	    document.getElementById("ctl00_uxPlaceHolder_imgaddViewOptions").value = "View / Add to Cart";
	}
	
    var selItemtxt = "";
	selItemtxt = "ABH";
	//selItemtxt += document.getElementById("series").value;	
	
	if (document.getElementById("level1").value == "1")//Overhead Holders And Stops
	{
	    selItemtxt += " " + itemArray[arrnum][field2pos];
	    selItemtxt += " " + itemArray[arrnum][field3pos];
        selItemtxt += " " + document.getElementById("suffix").value;
        selItemtxt += " " + itemArray[arrnum][fieldpos];
    }
    
    else
    {
        if (document.getElementById("series").value == '6000' || document.getElementById("series").value == '6100')//show backset from previous page
            selItemtxt += " " + document.getElementById("series").value + " " + tBackset;
        else if (document.getElementById("series").value == '6400-6500')
            selItemtxt += "";
        else
            selItemtxt += " " + tproduct;
        	
        selItemtxt += " " + itemArray[arrnum][fieldpos];
        selItemtxt += " " + itemArray[arrnum][field2pos];
	    selItemtxt += " " + itemArray[arrnum][field3pos];
        selItemtxt += " " + document.getElementById("suffix").value;
        
    }
    document.getElementById("selItem").innerHTML = selItemtxt;
}

function validateqty(elemqtyid)
{
    //var elemqty, elemtotal;
    //if (document.getElementById("ctl00_uxPlaceHolder_pnlSelectSingle")) // single product on page.
    //{
    //    elemqty = document.getElementById("ctl00_uxPlaceHolder_FormView2_quantitysingle");
    //    elemtotal = document.getElementById("totalsingle");
    //}
    //else // select list
    //{
    //    elemqty = document.getElementById("ctl00_uxPlaceHolder_quantity");
    //    elemtotal = document.getElementById("total");
    //}
    
    var elemqty = document.getElementById(elemqtyid);

    if (elemqty.value == '' || elemqty.value == 0){
        //elemtotal.value = "";
        alert("Please enter the quantity.");            
        elemqty.focus();
        return false;
    }
    return true;
}

//validates options - if user checked engraving but did not choose an engraving option
//function validateOptions()
//{
//    if (document.getElementById("ctl00_uxPlaceHolder_uxProductFormView_uxProductDetails_uxOptionGroupDetails_uxOptionDataList_ctl01_uxOptionItemDetails_chkRadioList"))
//    {
//        if (document.getElementById("ctl00_uxPlaceHolder_uxProductFormView_uxProductDetails_uxOptionGroupDetails_uxOptionDataList_ctl01_uxOptionItemDetails_chkRadioList").checked)
//        {
//            var isradiochked = false;
//            for (i=0; i<document.aspnetForm.elements.length; i++) 
//            { 
//		        elem = document.aspnetForm.elements[i];
//		        if (elem.type == "radio"){
//			        if (elem.checked) 
//			            isradiochked = true;
//		        } 
//	        }
//	        if (!isradiochked){
//	            alert("Please select an Engraving option");
//	            return false;
//	        }        
//        }        
//    }    
//    return true;
//}

//not used
function calculatePrice()
{  
    if (validateqty() == true){ 
		var elemqty, elemtotal;
        if (document.getElementById("ctl00_uxPlaceHolder_pnlSelectSingle")) // single product on page
        {
            elemqty = document.getElementById("ctl00_uxPlaceHolder_FormView2_quantitysingle");
            elemtotal = document.getElementById("totalsingle");
            elemprice = document.getElementById("ctl00_uxPlaceHolder_FormView2_hidpricesingle");
        }
        else // select list
        {
            elemqty = document.getElementById("ctl00_uxPlaceHolder_quantity");
            elemtotal = document.getElementById("total");
            elemprice = document.getElementById("hidprice");
        }
        var qty = elemqty.value;
		var price = elemprice.value;
		var optionprice = document.getElementById("hidoptionprice").value;
		var totalprice = parseFloat(price) + parseFloat(optionprice);
		elemtotal.value = formatCurrency(qty * totalprice);
	}
}

function validateaddtocart(curproductid, elemqtyid)
{
    if (validateqty(elemqtyid) == true){
		//var curproductid = document.getElementById("ctl00_uxPlaceHolder_hidproductid").value;
		//if (document.getElementById("ctl00_uxPlaceHolder_pnlSelectSingle")) 
		//    curproductid = document.getElementById("ctl00_uxPlaceHolder_FormView2_hidproductidsingle").value;	
 
		var curoptionsid = document.getElementById("hidoptionsid").value;
		
		//Check if product exists in cart.
		var inelem = document.getElementsByTagName("INPUT");				
		var j=0;
		for (i=0;i<inelem.length;i++){
			if (inelem[i].id.indexOf("idproductcart") > -1){
				if (curproductid == document.getElementById("idproductcart" + j).value && curoptionsid == document.getElementById("idoptionscart" + j).value){
					if (!confirm("This product is already in your cart.\nDo you want to add more?"))
						return false;
				}
				j++;
			}
		} 
		return true;       
    }
    else
        return false;
}

function setUserSelected()
{
	document.getElementById('userselected').value = 'yes';
}   

//Show popup of Overhead sizes
function showsize(cursel,arrnum)
{    
    getOptionPosition(cursel);
	
	document.getElementById("divsize").style.left = (posleft + 13) + "px";
	document.getElementById("divsize").style.top = (postop - 35) + "px";
	
	if (document.getElementById("divsize").style.display == "none"){
	    var str = '<b>Butts, Offset Pivots:</b> ' + itemArray[arrnum][11];
	    if (itemArray[arrnum][12] != "")
	        str += '<br><b>Center Hung:</b> ' + itemArray[arrnum][12];
	    document.getElementById("divsize").innerHTML = str;
	    document.getElementById("divsize").style.display = "";	
	}
	else
	    document.getElementById("divsize").style.display = "none";
}

//Show popup of leadlined, Bioguard AntiMicrobial Coating description
function showoptiondetail(cursel,notenum)
{    
    getOptionPosition(cursel);
	
	document.getElementById("divoptiondetail").style.left = (posleft + 13) + "px";
	document.getElementById("divoptiondetail").style.top = (postop - 35) + "px";
	
	var str = "";
	if (notenum == 1)
	    str = "Lead Lining is around the mortise lock case<br>(a flat sheet of lead on both side of the mortise case)";
	else if (notenum == 2)
	    str = "Lead Lining is around the cylindrical portion of the latch that is inside the door.";
	else if (notenum == 3)
	    str = "Only available on the following finishes:<br>US32D, US32, US26D, US26";
	    
	if (document.getElementById("divoptiondetail").style.display == "none"){	    
	    document.getElementById("divoptiondetail").innerHTML = str;
	    document.getElementById("divoptiondetail").style.display = "";	
	}
	else
	    document.getElementById("divoptiondetail").style.display = "none";
}

//Show large image of directions
function showLargeImage(curelem)
{
    //position the popopup
    getOptionPosition(curelem);	
	
	document.getElementById("divdescriptionlarge").style.left = (posleft - 50) + "px";
	document.getElementById("divdescriptionlarge").style.top = (postop -250) + "px";
    
    document.getElementById("divdescriptionlarge").style.display = ""; 
}

//Hide large image of directions
function hideLargeImage()
{
    document.getElementById("divdescriptionlarge").style.display = "none"; 
}

//show popup of selectedstep1image 
//function showSelectedImage(curelem)
//{
//    getOptionPosition(curelem);
	
//	document.getElementById("divselectedimage").style.left = (posleft + 140) + "px";
//	document.getElementById("divselectedimage").style.top = (postop - 100) + "px";
	
//	if (document.getElementById("divselectedimage").style.display == "none")
//	    document.getElementById("divselectedimage").style.display = "";	
//	else
//	    document.getElementById("divselectedimage").style.display = "none";
//}

//begining of functions to show options
//function setBioguardOption()
//{
//    var curproductid = document.getElementById("ctl00_uxPlaceHolder_hidproductid").value;
//    if (curproductid == ""){
//        alert("Please select a product and then you can select the options.");
//        return;
//    }   
    
    //find finish of current product to see if "Bioguard AntiMicrobial Coating" will be displayed
//    var curfinish = "";
//    for (var x=0;x<itemArray.length;x++)
//    {
//		if (itemArray[x][0] == curproductid){
//		    curfinish = itemArray[x][3];
//		}
//	}
	
//	var numcheckboxes = 0;
	
	//get tr element for bioguard 
//	var bioguardid = "";
//    var bioguardtr = "";
//	for (i=0; i<document.aspnetForm.elements.length; i++) 
//	{ 
//	    elem = document.aspnetForm.elements[i];
//	    if (elem.type == "hidden" && elem.id.indexOf("uxCheckboxIDHidden") > -1 && elem.value == "4"){	        
//		    bioguardid = elem.id;
//		    bioguardtr = bioguardid.replace("uxCheckboxIDHidden","CheckBoxTR");		    
//		}
		
		//count how many checkboxes besides bioguard
//		if (elem.type == "hidden" && elem.id.indexOf("uxCheckboxIDHidden") > -1 && elem.value != "4")
//            numcheckboxes ++;
//    }	
	
//	if (document.getElementById(bioguardtr))//there is a bioguard option
//	{
//	    if (curfinish == 'US32D' || curfinish == 'US32' || curfinish == 'US26D' || curfinish == 'US26')
//	        document.getElementById(bioguardtr).style.display = "";
//	    else//no bioguard
//	    {
//	        document.getElementById(bioguardtr).style.display = "none";
//	        if (numcheckboxes == 0)//then hide option button
//	            document.getElementById("tdoptionsNotSelected").style.display = "none";
//	    }
//	}
//}


//function displayOptions()
//{
//    var curproductid = document.getElementById("ctl00_uxPlaceHolder_hidproductid").value;
//    if (curproductid == ""){
//        alert("Please select a product and then you can select the options.");
//        return;
//    } 
    
//    if (numCkbox() == -1)
//        return;

//    scroll();
    
    //var iframe = document.getElementById("ctl00_uxPlaceHolder_iframeoptions");
    //iframe.src = "itemoptioniframe.aspx?productid=" + curproductid;  
      
//    document.getElementById("divoptionouter").style.display = "";
    
    //idOptionPrefix = "ctl00_uxPlaceHolder_uxOptionGroupDetails_uxOptionDataList_ctl0" + numCkbox() + "_uxOptionItemDetails_";
//    idOptionPrefix = "ctl00_uxPlaceHolder_uxProductFormView_uxProductDetails_uxOptionGroupDetails_uxOptionDataList" + numCkbox() + "_uxOptionItemDetails_";

//    if (document.getElementById(idOptionPrefix + "chkRadioList"))
//        displayRadioList(); 
//    else //No radio, so set position to position that hides radio
//    {        
//        var curelem = document.getElementById("tdselectedimage");
//        getOptionPosition(curelem);
//        document.getElementById("divoptionouter").style.left = (posleft + 500) + "px";
//        document.getElementById("divoptionouter").style.top = (postop - 100) + "px";
//    }   
//}

//function confirmRemoveOptions()
//{
//    if (document.getElementById("selOptions").innerHTML != "")//then there are options. So check if customer is ready to remove options
//    {
//        if (!confirm("If you change the product, your options will be removed.\nAre you sure you would like to continue?"))
//            return false;
//    }
//    return true;
//}

//if user selects a new product, then reset options on page
//function resetOptions()
//{
//    if (document.getElementById("ctl00_uxPlaceHolder_hasoptions").value == "no")
//        return;
        
//    document.getElementById("divoptionouter").style.display = "none";
//    document.getElementById("trOptionsPrices").style.display = "none";
//	document.getElementById("tdOptionsPrices").innerHTML = "";
//	clearOptions();	 
	
	//if there is no product selected, hide options button
//	var curproductid = document.getElementById("ctl00_uxPlaceHolder_hidproductid").value;
//    if (curproductid == "")
//        document.getElementById("tdoptionsNotSelected").style.display = "none";
//    else//there is a product selected, so update option list
//    {
//        setBioguardOption(); 
//    }
//}

//not used
function clearOptions()
{
    for (i=0; i<document.aspnetForm.elements.length; i++) { 
		elem = document.aspnetForm.elements[i];
		if (elem.type == "checkbox" || elem.type == "radio")
			elem.checked = false;
	}
	if (document.getElementById("RadioListTr"))
	    hideRadioList();
	document.getElementById("tdoptionsSelected").style.display = "none";
	
	var curproductid = document.getElementById("ctl00_uxPlaceHolder_hidproductid").value;
    if (curproductid != "")
    {
	    document.getElementById("tdoptionsNotSelected").style.display = "";
	    document.getElementById("tdoptionsNotSelected").style.padding = "6px";
	}
	
	document.getElementById("lblSelectedOptions").innerHTML = "";
	
	document.getElementById("seloptionstr").style.display = "none";
	document.getElementById("selOptions").innerHTML = "";
}

//var idOptionPrefix;

//function numCkbox()
//{
//    var n = 0;
//    for (i=0; i<document.aspnetForm.elements.length; i++) { 
//		elem = document.aspnetForm.elements[i];
//		if (elem.type == "checkbox")
//			n ++;
//	}
//    return n-1;
//}



function updateOptions(curelem)
{
    var seloptionitemid = "";
    var totaloptionsid = "";
    
    for (i=0; i<document.aspnetForm.elements.length; i++) 
    { 
        elem = document.aspnetForm.elements[i];
        if (elem.type == "checkbox" || elem.type == "radio")
        {
	        if (elem.checked)
	        { 
	            //Checkbox - optionid is in hidden field
	            if (elem.id.indexOf("uxOptionCheckBox") > -1)
	            {
	                chkelem = elem.id.replace("uxOptionCheckBox", "uxCheckboxIDHidden");	
	                seloptionitemid = document.getElementById(chkelem).value; 
	                if (totaloptionsid == "")
	                    totaloptionsid = seloptionitemid;
	                else
	                    totaloptionsid += "," + seloptionitemid;   
                }
                //radio - optionid is radio value
                else if (elem.id.indexOf("uxOptionRadioButtonList") > -1)
                {
                    chkelem = elem.id;	
	                seloptionitemid = document.getElementById(chkelem).value;  
	                
	                if (seloptionitemid != "")//check if option selected has a value (not standard)
	                {
                        if (totaloptionsid == "")
	                        totaloptionsid = seloptionitemid;
	                    else
	                        totaloptionsid += "," + seloptionitemid;    
	                } 
                }                
	        }
	    }
	}
	
	var curoptionitemid = "";
	    
    //adds/remove to hidoptionsid the current selected options
	if (totaloptionsid == "")//then no options
	{    
	    document.getElementById("hidoptionsid").value = "";	    
	}
	else//there are options
	{	    
	    document.getElementById("hidoptionsid").value = totaloptionsid;
	}		
	
	//alert(totaloptionsid);
}

//Show popup of option picture
function showImage(curelem, fullimageurl, description)
{
    curelem.className = "txtLinkOver";
    
    //clear the for attribute so that a click on the label does not select the radio element
    curelem.parentNode.htmlFor = "";
    
    intxt = "<table cellpadding='0' cellspacing='0' align='center'>";
    intxt += "<tr><td><img src='" + fullimageurl + "'></td></tr>";
    intxt += "<tr><td align='center'><b>" + description + "</b></td></tr>";
    intxt += "</table>";
    document.getElementById("divdescription").innerHTML = intxt;
    
    //position the popopup
    getOptionPosition(curelem);	
	
	document.getElementById("divdescription").style.left = (posleft) + "px";
	document.getElementById("divdescription").style.top = (postop - 270) + "px";
    
    document.getElementById("divdescription").style.display = "";    
}

//hide popup of option picture
function hideImage(curelem)
{
    curelem.className = "txtLink";   
    document.getElementById("divdescription").style.display = "none";
}


//not used                      
function saveOptions()
{
    if (document.getElementById(idOptionPrefix + "chkRadioList"))
    {
        if (document.getElementById(idOptionPrefix + "chkRadioList").checked)
        {
            var isradiochked = false;
            for (i=0; i<document.aspnetForm.elements.length; i++) 
            { 
		        elem = document.aspnetForm.elements[i];
		        if (elem.type == "radio"){
			        if (elem.checked) 
			            isradiochked = true;
		        } 
	        }
	        if (!isradiochked){
	            alert("Please select an Engraving option");
	            return;
	        }        
        }
    }
    
    //clear current qty
    document.getElementById("ctl00_uxPlaceHolder_quantity").value = "";	
    document.getElementById("total").value = "";
    
    //fill options label
    var txtlbl = "";
    var txtprice = "";
    var curoptionitemid = "";
    var curoptionvalue = "";
    var curoptionprice = "";
    var curoptionlabel = "";
    var totalOptionPrice = 0;
    var totaloptionsid = "";

    for (i=0; i<document.aspnetForm.elements.length; i++) 
    { 
        elem = document.aspnetForm.elements[i];
        if (elem.type == "checkbox" || elem.type == "radio")
        {
	        if (elem.checked)
	        { 
	            if (elem.id.indexOf("uxOptionCheckBox") > -1)//then it's ONLY a checkbox - not a checkbox with radio options
	            {
	                chkelem = elem.id.replace("uxOptionCheckBox", "uxCheckboxIDHidden");	
	                curoptionitemid = document.getElementById(chkelem).value; 
	                if (totaloptionsid == "")
	                    totaloptionsid = curoptionitemid;
	                else
	                    totaloptionsid += "," + curoptionitemid;         
                
                    //options label
                    for (var x=0;x<optionArray.length;x++)
                    {
                        if (optionArray[x][1] == curoptionitemid)
                        {
                            curoptionvalue = optionArray[x][2];
                            curoptionprice = optionArray[x][3];
                            curoptionlabel = optionArray[x][4]; 
                        }
                    }                
                }
                else if (elem.id.indexOf("uxOptionRadioButtonList") > -1)
                {
                    chkelem = elem.id;	
	                curoptionitemid = document.getElementById(chkelem).value;                
                    if (totaloptionsid == "")
	                    totaloptionsid = curoptionitemid;
	                else
	                    totaloptionsid += "," + curoptionitemid; 
                    
                    //options label
                    for (var x=0;x<optionArray.length;x++)
                    {
                        if (optionArray[x][1] == curoptionitemid)
                        {
                            curoptionvalue = optionArray[x][0] + " " + optionArray[x][2];
                            curoptionprice = optionArray[x][3];
                            curoptionlabel = optionArray[x][0] + " " + optionArray[x][4];
                        }
                    }                 
                }
                else
                {
                    curoptionitemid = "";
                    curoptionvalue = "";
                    curoptionprice = ""; 
                    curoptionlabel = "";               
                }
                
                if (curoptionitemid != "")//then fill option label and price breakdown
                {
                    if (txtlbl == "")
                        txtlbl = curoptionvalue;                        
                    else
                        txtlbl += ", " + curoptionvalue;                        
                    
                    //show breakdown of additional charges
                    if (curoptionprice != "$0.00")
                    {
                        if (txtprice == "")
                        {
                            txtprice = curoptionlabel + ": " + curoptionprice;    
                            curoptionprice = curoptionprice.replace('$','');
	                        curoptionprice = curoptionprice.replace(',','');                    
                            totalOptionPrice = parseFloat(curoptionprice);
                        }
                        else
                        {
                            txtprice += "<br>" + curoptionlabel + ": " + curoptionprice; 
                            curoptionprice = curoptionprice.replace('$','');
	                        curoptionprice = curoptionprice.replace(',',''); 
                            totalOptionPrice += parseFloat(curoptionprice);
                        }
                    }
                }
	        }
	    }
	}
	
	
	if (txtlbl == "")//then no options
	{
	    document.getElementById("tdoptionsSelected").style.display = "none";
	    document.getElementById("tdoptionsNotSelected").style.display = "";
	    document.getElementById("lblSelectedOptions").innerHTML = "";
	    
	    document.getElementById("seloptionstr").style.display = "none";
	    document.getElementById("selOptions").innerHTML = "";
	    
	    document.getElementById("hidoptionsid").value = "";
	}
	else
	{
	    document.getElementById("tdoptionsSelected").style.display = "";
	    document.getElementById("tdoptionsNotSelected").style.display = "none";
	    document.getElementById("lblSelectedOptions").innerHTML = txtlbl;
	    
	    document.getElementById("seloptionstr").style.display = "";
	    document.getElementById("selOptions").innerHTML = "Options: " + txtlbl;
	    
	    document.getElementById("hidoptionsid").value = totaloptionsid;
	}
	 
	if (totalOptionPrice == 0)//then no additional charges    
	{
	    document.getElementById("tdDispPricelbl").innerHTML = "Your Price: ";    
	    
	    document.getElementById("trOptionsPrices").style.display = "none";
	    document.getElementById("tdOptionsPrices").innerHTML = "";
	    document.getElementById("hidoptionprice").value = 0;
	}
	else //options
	{
	    document.getElementById("tdDispPricelbl").innerHTML = "Base Price: ";	    
	    
	    document.getElementById("trOptionsPrices").style.display = "";
	    document.getElementById("tdOptionsPrices").innerHTML = txtprice;	    
	    var baseprice = document.getElementById("hidprice").value;	    
	    document.getElementById("itemOptionPrice").innerHTML = formatCurrency(parseFloat(baseprice) + totalOptionPrice);
	    document.getElementById("hidoptionprice").value = totalOptionPrice;
	}
	
	document.getElementById('divoptionouter').style.display = 'none';
}

//function to show radio option list
//function displayRadioList(chkRadioList)
//{        
    //if (document.getElementById(idOptionPrefix + "chkRadioList").checked)
//    if (document.getElementById(chkRadioList).checked)
//        showRadioList();
//    else
//        hideRadioList();        
//}


//function showRadioList()
//{
//    var radiotr = document.getElementById("RadioListTr");    
    
//    radiotr.style.display = "";
    //document.getElementById("divoptioninner").style.height = "350px";
    //document.getElementById("divoptioninner").style.width = "785px";
    //document.getElementById("divoptionouter").style.height = "390px";
    //document.getElementById("divoptionouter").style.width = "788px"; 
    
    //set position    
    //var curelem = document.getElementById("tdselectedimage");
    //getOptionPosition(curelem);        
    //document.getElementById("divoptionouter").style.left = (posleft - 20) + "px";
    //document.getElementById("divoptionouter").style.top = (postop - 300) + "px";
//}

//function hideRadioList()
//{
//    for (i=0; i<document.aspnetForm.elements.length; i++) { 
//		elem = document.aspnetForm.elements[i];
//		if (elem.type == "radio")
//			elem.checked = false; 
//	}
    
//    var radiotr = document.getElementById("RadioListTr");
    
//    radiotr.style.display = "none";
    //document.getElementById("divoptioninner").style.height = "130px";
    //document.getElementById("divoptioninner").style.width = "200px";  
    //document.getElementById("divoptionouter").style.height = "170px";
    //document.getElementById("divoptionouter").style.width = "203px";    
    
    //set position
    //var curelem = document.getElementById("tdselectedimage");
    //getOptionPosition(curelem);
    //document.getElementById("divoptionouter").style.left = (posleft + 500) + "px";
    //document.getElementById("divoptionouter").style.top = (postop - 100) + "px";
//}

//end of functions to show options

function scroll()
{
  scrollTo(0,0);
}