// JavaScript Document

function onlynos()
{
var a=window.event.keyCode;
if((a<48 || a>57) && (a!=45) && (a!=32) && (a!=46))
{
	window.event.keyCode =0;
}
}

  
//===============================  Admin ======================================
 
  
  //---------------------------- Admin Category -------------------------------
  
  //----------------------add / modify  
  function AddCategory()
  {	

  	Para = GetPara()		
		if (Para) 
		{
				objXMLHttpRequest.onreadystatechange=addcategory_output;
				var Url = "Category_SrvPg_N.asp"; //Url of the file in the server.......
				objXMLHttpRequest.open("POST",Url,true);		
				objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
				objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				objXMLHttpRequest.setRequestHeader("Content-Length","12");
				objXMLHttpRequest.send(Para); //Data - to be sent to the server......
				document.getElementById("butSave").disabled = true;
			}
  }
  
  function addcategory_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
			document.location.href="category.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="category.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==8)
			{
				document.location.href="category.asp?output=8"
			}			
			else
			{
				document.location.href="category.asp?output=2"
			}		
	}
  }
  

 //-------- Modify 

function modicat(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "AdCatId";
	Input.id = "AdCatId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddCategory.asp";
	Form.method="post"
	Form.submit();
}


//------------DELETE
   function AdmCat_Delete(Id){
		Para=GetPara() + '&Id='+Id
	var VarChoic = confirm("Are you sure!.. want to proceed");
	if(VarChoic)
	{		
  		objXMLHttpRequest.onreadystatechange=AdmCat_DeleteOutput;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
}	
  }
  
  function AdmCat_DeleteOutput()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{//alert(objXMLHttpRequest.responseText)
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="category.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="category.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="category.asp?output=4"
			}			
			else
			{
				document.location.href="category.asp?output=5"				
			}

	}
  } 
//===============================  City ======================================
 
//----------------------add / modify  
  function addcontrol()
  {	
		Para = GetPara()
		if (Para) 
		{
			//alert(Para)
			objXMLHttpRequest.onreadystatechange=addcontrol_output;
			var Url = "ctrl_SrvPg_N.asp"; //Url of the file in the server.......
			objXMLHttpRequest.open("POST",Url,true);		
			objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
			objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			objXMLHttpRequest.setRequestHeader("Content-Length","12");
			objXMLHttpRequest.send(Para); //Data - to be sent to the server......
			document.getElementById("butSave").disabled = true;
		}
		else
		document.location.href="CntrlPanel.asp?output=9"
  }
  
  function addcontrol_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var		MsgStr = objXMLHttpRequest.responseText.split("*");
		//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
			document.location.href="CntrlPanel.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="CntrlPanel.asp?output=2"
			}
			else
			{
				document.location.href="CntrlPanel.asp?output=2"
			}		
	}
  }
  

 //-------- Modify 

function modicontrol(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "CtrlId";
	Input.id = "CtrlId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddCtrlPanel.asp";
	Form.method="post"
	Form.submit();
}	


//===============================  Control Panel ======================================

//------------DELETE
   function Delete_CPOnclick(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_CPOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_CPOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="CntrlPanel.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="CntrlPanel.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="CntrlPanel.asp?output=4"
			}			
			else
			{
				document.location.href="CntrlPanel.asp?output=5"				
			}

	}
  } 
  
//----------------------add / modify  
    function addpermission()
  {	
  var abcd
abcd=0
	for(i=0;i<form1.document.getElementById("LstPgDis").options.length;i++)
	{
	//alert(form1.document.getElementById("LstPgDis").options[i].value)
		form1.document.getElementById("LstPgDis").options[i].selected=true;
		abcd = abcd + "-" + form1.document.getElementById("LstPgDis").options[i].value;
		form1.page.value=abcd
	}
//alert(form1.page.value)	  
		Para = GetPara()
		if (Para) {
	//	alert(Para)
  		objXMLHttpRequest.onreadystatechange=addpermission_output;
		var Url = "per_SrvPg_N.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);		
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
		}
  }
  
  function addpermission_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var		MsgStr = objXMLHttpRequest.responseText.split("*");
		//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
			document.location.href="permission.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="permission.asp?output=2"
			}
			else
			{
				document.location.href="permission.asp?output=2"
			}	
	}
  }
  

 //-------- Modify 

function modipermission(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "PermId";
	Input.id = "PermId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddPermission.asp";
	Form.method="post"
	Form.submit();
}	

//------------delete admin
   function Delete_PermOnclick(Id)
   {
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_PermOnclickOutput;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_PermOnclickOutput()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		
			if(parseInt(MsgStr[1])==4)
			{
				document.location.href="Permission.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Permission.asp?output=5"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Permission.asp?output=3"
			}			
			else if(parseInt(MsgStr[1])==0)
			{
				document.location.href="Permission.asp?output=4"
			}			
			else
			{
				document.location.href="Permission.asp?output=5"				
			}

	}
  } 


//-----------------------City---------------------------------------------------
 //---------------add / modify 
 /*  function addcity()
  {	
	Para = GetPara()
	if (Para)
	{
		objXMLHttpRequest.onreadystatechange=addcity_output;
		var Url = "cities_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function addcity_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="City.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="City.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="City.asp?output=3"
			}			
			else
			{
				document.location.href="City.asp?output=2"							
			}	
	}
  }
  
 //-----------------modify 

//------------DELETE
   function Delete_CityOnclick(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_CityOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_CityOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="City.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="City.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="City.asp?output=4"
			}			
			else
			{
				document.location.href="City.asp?output=5"				
			}

	}
  }*/ 
  
  //------------------------------ Region -------------------------------------
  
 //---------------add / modify 
   function addRegion()
  {	
	Para = GetPara()
	if (Para)
	{
		objXMLHttpRequest.onreadystatechange=addRegion_output;
		var Url = "Region_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function addRegion_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="Region.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Region.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Region.asp?output=3"
			}			
			else
			{
				document.location.href="Region.asp?output=2"							
			}	
	}
  }
  
 //-----------------modify 
  //-------- Modify 

function modiregion(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "RegId";
	Input.id = "RegId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddRegion.asp";
	Form.method="post"
	Form.submit();
}

//------------DELETE
   function Delete_RegOnclick(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_RegOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_RegOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="Region.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="Region.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="Region.asp?output=4"
			}			
			else
			{
				document.location.href="Region.asp?output=5"				
			}

	}
  } 
  
  
  //------------------------------ Brand -------------------------------------
  
 //---------------add / modify 
   function AddBrand()
  {	
	Para = GetPara()
	if (Para)
	{
		objXMLHttpRequest.onreadystatechange=AddBrand_output;
		var Url = "Brand_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function AddBrand_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="Brand.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Brand.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Brand.asp?output=3"
			}			
			else
			{
				document.location.href="Brand.asp?output=2"							
			}	
	}
  }
  
   //-------- Modify 

function modiBrand(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "BrandId";
	Input.id = "BrandId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddBrand.asp";
	Form.method="post"
	Form.submit();
}

//------------DELETE
   function Delete_BndgOnclick(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_BndgOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_BndgOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="Brand.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="Brand.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="Brand.asp?output=4"
			}			
			else
			{
				document.location.href="Brand.asp?output=5"				
			}

	}
  } 


 //------------------------------ Discount -------------------------------------
  
 //---------------add / modify 
   function AddDiscount()
  {	
	Para = GetPara()
	if (Para)
	{
		objXMLHttpRequest.onreadystatechange=AddDiscount_output;
		var Url = "Discount_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function AddDiscount_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="Discount.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Discount.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Discount.asp?output=3"
			}			
			else
			{
				document.location.href="Discount.asp?output=2"							
			}	
	}
  }
  
   //-------- Modify 

function modiDisc(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "DiscId";
	Input.id = "DiscId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddDiscount.asp";
	Form.method="post"
	Form.submit();
}

//------------DELETE
   function Delete_DiscOnclick(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_DiscOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_DiscOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="Discount.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="Discount.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="Discount.asp?output=4"
			}			
			else
			{
				document.location.href="Discount.asp?output=5"				
			}

	}
  } 
  
  function Sel_ondblclick(LstSrc,LstDist) {
 // alert(document.getElementById("LstPgDis").value)
	if(document.getElementById(LstSrc).selectedIndex==-1)
		alert("Select Properly");
	else
	{	var Opt = document.createElement("option");
		Opt.text = document.getElementById(LstSrc).options[document.getElementById(LstSrc).selectedIndex].text; 
		Opt.value = document.getElementById(LstSrc).options[document.getElementById(LstSrc).selectedIndex].value;
		document.getElementById(LstDist).options.add(Opt);
		document.getElementById(LstSrc).remove(document.getElementById(LstSrc).selectedIndex);	
	}
}
function Sel_ondblclickSS(LstSrc,LstDist) {
//alert(document.getElementById("LstPgDis").value)
	if(document.getElementById(LstSrc).selectedIndex==-1)
		alert("Select Properly");
	else
	{	var Opt = document.createElement("option");
		Opt.text = document.getElementById(LstSrc).options[document.getElementById(LstSrc).selectedIndex].text; 
		Opt.value = document.getElementById(LstSrc).options[document.getElementById(LstSrc).selectedIndex].value;
		document.getElementById(LstDist).options.add(Opt);
		document.getElementById(LstSrc).remove(document.getElementById(LstSrc).selectedIndex);	
	}
	
}

function Sel_ondblclickPdts(LstSrc,LstDist) {
//alert(document.getElementById("LstPgSrc").value)
var pgeVal = document.getElementById("LstPgSrc").value
	if(document.getElementById(LstSrc).selectedIndex==-1)
		alert("Select Properly");
	else
	{	var Opt = document.createElement("option");
		Opt.text = document.getElementById(LstSrc).options[document.getElementById(LstSrc).selectedIndex].text; 
		Opt.value = document.getElementById(LstSrc).options[document.getElementById(LstSrc).selectedIndex].value;
		//document.getElementById(LstDist).options.add(Opt);
		document.getElementById(LstSrc).remove(document.getElementById(LstSrc).selectedIndex);
		//alert()
		AddTd(Opt.text,pgeVal)	
	}
	
}



//--------------------------------Add/Modify Sub Category--------------------------------
function AddSubCat(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "CatId";
	Input.id = "CatId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddSubCat.asp";
	Form.method="post"
	Form.submit();
}
//ModiSubCat
function ModiSubCat(Id,Sub)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "CatId";
	Input.id = "CatId";
	Input.value = Id;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "SubCatId";
	Input.id = "SubCatId";
	Input.value = Sub;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddSubCat.asp";
	Form.method="post"
	Form.submit();
}
 function AddSubCategory()
  {	
	Para = GetPara()
	if (Para)
	{
	//alert(Para)
		objXMLHttpRequest.onreadystatechange=AddSubCat_output;
		var Url = "SubCat_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function AddSubCat_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="PCategory.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="PCategory.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="PCategory.asp?output=3"
			}			
			else
			{
				document.location.href="PCategory.asp?output=2"							
			}
	}
  }
  
  function pCat_DeleteSub(Id){
 	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		var PTabNa = "LKM_ProdCategory"
		var PFldNa = "CatId"
		var PSubTable = "LKM_SubCategory"
		Para = "TabNa=" + PTabNa + "&FldNa=" + PFldNa + '&Id='+ Id + "&SubTable=" + PSubTable
	//	alert(Para)
  		objXMLHttpRequest.onreadystatechange=PCat_DeleteSubOutput;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function PCat_DeleteSubOutput()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{//alert(objXMLHttpRequest.responseText)
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="pcategory.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="pcategory.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="pcategory.asp?output=4"
			}			
			else
			{
				document.location.href="pcategory.asp?output=5"				
			}

	}
  } 
  
  function EditCat()
  {
  	document.getElementById("edOrg").innerHTML = document.getElementById("edDum").innerHTML
  }
  
  //ChkSubCat
  
  function ChkSubCat()
	{
	//alert(document.getElementById("CatId").value)
		try{	
		var CatId=escape(document.getElementById("CatId").value);
		//alert(cou)
  		objXMLHttpRequest.onreadystatechange=ChkSubCat_Output;
		var Url = "getSubCat.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send('CatId=' + CatId); //Data - to be sent to the server......
		}catch(e)
		{
			//alert(e)
		}	
	}
	
		function ChkSubCat_Output()
		{
		//4 - request is completed.......
		if(objXMLHttpRequest.readyState == "4" )	
		{
		//alert(objXMLHttpRequest.responseText )
		//alert(document.getElementById("state").innerHTML)
		document.getElementById("SubCatDet").innerHTML =objXMLHttpRequest.responseText 
		objXMLHttpRequest.abort();
		}
		}
		

function Prod()
{
var a
var a1
var b
var c

a=0
a1=0
b=0
c=0


	if(document.getElementById("PrdtName").value=="")
	{
		cmt="<font color='#FF0000'>Should not be blank</font>"
		a=1
		document.getElementById("SPrdtName").innerHTML=cmt
	}
	else
	{
		cmt=""
		a=0
		document.getElementById('SPrdtName').innerHTML=cmt
	}

	if(document.getElementById("PrdtDes").value=="")
	{
		cmt="<font color='#FF0000'>Should not be blank</font>"
		c=1
		document.getElementById("SPrdtDes").innerHTML=cmt
	}
	else
	{
		cmt=""
		c=0
		document.getElementById('SPrdtDes').innerHTML=cmt
	}
	

if((a==1) || (c==1))
	return false;
else
	return true;
}
 

//----------------------------------Sales Figures-------------------------------------
//---------------add / modify 
   function AddSales()
  {	
	Para = GetPara()
	if (Para)
	{
	//alert(Para)
		objXMLHttpRequest.onreadystatechange=AddSales_output;
		var Url = "Sales_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function AddSales_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="Sales.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Sales.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Sales.asp?output=3"
			}			
			else
			{
				document.location.href="Sales.asp?output=2"							
			}	
	}
  }
  
//  modisales
function modisales(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "SaleId";
	Input.id = "SaleId";
	Input.value = Id;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "AddSales.asp";
	Form.method="post"
	Form.submit();
}
//sale_Delete

  function sale_Delete(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		var SubTable = "LKM_SalesSub"
		var TabNa = "LKM_Sales"
		var FldNa = "SaleId"
		//Para=GetPara() + '&Id='+Id
		Para='SubTable='  + SubTable + '&TabNa=' + TabNa + '&FldNa=' + FldNa + '&Id='+Id
		//alert(Para)
  		objXMLHttpRequest.onreadystatechange=sale_Delete_Output;
		var Url = "DelDataOffr.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function sale_Delete_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="dealers.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="dealers.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="dealers.asp?output=4"
			}			
			else
			{
				document.location.href="dealers.asp?output=5"				
			}

	}
  } 

//AddSaleSub
//---------------------------add sales Sub --------------------------------
function AddSaleSub111(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "SaleId";
	Input.id = "SaleId";
	Input.value = Id;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "AddSalesSub.asp";
	Form.method="post"
	Form.submit();
}

//AddSaleSubDet
  /* function AddSaleSubDet()
  {	
	Para = GetPara()
	if (Para)
	{
	alert(Para)
		objXMLHttpRequest.onreadystatechange=AddSaleSubDet_output;
		var Url = "SalesSubDet_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function AddSaleSubDet_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
		/*	if(parseInt(MsgStr[1])==1)
			{
				document.location.href="Sales.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Sales.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Sales.asp?output=3"
			}			
			else
			{
				document.location.href="Sales.asp?output=2"							
			}	
	}
  }*/
  
  //--------------------------------div Content Display ----------------------------
  
  //----------------------add / modify  
  function AddSaleSubNew(delid)
  {	  
		Para = 'SaleId=' + delid
		if (Para) {
		//alert(Para)
  		objXMLHttpRequest.onreadystatechange=AddSaleSubNew_output;
		var Url = "AddSalesSub.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);		
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		//document.getElementById("butSave").disabled = true;
		}
  }
  
  function AddSaleSubNew_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		document.getElementById("salsDet").innerHTML = objXMLHttpRequest.responseText
		var salid
		salid = document.getElementById("SaleId").value
		//alert(salid)
		ViewSalChart(salid)	
	}
  }
  

 //-------- Modify 

function modiOffer(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "OffrId";
	Input.id = "OffrId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddOffer.asp";
	Form.method="post"
	Form.submit();
}	

//------------delete admin
   function Delete_OffrOnclick(Id)
   {
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_OffrOnclickOutput;
		var Url = "DelDataOffr.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_OffrOnclickOutput()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		
			if(parseInt(MsgStr[1])==4)
			{
				document.location.href="Offer.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Offer.asp?output=5"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Offer.asp?output=3"
			}			
			else if(parseInt(MsgStr[1])==0)
			{
				document.location.href="Offer.asp?output=4"
			}			
			else
			{
				document.location.href="Offer.asp?output=5"				
			}

	}
  } 
  
  //--------------------get category------------------------------------
  
  function getCate()
  {
	//alert(document.getElementById("BrandId").value)
		try{	
		var BrandId=escape(document.getElementById("BrandId").value);
		//alert(cou)
  		objXMLHttpRequest.onreadystatechange=getCate_Output;
		var Url = "getCategory.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send('BrandId=' + BrandId); //Data - to be sent to the server......
		}catch(e)
		{
			//alert(e)
		}	
	}
		
	function getCate_Output()
	{
		//4 - request is completed.......
		if(objXMLHttpRequest.readyState == "4" )	
		{
			//alert(objXMLHttpRequest.responseText )
			//alert(document.getElementById("state").innerHTML)
			document.getElementById("catDet").innerHTML =objXMLHttpRequest.responseText 
			objXMLHttpRequest.abort();
		}
	}
	
	//----------------------------get products ------------------------------------------------
	function getCity()
	{//alert("dddd")
	//alert(document.getElementById("BrandId").value)
		document.getElementById("Submit").disabled = true;
		if(document.getElementById("StId").value=="")
		{
			alert("Select State")
			//new updation of search on 06/December/2007
				var StId = escape(document.getElementById("StId").value);
				var Prdt = escape(document.getElementById("PrdtId").value)
				Para = 'StId=' + StId + '&PrdtVal=' + Prdt
				objXMLHttpRequest.onreadystatechange=getProdt_Output;
				var Url = "getProdt.asp"; //Url of the file in the server.......
				objXMLHttpRequest.open("POST",Url,true);
				objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
				objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				objXMLHttpRequest.setRequestHeader("Content-Length","12");
				objXMLHttpRequest.send(Para); //Data - to be sent to the server......
			//new updation of search on 06/December/2007
		}
		else
		{
		try{	
		var StId = escape(document.getElementById("StId").value);
		var Prdt = escape(document.getElementById("PrdtId").value)
				Para = 'StId=' + StId + '&PrdtVal=' + Prdt
		//Para = 'StId=' + StId
		objXMLHttpRequest.onreadystatechange=getProdt_Output;
		var Url = "getProdt.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		}catch(e)
		{
			//alert(e)
		}
		}	
	}
	
	
	
	function getCitySec()
	{//alert("dddd")
	//alert(document.getElementById("BrandId").value)
		//document.getElementById("Submit").disabled = true;
		if(document.getElementById("StId").value=="")
		{
			alert("Select State")
			//new updation of search on 06/December/2007
				var StId = escape(document.getElementById("StId").value);
				var Prdt = escape(document.getElementById("PrdtId").value)
				Para = 'StId=' + StId + '&PrdtVal=' + Prdt
				objXMLHttpRequest.onreadystatechange=getProdtSec_Output;
				var Url = "getProdtSec.asp"; //Url of the file in the server.......
				objXMLHttpRequest.open("POST",Url,true);
				objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
				objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				objXMLHttpRequest.setRequestHeader("Content-Length","12");
				objXMLHttpRequest.send(Para); //Data - to be sent to the server......
			//new updation of search on 06/December/2007
		}
		else
		{
		try{	
		var StId = escape(document.getElementById("StId").value);
		var Prdt = escape(document.getElementById("PrdtId").value)
				Para = 'StId=' + StId + '&PrdtVal=' + Prdt
		//Para = 'StId=' + StId
		objXMLHttpRequest.onreadystatechange=getProdtSec_Output;
		var Url = "getProdtSec.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		}catch(e)
		{
			//alert(e)
		}
		}	
	}
	function getProdtSec_Output()
	{
		//4 - request is completed.......
		if(objXMLHttpRequest.readyState == "4" )	
		{
			//alert(objXMLHttpRequest.responseText )
			//alert(document.getElementById("state").innerHTML)
			document.getElementById("cit").innerHTML =objXMLHttpRequest.responseText 
			document.getElementById("StId").disabled = false;
			//document.getElementById("Submit").disabled=false;
			objXMLHttpRequest.abort();
		}
	}

		
		
	function getProdt_Output()
	{
		//4 - request is completed.......
		if(objXMLHttpRequest.readyState == "4" )	
		{
			//alert(objXMLHttpRequest.responseText )
			//alert(document.getElementById("state").innerHTML)
			document.getElementById("cit").innerHTML =objXMLHttpRequest.responseText 
			document.getElementById("StId").disabled = false;
			document.getElementById("Submit").disabled=false;
			objXMLHttpRequest.abort();
		}
	}


function ViewOffes(ofrid)
{
	Form = document.createElement("form");
	Form.name = "frmOffer";
	Form.id = "frmOffer";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "OffrId";
	Input.id = "OffrId";
	Input.value = ofrid;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "ViewOffer.asp";
	Form.method="post"
	Form.submit();
}

function UpdtOffr()
{
		Para = GetPara()
		if (Para) 
		{
		//	alert(Para)
			objXMLHttpRequest.onreadystatechange=addOffr_output;
			var Url = "Offr_SrvPg_N.asp"; //Url of the file in the server.......
			objXMLHttpRequest.open("POST",Url,true);		
			objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
			objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			objXMLHttpRequest.setRequestHeader("Content-Length","12");
			objXMLHttpRequest.send(Para); //Data - to be sent to the server......
			document.getElementById("butSave").disabled = true;
		}
  }
  
  function addOffr_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
	//	document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
			document.location.href="Offer.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Offer.asp?output=2"
			}
			else
			{
				document.location.href="Offer.asp?output=2"
			}
	}
  }
  
  
//------------------------------- Events ------------------------------------------------

//---------------add / modify 
   function AddEvents()
  {	
	Para = GetPara()
	if (Para)
	{
		objXMLHttpRequest.onreadystatechange=AddEvents_output;
		var Url = "Events_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("butSave").disabled = true;
	}
  }
  
  function AddEvents_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
var	MsgStr = objXMLHttpRequest.responseText.split("*");
//document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
			if(parseInt(MsgStr[1])==1)
			{
				document.location.href="Events.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="Events.asp?output=2"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="Events.asp?output=3"
			}			
			else
			{
				document.location.href="Events.asp?output=2"							
			}	
	}
  }
  
   //-------- Modify 

function modiEvtns(evid)
{
	Form = document.createElement("form");
	Form.name = "frmEvnts";
	Form.id = "frmEvnts";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "EventId";
	Input.id = "EventId";
	Input.value = evid;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddEvents.asp";
	Form.method="post"
	Form.submit();
}

//------------DELETE
   function Delete_NewsgOnclick(Id){
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
  		objXMLHttpRequest.onreadystatechange=Delete_NewsgOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function Delete_NewsgOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[0])==1)
			{
				document.location.href="News.asp?output=1"
			}
			else if(parseInt(MsgStr[0])==2)
			{
				document.location.href="News.asp?output=5"
			}
			else if(parseInt(MsgStr[0])==0)
			{
				document.location.href="News.asp?output=4"
			}			
			else
			{
				document.location.href="News.asp?output=5"				
			}

	}
  } 

function ViewNews(nid)
{
	Form = document.createElement("form");
	Form.name = "frmNews";
	Form.id = "frmNews";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "NwId";
	Input.id = "NwId";
	Input.value = nid;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "ViewNews.asp";
	Form.method="post"
	Form.submit();
}

//-------------------------Enquiry -------------------------------------
function Enqry(dlr,ofr)
{
	var dealer = dlr
	var Offer = ofr
	Para = 'DealrId=' + dealer + '&OffrId=' + ofr
	if (Para)
	{
		//alert(Para)
		objXMLHttpRequest.onreadystatechange=Enqry_output;
		var Url = "EnqryRep_Srv.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		document.getElementById("btnSave").disabled = true;
	}
  }
  
  function Enqry_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		document.getElementById("a").innerHTML = "<font color='#FF0000' size='+1'>" + objXMLHttpRequest.responseText + "</font>"				
	}
  }
  
function AddSubSales(nid)
{
	Form = document.createElement("form");
	Form.name = "frmSale";
	Form.id = "frmSale";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "DealrId";
	Input.id = "DealrId";
	Input.value = nid;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "AddSalesSub.asp";
	Form.method="post"
	Form.submit();
}

function ViewSalChart111(salid)
{
	Form = document.createElement("form");
	Form.name = "frmSale";
	Form.id = "frmSale";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "SaleId";
	Input.id = "SaleId";
	Input.value = salid;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "Chart.asp";
	Form.method="post"
	Form.submit();
}
 function ViewSalChart(delid)
  {	  
		Para = 'SaleId=' + delid
		if (Para) {
		//alert(Para)
  		objXMLHttpRequest.onreadystatechange=ViewSalChart_output;
		var Url = "Chart.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);		
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		//document.getElementById("butSave").disabled = true;
		}
  }
  
  function ViewSalChart_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var		MsgStr = objXMLHttpRequest.responseText.split("*");
		document.getElementById("chartDet").innerHTML = objXMLHttpRequest.responseText
			
	}
  }

function AddSaleSubDet()
{
	if(Validation_SpnMsg())
	{
		frmSale.method = "post"
		frmSale.action = "SalesSubDet_Srv.asp"
		frmSale.submit();
	}
	else
		return false
}



  
  //--------------------------add new sales details-----------------------------
  
   function AddSubSalesNNNN(delid)
  {	  
		Para = 'DealrId=' + delid
		if (Para) {
		//alert(Para)
  		objXMLHttpRequest.onreadystatechange=AddSubSalesNNNN_output;
		var Url = "AddSalesSub.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);		
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		//document.getElementById("butSave").disabled = true;
		}
  }
  
  function AddSubSalesNNNN_output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
		document.getElementById("salsDet").innerHTML = objXMLHttpRequest.responseText
		var salid
		salid = document.getElementById("SaleId").value
		//ViewSalChart(salid)	
	}
  }
  
  //------------------------search queries-----------------------------------------
  
  function Search_Qry(PgId,DealrId,catid,scatid,BrandId)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";

	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "mypage";
	Input.id = "mypage";
	Input.value = PgId;
	Form.appendChild(Input);	
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "DealrId";
	Input.id = "DealrId";
	Input.value = DealrId;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "PdtId";
	Input.id = "PdtId";
	Input.value = catid;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "Qry";
	Input.id = "Qry";
	Input.value = scatid;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "BrandId";
	Input.id = "BrandId";
	Input.value = BrandId;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "report4.asp";
	Form.method="post"
	Form.submit();
}

function ClearAll(gtval)
{
alert(gtval)
	document.getElementById("DealrId").value = ""
	document.getElementById("PdtId").value = ""
	document.getElementById("fdate").value = ""
	document.getElementById("tdate").value = ""	
	document.getElementById("BrandId").value = ""
	document.getElementById("CatId").value = ""
	if(gtval == "qry")
	{
		document.getElementById("Qry").value = "";
	}
}
function ClearWar()
{
	document.getElementById("DealrId").value = ""
	document.getElementById("PdtId").value = ""
	document.getElementById("fdate").value = ""
	document.getElementById("tdate").value = ""	
	document.getElementById("BrandId").value = ""
	document.getElementById("CatId").value = ""
	document.getElementById("War").value = "";
	
}
//---------------------------------------search warranty------------------------------------
function Search_War(PgId,DealrId,catid,BrandId)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";

	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "mypage";
	Input.id = "mypage";
	Input.value = PgId;
	Form.appendChild(Input);	
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "DealrId";
	Input.id = "DealrId";
	Input.value = DealrId;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "PdtId";
	Input.id = "PdtId";
	Input.value = catid;
	Form.appendChild(Input);
	
	/*Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "Qry";
	Input.id = "Qry";
	Input.value = scatid;
	Form.appendChild(Input);*/
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "BrandId";
	Input.id = "BrandId";
	Input.value = BrandId;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "report3.asp";
	Form.method="post"
	Form.submit();
}

function ViewWar(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "WarId";
	Input.id = "WarId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "Warranty_Det.asp";
	Form.method="post"
	Form.submit();
}
 
//-----------------------------------view offer requests --------------------------
function ViewOffrSrch(Id)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "OffrId";
	Input.id = "OffrId";
	Input.value = Id;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "Offer_Det.asp";
	Form.method="post"
	Form.submit();
}

//--------------------------search offers ---------------------------------------------

function Search_Offr(PgId,DealrId,OffrType,OffrId)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";

	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "mypage";
	Input.id = "mypage";
	Input.value = PgId;
	Form.appendChild(Input);	
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "DealrId";
	Input.id = "DealrId";
	Input.value = DealrId;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "OffrType";
	Input.id = "OffrType";
	Input.value = OffrType;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "OffrId";
	Input.id = "OffrId";
	Input.value = OffrId;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "report2.asp";
	Form.method="post"
	Form.submit();
}

function ClearAllOffr()
{
//alert(gtval)
	document.getElementById("DealrId").value = ""
	document.getElementById("OffrType").value = ""
	document.getElementById("fdate").value = ""
	document.getElementById("tdate").value = ""	
	document.getElementById("OffrId").value = ""
}

//------------delete Files

function Delete_FilOnclick(Id,ext)
{   
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id + '&extn=' + ext
	//	alert(Para)
  		objXMLHttpRequest.onreadystatechange=DeleteFilOnclick_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}	
  }
  
  function DeleteFilOnclick_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{	
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[1])==4)
			{
				document.location.href="UploadedFiles.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="UploadedFiles.asp?output=5"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="UploadedFiles.asp?output=3"
			}			
			else if(parseInt(MsgStr[1])==0)
			{
				document.location.href="UploadedFiles.asp?output=4"
			}			
			else
			{
				document.location.href="UploadedFiles.asp?output=5"				
			}

	}
  } 
  
function DeClick(nid,nstat)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";

	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "NLtrId";
	Input.id = "NLtrId";
	Input.value = nid;
	Form.appendChild(Input);
	
	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "NLtrStat";
	Input.id = "NLtrStat";
	Input.value = nstat;
	Form.appendChild(Input);	
	
	document.body.appendChild(Form);
	Form.action = "NewsLtr_SrvAdm.asp";
	Form.method="post"
	Form.submit();
}

function NLtr_Delete(Id)
{
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
	//	alert(Para)
  		objXMLHttpRequest.onreadystatechange=NLtr_Delete_Output;
		var Url = "DelData.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}
}

function NLtr_Delete_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{	
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[1])==4)
			{
				document.location.href="NwLetter.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="NwLetter.asp?output=5"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="NwLetter.asp?output=3"
			}			
			else if(parseInt(MsgStr[1])==0)
			{
				document.location.href="NwLetter.asp?output=4"
			}			
			else
			{
				document.location.href="NwLetter.asp?output=5"				
			}

	}
  } 


/*//--------------------------News Lettere Composing----------------------
function AddNewsLtr(Id)
{
	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
		Para=GetPara() + '&Id='+Id
	//	alert(Para)
  		objXMLHttpRequest.onreadystatechange=AddNewsLtr_OutPut;
		var Url = "NewsLteMsg_Srv.asp"; 
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para);
	}
}

function AddNewsLtr_OutPut()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{	
		var	MsgStr = objXMLHttpRequest.responseText.split("*");
			if(parseInt(MsgStr[1])==4)
			{
				document.location.href="NewNewsLetter.asp?output=1"
			}
			else if(parseInt(MsgStr[1])==2)
			{
				document.location.href="NewNewsLetter.asp?output=5"
			}
			else if(parseInt(MsgStr[1])==3)
			{
				document.location.href="NewNewsLetter.asp?output=3"
			}			
			else if(parseInt(MsgStr[1])==0)
			{
				document.location.href="NewNewsLetter.asp?output=4"
			}			
			else
			{
				document.location.href="NewNewsLetter.asp?output=5"				
			}

	}
  } */
  
function SndNewsLetter(sndid)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";

	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "NLtrMsgId";
	Input.id = "NLtrMsgId";
	Input.value = sndid;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "SndNewsLetter_Srv.asp";
	Form.method="post"
	Form.submit();
}
function ShowPrdt(pdtid)
{
	Form = document.createElement("form");
	Form.name = "frmSrch";
	Form.id = "frmSrch";

	Input = document.createElement("input");
	Input.type = "hidden";
	Input.name = "PdtId";
	Input.id = "PdtId";
	Input.value = pdtid;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "ViewProduct.asp";
	Form.method="post"
	Form.submit();
}
//----------------------------get products ------------------------------------------------
	function getSttAdm()
	{//alert("dddd")
	//alert(document.getElementById("BrandId").value)
		try{	
		var PrdtId = escape(document.getElementById("PrdtId").value);
		//var BrandId = escape(document.getElementById("BrandId").value);
		
		Para = 'PrdtId=' + PrdtId
		//alert(Para)
  		objXMLHttpRequest.onreadystatechange=getSttAdm_Output;
		var Url = "getStatAdm.asp"; //Url of the file in the server.......
		objXMLHttpRequest.open("POST",Url,true);
		objXMLHttpRequest.setRequestHeader("Host","www.sipacademyindia.com");
		objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objXMLHttpRequest.setRequestHeader("Content-Length","12");
		objXMLHttpRequest.send(Para); //Data - to be sent to the server......
		}catch(e)
		{
			//alert(e)
		}	
	}
		
	function getSttAdm_Output()
	{
		//4 - request is completed.......
		if(objXMLHttpRequest.readyState == "4" )	
		{
			//alert(objXMLHttpRequest.responseText )
			//alert(document.getElementById("state").innerHTML)
			document.getElementById("stat").innerHTML =objXMLHttpRequest.responseText 
			objXMLHttpRequest.abort();
			getCity();
		}
	}
	
	function chkLog()
	{
		if(event.keyCode==13)
		login()
	}