/* Making a request.*/
function createRequestObject()
{
/* Initialising the variable xmlhttp */
	var xmlhttp=false;
	
/* Try and catch block for creating xmlhttp object according to the browser */
	try
	{
	/* The xmlhttp object is built into the Microsoft XML Parser. */
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try 
		{
		/* The xmlhttp object is built into the Microsoft IE. */
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (E) 
		{
			xmlhttp = false;
		}
	}
/* The xmlhttp object is built into the browsers other than Microsoft IE. */
	if (!xmlhttp && typeof XMLHttpRequest!='undefined')
	{
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function showsubsubcategory(subcatid,catid,position,cat_name,Sub_Cat_Name,pack)
{
	
	var request = createRequestObject();
	var today = new Date();

	
		request.open('GET', 'action.asp?scatid=' + subcatid+'&catid='+catid+'&cat_name='+cat_name+'&Sub_Cat_Name='+Sub_Cat_Name+'&act=1&temp='+today, true);
		
		var layername;
		layername = "div"+position;
		
		request.onreadystatechange = function()
		{
			if(request.readyState == 4)
			{
				if(request.status == 200)
				{
					var response = request.responseText;
					
					if(response==""){
						//alert("dev")
						var ctr = document.getElementById('packaging');
						ctr.style.display='inline';

						document.getElementById('Linc').style.display="none";
						document.getElementById('Uniball').style.display="none";
						document.getElementById('Bensia').style.display="none";
						document.getElementById('Lamy').style.display="none";
						document.getElementById('export_products').style.display="none";
						document.getElementById('package').style.display="block";
						//alert(layername)
						var c = document.getElementById('content');
						c.style.display='none';
						var ctrl = document.getElementById('showfirst');
						ctrl.style.display='none';
					}
					else{
					//alert("re::"+response)
					document.getElementById(layername).innerHTML = response;
					}
				}
			}
		}
	request.send(null);
}


function displaycontent(catid,scatid,sscatid,cat_name,Sub_Cat_Name)
{
	
		if(Sub_Cat_Name == "Linc"){
			document.getElementById('Linc').style.display="block";
			document.getElementById('Uniball').style.display="none";
			document.getElementById('Bensia').style.display="none";
			document.getElementById('Lamy').style.display="none";
			document.getElementById('export_products').style.display="none";
			document.getElementById('package').style.display="none";
			document.getElementById('lmy').style.display="none";
		}
		else if(Sub_Cat_Name == "Uniball"){
			document.getElementById('Uniball').style.display="block";
			document.getElementById('Linc').style.display="none";
			document.getElementById('Bensia').style.display="none";
			document.getElementById('Lamy').style.display="none";
			document.getElementById('export_products').style.display="none";
			document.getElementById('package').style.display="none";
			document.getElementById('lmy').style.display="none";
		}
		else if(Sub_Cat_Name == "Bensia"){
			document.getElementById('Uniball').style.display="none";
			document.getElementById('Linc').style.display="none";
			document.getElementById('Bensia').style.display="block";
			document.getElementById('Lamy').style.display="none";
			document.getElementById('export_products').style.display="none";
			document.getElementById('package').style.display="none";
			document.getElementById('lmy').style.display="none";
		}
		else if(Sub_Cat_Name == "Lamy"){
			document.getElementById('Uniball').style.display="none";
			document.getElementById('Linc').style.display="none";
			document.getElementById('Bensia').style.display="none";
			document.getElementById('Lamy').style.display="block";
			document.getElementById('export_products').style.display="none";
			document.getElementById('package').style.display="none";
		}
		else if(Sub_Cat_Name == "Export"){
			document.getElementById('Uniball').style.display="none";
			document.getElementById('Linc').style.display="none";
			document.getElementById('Bensia').style.display="none";
			document.getElementById('Lamy').style.display="none";
			document.getElementById('export_products').style.display="block";
			document.getElementById('package').style.display="none";
			document.getElementById('lmy').style.display="none";
		}
		else{
			document.getElementById('Linc').style.display="block";
			document.getElementById('Uniball').style.display="none";
			document.getElementById('Bensia').style.display="none";
			document.getElementById('Lamy').style.display="none";
			document.getElementById('export_products').style.display="none";
			document.getElementById('package').style.display="none";
			document.getElementById('lmy').style.display="none";
		}


	var request = createRequestObject();
	var today = new Date();
	request.open('GET', 'action.asp?sscatid='+sscatid+'&scatid=' + scatid+'&catid='+catid+'&cat_name='+cat_name+'&Sub_Cat_Name='+Sub_Cat_Name+'&act=2&temp='+today, true);
	//var layername;
	//layername = "div"+subcatid;
	//alert(layername)
	
	tableStructure = "<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
    tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td align='left' valign='top'>";
	tableStructure = tableStructure + "<img src='../images/ter.gif' alt='' width='1' height='10'>";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "<tr valign='top'>";
    tableStructure = tableStructure + "<td align='right' class='bodytext1' style='height:30px'>";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
	tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td align='left' valign='top' style='background-color:#d4d4d4'>";
	tableStructure = tableStructure + "<img src='../images/ter.gif' alt='' width='1' height='1'>";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "<tr valign='top'>";
    tableStructure = tableStructure + "<td align='left' class='bodyredtext_bg' style='height:31px' >";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td align='left' valign='top' style='background-color:#d4d4d4'>";
	tableStructure = tableStructure + "<img src='../images/ter.gif' alt='' width='1' height='1'>";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "<tr>";		
    tableStructure = tableStructure + "<td align='left' valign='top' style='padding-top:4px'>";
	tableStructure = tableStructure + "<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
    tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td align='left' valign='top'>";
	tableStructure = tableStructure + "<table width='100%' height='250'  border='0' cellpadding='0' cellspacing='0'>";    
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td align='center' valign='middle' style='padding-right:16px'><img src='../images/33-0.gif'>";	
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "</table>";
	tableStructure = tableStructure + "</td>";				  
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "</table>";
	tableStructure = tableStructure + "</td>";
	tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td align='left' valign='top' style='padding-top:4px' >";
	tableStructure = tableStructure + "<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
    tableStructure = tableStructure + "<tr>";
    tableStructure = tableStructure + "<td style='background-color:#EEEEEE '>";
	tableStructure = tableStructure + "<img src='../images/ter.gif' width='1' height='1'>";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
    tableStructure = tableStructure + "</table>";
	tableStructure = tableStructure + "</td>";
    tableStructure = tableStructure + "</tr>";
	tableStructure = tableStructure + "<tr>";
	tableStructure = tableStructure + "<td align='left' valign='top'>";
	tableStructure = tableStructure + "<img src='../images/ter.gif' alt='' width='1' height='50'>";
	tableStructure = tableStructure + "</td>";
	tableStructure = tableStructure + "</tr>";
	tableStructure = tableStructure + "</table>";

	request.onreadystatechange = function()
	{
		
		document.getElementById('content').innerHTML = tableStructure;
		if(request.readyState == 4)
		{
			if(request.status == 200)
			{
				var response = request.responseText;
				//alert("re::"+response)
				var ctr = document.getElementById('content');
				ctr.style.display='';
				document.getElementById('content').innerHTML = response;
				var ctrl = document.getElementById('showfirst');
				ctrl.style.display='none';
				var ctr2 = document.getElementById('packaging');
				ctr2.style.display='none';

			}
		}
	}
	request.send(null);
}



