	/**
	 * selecing sizes for perticular sizecodes
	 */
	function wizItemchange( sizeCode, objName)
	{
		objName = document.getElementById("OBJ_NAME").value;
		var url = "/ibase/ProdWizItemChangeServlet?SIZECODE="+sizeCode+"&OBJ_NAME="+objName;
		
		/*$.ajax({
			  async: false,
			  url: url,
			  dataType: 'text',
			  type: 'POST',
			  success: function(result) {
				  
				  alert("Records Found!"+result);
				  setColumnValues(result);
			  }, 
			error: function(result) {
				
				alert("Records Not Found!", "Operation Failed!");
			}
		});*/
		
		makeRequest( url, setColumnValues);
	}

	/**
	 * creating size details table
	 */
	function appendSizesRow() {
		
		$("#sizeDtl").remove();
		
		$("#sizeDtlDiv").append(
				
			"<table class='tableClass' id='sizeDtl' width='100%' style='text-align: left;'>" +
			
			"<thead><tr class='thClass'><th style='width:10%'><input type='checkbox' id='chkSizeDtl' onclick='checkAllSizes(this)'></th><th>Sizes</th><th>Desc</th></tr></thead>" +
			
			"<tbody class='table-body fadeInDown'>" +
			
			"</tbody>" +
			
			"</table>"
		);
	}
	
	/**
	 * check all sizes
	 */
	function checkAllSizes(element) 
	{
		checkAll(element);
		sizeValues();
	}
	
	/**
	 * values of selected sizes
	 */
	function sizeValues()
	{
		var count = $('#sizeDtl tbody tr').length;

		var sizeDesc = "";
		
		/*alert("count "+count);*/
		
		for (var i = 0; i < count; i++)
		{
			if (document.getElementById("chkid"+i).checked == true)
			{
				sizeDesc = sizeDesc + document.getElementById("chkid"+i).value + ",";
			}
		}
		
		document.getElementById("Detail1.1.size_type").value = sizeDesc;
	}
	
	/**
	 * selecting size clicking on rows
	 */
	function chkSizes(event, id)
	{
		if (event.target.type !== 'checkbox') 
		{
			if ( document.getElementById("chkid"+id).checked )
			{
				document.getElementById("chkid"+id).checked = false;
			}
			else
			{
				document.getElementById("chkid"+id).checked = true;
			}
		}
		
		sizeValues();
	}
	
	/* ********************** Screen - I PriceList Table ************************** */
	
	/**
	 * creating site details table
	 */
	function createSitesTab(site, price, num, siteDesc)
	{
		$("#priceListDtl tbody").append(
				
			"<tr>"+
			
				"<td width='70%'><input type='hidden' id=prodsSite"+num+" value="+ site +" /><lable id=lblSite"+num+">"+ site +"</lable></td>"+
				
				"<td width='20%'>" +
					"<div style='position:relative; width: 100%;'>" +
						"<input type='text' class='editInputClass' id=prodsPriceList"+num+" value='"+ price +"' style='width: 90%;' />" +
						"<div style='width:2%; float: right'>" +
							"<img src='/ibase/webitm/images/DD/popup1.png' id=priceList"+num+" style='margin-left: -5px;' />" +
						"</div>" +
					"</div>" +
				"</td>"+

				"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=prodsRate"+num+" size='8' value='0.000' style='text-align: right;' onchange='return isNumeric(this)' />" +
				"</td>" +
				
				/*"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=prodsCost"+num+" size='10' value='0.000' style='text-align: right;' onchange='return isValidCosts(this)' />" +
				"</td>" +*/
				
				"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=dtsFrom"+num+" size='9'  style='text-align: right;' readonly='1' />" +
				"</td>"+
				
				"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=dtsTo"+num+" size='9' style='text-align: right;' readonly='1' />" +
				"</td>"+
			
			"</tr>"
		);
		
		document.getElementById("lblSite"+num).title = siteDesc;
		
		document.getElementById("dtsFrom"+num).value = formatDate(currDate);
		document.getElementById("dtsTo"+num).value = formatDate(tommorrowDate);
		
		/*minDate: -20, maxDate: "+1M +10D", changeMonth: true, changeYear: true,*/
		$(function() {
			
			$( "#dtsFrom"+num ).datepicker(
				{ minDate: 0, changeMonth: true, changeYear: true, dateFormat : "dd/mm/y",
					onSelect: function( selectedDate ) {
						$( "#dtsTo"+num ).datepicker( "option", "minDate", selectedDate );
						$( "#dtsTo"+num ).datepicker( "option", "dateFormat", "dd/mm/y" );
				}
			});
			
			$( "#dtsTo"+num ).datepicker(
				{ minDate: 0, changeMonth: true, changeYear: true, dateFormat : "dd/mm/y",
					onSelect: function( selectedDate ) {
						$( "#dtsFrom"+num ).datepicker( "option", "maxDate", selectedDate );
						$( "#dtsFrom"+num ).datepicker( "option", "dateFormat", "dd/mm/y" );
				}
			});
		});
		
		/*document.getElementById("fromDt"+num).setAttribute("onclick", "selectedObj = 'dtsFrom"+num+"'; javascript:show_calendar('dtsFrom"+num+"','','','DD/MM/YY');");
		document.getElementById("toDt"+num).setAttribute("onclick", "selectedObj = 'dtsTo"+num+"'; javascript:show_calendar('dtsTo"+num+"','','','DD/MM/YY');");*/
		document.getElementById("priceList"+num).setAttribute("onclick", "javascript:callListJSP('{normalize-space($dbID)}','{normalize-space($login_code)}','pricelist', 'Price List', this.id);");
	}
	
	/**
	 * setting sites pricelist details
	 */
	function setPriceListDetails()
	{
		var count = $('#priceListDtl tbody tr').length;
		
		var price = "";
    	
    	for (var i = 0; i < count; i++)
    	{
    		var prodSite 		= document.getElementById("prodsSite"+i).value;
    		var prodPriceList 	= document.getElementById("prodsPriceList"+i).value;
			var prodRate		= document.getElementById("prodsRate"+i).value;
			/*var prodCost 		= document.getElementById("prodsCost"+i).value;*/
			var dtFrom 			= document.getElementById("dtsFrom"+i).value;
			var dtTo 			= document.getElementById("dtsTo"+i).value;
			
			if (prodPriceList == "")
			{
				alert("Please Select Price List for Site '"+ prodSite +"'.");
				document.getElementById("prodsPriceList"+i).focus();
				return false;
			}
			else if (prodRate == "")
			{
				alert("Please Enter Rate for Site '"+ prodSite +"'.");
				document.getElementById("prodsRate"+i).focus();
				return false;
			}
			/*else if (prodCost == "")
			{
				alert("Please Enter Cost for Site '"+ prodSite +"'.");
				document.getElementById("prodsCost"+i).focus();
				return false;
			}*/
			else if (dtFrom == "")
			{
				alert("Please Select From Date for Site '"+ prodSite +"'.");
				document.getElementById("dtsFrom"+i).focus();
				return false;
			}
			else if (dtFrom.length == 10)
			{
				alert("Please Select Valid From Date for Site '"+ prodSite +"'.");
				document.getElementById("dtsFrom"+i).focus();
				return false;
			}
			else if (dtTo == "")
			{
				alert("Please Select To Date for Site '"+ prodSite +"'.");
				document.getElementById("dtsTo"+i).focus();
				return false;
			}
			else if (dtTo.length == 10)
			{
				alert("Please Select Valid To Date for Site '"+ prodSite +"'.");
				document.getElementById("dtsTo"+i).focus();
				return false;
			}
			else
			{
				/*price = price + "||1:" + prodSite + ":" + prodPriceList + ":" + prodRate + ":" + prodCost + ":" + dtFrom + ":" + dtTo;*/
				price = price + "||1:" + prodSite + ":" + prodPriceList + ":" + prodRate + ":" + "0" + ":" + dtFrom + ":" + dtTo;
			}
			
    	}
    	
    	document.getElementById("Detail1.1.price_list_dtl").value = price.substring(2,price.length);
    	
    	return true;
	}

	/* ********************** Screen - I Supplier List Table ************************** */
	
	/**
	 * creating supplier details table
	 */
	function createSupplierTab(supplier, price, num, suppDesc)
	{
		$("#suppListDtl tbody").append(
				
			"<tr >"+
			
				"<td width='80%'><input type='hidden' id=Supp"+num+" value='' /><lable id=lblSupp"+num+">"+ supplier +"</lable></td>"+
				
				"<td width='5%'>" +
					"<input type='hidden' class='editInputClass' id=SuppPriceList"+num+" value='"+ price +"' /><lable id=lblSuppPriceList"+num+">"+ price +"</lable>" + 
				"</td>"+

				"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=SuppProdCost"+num+" size='8' value='0.000' style='text-align: right;' " +
							" onchange='return isNumeric(this)' />" +
				"</td>" +
				
				/*"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=prodsCost"+num+" size='10' value='0.000' style='text-align: right;' onchange='return isValidCosts(this)' />" +
				"</td>" +*/
				
				"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=SuppDtFrom"+num+" size='9'  style='text-align: right;' readonly='1' />" +
				"</td>"+
				
				"<td width='5%'>" +
					"<input type='text' class='editInputClass' id=SuppDtTo"+num+" size='9' style='text-align: right;' readonly='1' />" +
				"</td>"+
			
			"</tr>"
		);
		
		document.getElementById("Supp"+num).value = supplier;
		
		document.getElementById("lblSupp"+num).title = suppDesc;
		
		document.getElementById("SuppDtFrom"+num).value = formatDate(currDate);
		document.getElementById("SuppDtTo"+num).value = formatDate(tommorrowDate);
		
		/*minDate: -20, maxDate: "+1M +10D", changeMonth: true, changeYear: true,*/
		$(function() {
			
			$( "#SuppDtFrom"+num ).datepicker(
				{ minDate: 0, changeMonth: true, changeYear: true, dateFormat : "dd/mm/y",
					onSelect: function( selectedDate ) {
						$( "#SuppDtTo"+num ).datepicker( "option", "minDate", selectedDate );
						$( "#SuppDtTo"+num ).datepicker( "option", "dateFormat", "dd/mm/y" );
					}
				});
			
			$( "#SuppDtTo"+num ).datepicker(
				{ minDate: 0, changeMonth: true, changeYear: true, dateFormat : "dd/mm/y",
					onSelect: function( selectedDate ) {
						$( "#SuppDtFrom"+num ).datepicker( "option", "maxDate", selectedDate );
						$( "#SuppDtFrom"+num ).datepicker( "option", "dateFormat", "dd/mm/y" );
					}
				});
		});
		
		/*document.getElementById("fromDt"+num).setAttribute("onclick", "selectedObj = 'dtsFrom"+num+"'; javascript:show_calendar('dtsFrom"+num+"','','','DD/MM/YY');");
		document.getElementById("toDt"+num).setAttribute("onclick", "selectedObj = 'dtsTo"+num+"'; javascript:show_calendar('dtsTo"+num+"','','','DD/MM/YY');");*/
		/*document.getElementById("priceList"+num).setAttribute("onclick", "javascript:callListJSP('{normalize-space($dbID)}','{normalize-space($login_code)}','pricelist', 'Price List', this.id);");*/
	}
	
	/**
	 * setting supplier cost details
	 */
	function setSuppListDetails()
	{
		var count = $('#suppListDtl tbody tr').length;
		
		var SuppList = "";
    	
    	for (var i = 0; i < count; i++)
    	{
    		var Supp 			= document.getElementById("Supp"+i).value;
    		var SuppPriceList 	= document.getElementById("SuppPriceList"+i).value;
			var SuppProdCost 	= document.getElementById("SuppProdCost"+i).value;
			var SuppDtFrom 		= document.getElementById("SuppDtFrom"+i).value;
			var SuppDtTo 		= document.getElementById("SuppDtTo"+i).value;
			
			if (SuppProdCost == "")
			{
				alert("Please Enter Cost for Supplier '"+ Supp +"'.");
				document.getElementById("SuppProdCost"+i).focus();
				return false;
			}
			else if (SuppDtFrom == "")
			{
				alert("Please Select From Date for Supplier '"+ Supp +"'.");
				document.getElementById("SuppDtFrom"+i).focus();
				return false;
			}
			else if (SuppDtFrom.length == 10)
			{
				alert("Please Select Valid From Date for Supplier '"+ Supp +"'.");
				document.getElementById("SuppDtFrom"+i).focus();
				return false;
			}
			else if (SuppDtTo == "")
			{
				alert("Please Select To Date for Supplier '"+ Supp +"'.");
				document.getElementById("SuppDtTo"+i).focus();
				return false;
			}
			else if (SuppDtTo.length == 10)
			{
				alert("Please Select Valid To Date for Site '"+ prodSite +"'.");
				document.getElementById("SuppDtTo"+i).focus();
				return false;
			}
			else
			{
				SuppList = SuppList + "||1:" + Supp + ":" + SuppPriceList + ":" + SuppProdCost + ":" + SuppDtFrom + ":" + SuppDtTo;
			}
			
    	}
    	
    	document.getElementById("Detail1.1.supp_item_desc").value = SuppList.substring(2,SuppList.length);
    	
    	return true;
	}
	
	/* ********************** checkNullvalidation ************************** */
	
	/**
	 * form-I validation on submit
	 */
	function checkNullvalidation()
	{
		if (document.getElementById("Detail1.1.item_parnt").value == "")
		{
			alert("Please Enter Parent Code.");
			return false;
		}
		else if (document.getElementById("Detail1.1.item_parnt_desc").value == "")
		{
			alert("Please Enter Parent Code Description.");
			document.getElementById("Detail1.1.item_parnt_desc").focus();
			return false;
		}
		/*else if (document.getElementById("Detail1.1.item_type").value == "")
		{
			alert("Please Enter Product Type.");
			document.getElementById("Detail1.1.item_type").focus();
			return false;
		}*/
		else if (document.getElementById("Detail1.1.descr").value == "")
		{
			alert("Please Enter Item Description.");
			document.getElementById("Detail1.1.descr").focus();
			return false;
		}
		else if (document.getElementById("Detail1.1.item_ser").value == "")
		{
			alert("Please Select Item Series.");
			document.getElementById("Detail1.1.item_ser").focus();
			return false;
		}
		/*else if (document.getElementById("Detail1.1.grp_code").value == "")
		{
			alert("Please Select Group Code.");
			document.getElementById("Detail1.1.grp_code").focus();
			return false;
		}*/
		else if (document.getElementById("Detail1.1.item_category").value == "")
		{
			alert("Please Select Item Category.");
			document.getElementById("Detail1.1.item_category").focus();
			return false;
		}
		else if (document.getElementById("Detail1.1.supp_code").value == "")
		{
			alert("Please Select Supplier.");
			document.getElementById("Detail1.1.supp_code").focus();
			return false;
		}
		else if (!setSuppListDetails())
		{
			return false;
		}
		else if (document.getElementById("Detail1.1.site_codes").value == "")
		{
			alert("Please Select Site Availability.");
			document.getElementById("Detail1.1.site_codes").focus();
			return false;
		}
		else if (!setPriceListDetails())
		{
			return false;
		}
		/*else if (document.getElementById("Detail1.1.dimension_desc").value == "")
		{
			alert("Please Select Dimension.");
			document.getElementById("Detail1.1.dimension_desc").focus();
			return false;
		}*/
		
		else if (document.getElementById("Detail1.1.color_codes").value == "")
		{
			alert("Please Select Color Availability.");
			document.getElementById("Detail1.1.color_codes").focus();
			return false;
		}
		/*else if (document.getElementById("Detail1.1.size_codes").value == "")
		{
			alert("Please Select Size Availability.");
			document.getElementById("Detail1.1.size_codes").focus();
			return false;
		}*/
		else if (document.getElementById("Detail1.1.size_codes").value != "" && document.getElementById("Detail1.1.size_type").value == "")
		{
			alert("Please Select Size.");
			document.getElementById("Detail1.1.size_type").focus();
			return false;
		}
		
		document.getElementById("action").value = 'next';
		return true;
	}
	
	/* ********************** onPageLoad ************************** */
	
	/**
	 * onload function for assigning values
	 */
	function pageLoad()
	{
		var suppliers = document.getElementById("Detail1.1.supp_code").value;
		
		var suppDescs = document.getElementById("Detail1.1.supplier_desc").value;
		
		if (suppliers != "")
		{
			var supplier = suppliers.split(",");
			var suppDesc = suppDescs.split(":");
			var num = 0;
			
			/*document.getElementById("suppListTr").style.display 	= "";*/
			document.getElementById("suppListDtl").style.visibility = "visible";
			$("#suppListDtl tbody").empty();
			
			/*for (var i = 0; i < supplier.length; i++)
			{
				
				num++;
			}*/
			
			var suppListDtl = document.getElementById("Detail1.1.supp_item_desc").value;
			
			if (suppListDtl != "")
			{
				var suppList = suppListDtl.split("||");
				
				for (var i = 0; i < suppList.length; i++)
				{
					var suppLists = suppList[i].split(":");
					
					createSupplierTab(suppLists[1], suppLists[2], i, suppDesc[i]);
					
					document.getElementById("Supp"+i).value 			= suppLists[1];
					document.getElementById("SuppPriceList"+i).value	= suppLists[2];
					document.getElementById("lblSuppPriceList"+i).innerHTML	= suppLists[2];
					document.getElementById("SuppProdCost"+i).value 	= suppLists[3];
					document.getElementById("SuppDtFrom"+i).value 		= suppLists[4];
					document.getElementById("SuppDtTo"+i).value 		= suppLists[5];
				}
			}
			
			document.getElementById("supplier_desc").innerHTML = suppliers;
		}
		
		var sites = document.getElementById("Detail1.1.site_codes").value;
		
		var sitesDescs = document.getElementById("Detail1.1.site_desc").value;
		
		if (sites != "")
		{
			var site = sites.split(",");
			var siteDesc = sitesDescs.split(",");
			var num = 0;
			
			/*document.getElementById("priceListTr").style.display 	= "";*/
			document.getElementById("priceListDtl").style.visibility = "visible";
			$("#priceListDtl tbody").empty();
			
			for (var i = 0; i < site.length; i++)
			{
				createSitesTab(site[i], "", num, siteDesc[i]);
				num++;
			}
			
			var priceListDtl = document.getElementById("Detail1.1.price_list_dtl").value;
			
			if (priceListDtl != "")
			{
				var prodPrice = priceListDtl.split("||");
				
				for (var i = 0; i < prodPrice.length; i++)
				{
					var prodPrice1 = prodPrice[i].split(":");
					
					document.getElementById("prodsSite"+i).value 	= prodPrice1[1];
					document.getElementById("prodsPriceList"+i).value= prodPrice1[2];
					document.getElementById("prodsRate"+i).value 	= prodPrice1[3];
					/*document.getElementById("prodsCost"+i).value 	= prodPrice1[4];*/
					document.getElementById("dtsFrom"+i).value 		= prodPrice1[5];
					document.getElementById("dtsTo"+i).value 		= prodPrice1[6];
				}
			}
			
			document.getElementById("site_codes").innerHTML = sites;
		}
		
		var sizes = document.getElementById("Detail1.1.size_codes").value;
		
		if (sizes != "")
		{
			wizItemchange(sizes, "l");
			
			var sizeDesc = document.getElementById("Detail1.1.size_type").value;
			
			var size = sizeDesc.split(",");
			
			var count = $('#sizeDtl tbody tr').length;
			
			for (var i = 0; i < count; i++)
			{
				for (var j = 0; j < size.length; j++)
				{
					if (document.getElementById("chkid"+i).value == size[j])
					{
						document.getElementById("chkid"+i).checked = true;
					}
				}
			}
			
			chkAllCheckbox(count, "chkid", "chkSizeDtl");
		}
		
		var dimension = document.getElementById("Detail1.1.dimension_desc").value;
		
		if (dimension != "")
		{
			document.getElementById("dimension_desc").innerHTML = dimension;
		}
		
		var category = document.getElementById("Detail1.1.item_category").value;
		
		if (category != "")
		{
			document.getElementById("item_category").innerHTML = category;
		}
		
		var colors = document.getElementById("Detail1.1.color_code_descr").value;
		
		if (colors != "")
		{
			document.getElementById("color_code_descr").innerHTML = colors;
		}
	}
	
	/* ********************** openSearchPopup on 'F2' ************************** */
	
	/**
	 * Pressing 'F2' open popup
	 */
	function openSearchPopup(event, dbid, logincode, field, filedName, value) 
	{
		if(event.keyCode == 113) 
		{
			callListJSP(dbid, logincode, field, filedName, value);
		}
	}
