﻿// JScript File For EventStaging.aspx Page To Bind the Subcategory Combobox By Using JavaScript And XML
var subCat;
var mobjXMLRequest;

var _pageName;//PageName is required when we put other option like in particular case we need to add 'other' at the time of 
             //fill combos
             
var _source; //it contains the id of button when we click offer me a vehicle from view profile for open a popup.
var _BuyerId; // it contains the buyerid, from the view profile page which user has buying interest 

var _ActionName = null;// it contains the action name means accept decline retract counteroffer which is passing from the page.
var _OfferCommentsCount = 0; // it contans the offercomments count from the page.
var _src = null; // it contains the dynamic id of button on which user ckick ex. accept decline retract comments and counter offer.
var _MakeValue;
var _VehicleCategoryId;
var _ddModel;
var _ddExteriorColor;
var _ddInteriorColor;
var _ddBodyType;
var _hdSameVehicleCount;
var _OtherMake;

//three choice of exterior color
var _ddExteriorColor1;
var _ddExteriorColor2;
var _ddExteriorColor3;

//three choice of interior color
var _ddInteriorColor1;
var _ddInteriorColor2;
var _ddInteriorColor3;


//Creating XML Object
function GetXmlRequest()
{
	try
	{
		mobjXMLRequest = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			mobjXMLRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			mobjXMLRequest = null;
		}
	}
	if(!mobjXMLRequest && typeof mobjXMLRequest != "undefined") 
	{
		mobjXMLRequest = new XMLHttpRequest();
	}
	
	
}

//send the request to AjaxReturnDS.aspx page when We Pass The SelectedItem Value of Combo
function SendRequest(SelectedId,pagePath)
{
    
    var lstrURL = pagePath + "?IdPassed=" + SelectedId;
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValues;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);
       
    }
    
}
//To send Request to get data as XML
function SendRequestThroughAjax(strcat,strsubcat,pagePath,hdName,pageName)
{      
     //debugger;
     //set value in global variable 
     _pageName = pageName;
     
    //set model value to 0
    document.getElementById(hdName).value = 0;
    
    subCat=strsubcat;
    var pobjid = document.getElementById(strcat);
    var pobjidvalue = pobjid.value;
    if(pobjid.value == '' || pobjid.value == null)
    {
            pobjidvalue = -1; 
    }
   
    if(pobjid.value == 'O')
   { 
        pobjidvalue = -1; 
        document.getElementById('txtMake').style.display = 'block';
        document.getElementById('txtModel').style.display = 'block';
        document.getElementById('txtMake').disabled=false;
        document.getElementById('txtModel').disabled=false;
         if(_pageName=='UploadVehicle' || _pageName=='BuyingInterestAdd')
          {
            var cmbModel=document.getElementById('ddlModel');
            document.getElementById('ddlModel').length = 0;
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Choose One';
            oOption1.value = '0';
            cmbModel.options.add(oOption1);  
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Other';
            oOption1.value = 'O';
            cmbModel.options.add(oOption1);        
            cmbModel.value='O';        
        }
        else if(_pageName=='QuickSearch'|| _pageName=='SearchVehicle' || _pageName=='Home')
         {
          var cmbModel=document.getElementById('ddModel');
            document.getElementById('ddModel').length = 0;
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'All Models';
            oOption1.value = '0';
            cmbModel.options.add(oOption1);   
          
         }
         
    }
    else
    {
   
          SendRequest(pobjidvalue,pagePath,pageName);
         
          FillHiddenField(strcat,hdName,_pageName)
          //if page names are BuyingInterestAdd or Manuual Upload then these lines of code will be used
          if(_pageName=='UploadVehicle' || _pageName=='BuyingInterestAdd')
          {
           document.getElementById('txtMake').style.display = 'none';
           document.getElementById('txtModel').style.display = 'none';
          }
        
 
    }
  
        //document.getElementById('txtModel').style.display = 'none'
    
}

//To Get the response of XML
function OnGettingValues() 
{
    
      if(mobjXMLRequest.readyState == 4)
     {
        //alert(mobjXMLRequest.status); 
        if(mobjXMLRequest.status == 200)
        {
       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeAction(DSTag,subCat);
        }
    }
}   
  
//To Fill The SubCategory DropDownList
function TakeAction(DSTag, subCat)
{    
    //alert(DSTag);
    var lobjCombo = document.getElementById(subCat);
    var ComboTable = DSTag.getElementsByTagName('Table');
 
     if(_pageName=='QuickSearch' || _pageName=='NarrowSearch' || _pageName=='SearchVehicle' || _pageName=='Home')
         {
             lobjCombo.options.length = 0;
        var oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Models';//To add "Select SubCategory" at 0th Index 
        oOption1.value = '0';
        lobjCombo.options.add(oOption1);
         
         }
     else if(_pageName=='BuyingInterestAdd')
        { 
          lobjCombo.options.length = 0;
        var oOption1 = document.createElement('OPTION');
        oOption1.text = 'Any Model';//To add "Select SubCategory" at 0th Index 
        oOption1.value = '0';
        lobjCombo.options.add(oOption1);
        }
     else
        {
        lobjCombo.options.length = 0;
        var oOption1 = document.createElement('OPTION');
        oOption1.text = 'Choose One';//To add "Select SubCategory" at 0th Index 
        oOption1.value = '0';
        lobjCombo.options.add(oOption1);
        }
        //Adding Combo other option
 
    for(var i=0;i<ComboTable.length;i++)
    {
          var Value = ComboTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ComboTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          lobjCombo.options.add(oOption);
          
    }
  if(_pageName=='UploadVehicle' || _pageName=='BuyingInterestAdd')
  {
       var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Other';
            oOption1.value = 'O';
            lobjCombo.options.add(oOption1);        
          
         }
    
    // add other if page is upload vehicle.
    //alert(_pageName);
    
// if(_pageName == 'UploadVehicle' || _pageName == 'AddVehicle')
// //   {       alert("Hi") ;
//        oOption1 = document.createElement('OPTION');
//        oOption1.text = 'Other';//To add "Select SubCategory" at 0th Index 
//        oOption1.value = 'O';
//        lobjCombo.options.add(oOption1); 
//  }
    
    
//    if(subCat == 'ddlModel')
//    {
//        var oOption2 = document.createElement('OPTION');
//        oOption2.text = 'Other Model';//To add "Select SubCategory" at 0th Index 
//        oOption2.value = 'O';
//        lobjCombo.options.add(oOption2);
//    }
    
}

function FillHiddenField(ctrName,hdName,pageName)
{
    if(document.getElementById(ctrName).value=='O')
    {
       document.getElementById(hdName).value =0;
    }
    else
    {
       document.getElementById(hdName).value =  document.getElementById(ctrName).value;
    }  
    if(pageName=='UploadVehicle' || pageName=='BuyingInterestAdd')
    {    
       EnableBuyingTxtModel();
    }       
}

function EnableBuyingTxtModel()
{    
    if(document.getElementById('ddlModel').value == "O")
    {
        document.getElementById('txtModel').style.display = 'block'
        document.getElementById('txtModel').disabled=false;
        return false;
    }
    else
    {
        document.getElementById('txtModel').style.display = 'none'       
        return false;
    }
}

//--------------- calling a method on click offer me a vehicle from view profile page -------------------------//
function FillComboThroughAjax(sellerid, buyerid, vehicleid, pagePath, source)
{     
   _source = source; // set value of source
   _BuyerId = buyerid; // set value of buyerid
    
   var lstrURL = pagePath + "?SellerId=" + sellerid + "&BuyerId=" + buyerid + "&VehicleId=" + vehicleid;   
   
   GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValues1;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);      
    }
}
//---------------------------------Function Ends here---------------------------------------------- 
function checkblockorNot()
{
  //Code to check whether the person is blocked or not by getting the text from label "You are blocked by UserName"  	    
    var strContactLabelText=document.getElementById("lblContactDisplayName").innerHTML;
    var msg =  strContactLabelText.split(' ');
    var msg1='';

    if(msg.length>2)
    {
    var msg1=msg[0]+ ' ' +msg[1]+ ' ' +msg[2];
    }
    if(msg1 == 'You are blocked')
    {
    alert("You are blocked by this member and may not contact them at this time.");
    return false;
    }
    else
    {
    return true;
    }
 //End of Code           
}
function TakeAction1(DSTag)
{     
    var lobjCombo = document.getElementById('ddMyVehicles');
    var ComboTable = DSTag.getElementsByTagName('Table');    
    
    lobjCombo.options.length = 0;    
    var oOption1 = document.createElement('OPTION');
    oOption1.text = 'Choose One';//To add default choose one option in my inventory combo.
    oOption1.value = '0';
    lobjCombo.options.add(oOption1);
    
    if(ComboTable.length == 0)
    {        
        var isShowPopup=checkblockorNot();
                   if(isShowPopup)
                   {   alert('You have no items in your inventory that match this buying interest.\nNote: All criteria fields must match!');
                   }
                 
    }
    else
    {
        //call a method for open a offer me a vehicle popup
        offerVehicle(_BuyerId, _source);   
    }
    
    for(var i=0;i<ComboTable.length;i++)
    {
          //var Value = ComboTable[i].nodeTypedValue;
          var Value = ComboTable[i].getElementsByTagName('SellingVehicleId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ComboTable[i].getElementsByTagName('VehicleDetail')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          lobjCombo.options.add(oOption);
    }    
}

function OnGettingValues1() 
{    
     if(mobjXMLRequest.readyState == 4)
     {
        //alert(mobjXMLRequest.status); 
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeAction1(DSTag);
        }
    }
}  


// method for set value of selected vehicle from view profile page when click offer me a vehicle in my inventory combo
function SetMyInventoryComboValues(comboId,hdName)
{       
    document.getElementById(hdName).value =  document.getElementById(comboId).value;    
} 



//--------------------method for finding the current counter offer for accept an offer functionality ------------
function FetchCounterOffer(OfferId,CommentsOwner,pagePath,ActionName,src,OfferCommentsCount,SameVehicleCount)
{       
    //debugger;
    _hdSameVehicleCount=SameVehicleCount;
    _ActionName = ActionName;
    _OfferCommentsCount = OfferCommentsCount;    
    _src = src;
    
    var lstrURL = pagePath + "?OfferId=" + OfferId + "&CommentsOwner=" + CommentsOwner;   
    GetXmlRequest();//Get Response 
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValues2;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);      
    }    
        
    return false;  
}
//--------------------method for finding the current offer status functionality ------------
function FetchCurrentOfferStatus(OfferId,CommentsOwner,pagePath)
{       
   
    var lstrURL = pagePath + "?OfferId=" + OfferId + "&CommentsOwner=" + CommentsOwner;   
    GetXmlRequest();//Get Response 
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesForOfferStatus;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);      
    }    
        
    return false;  
}
function TakeAction2(DSTag)
{       
    var ComboTable = DSTag.getElementsByTagName('Table');   
    
    var Amount = ComboTable[0].getElementsByTagName('CurrentCounterOffer')[0].firstChild.nodeValue;
    var OfferStatus = ComboTable[0].getElementsByTagName('CurrentOfferStatus')[0].firstChild.nodeValue;
    var IsAutoAction = ComboTable[0].getElementsByTagName('IsAutoRetractedOrDeclined')[0].firstChild.nodeValue;
    var UserDisplayName = ComboTable[0].getElementsByTagName('UserName')[0].firstChild.nodeValue;
    var CountComments = ComboTable[0].getElementsByTagName('CountOfferComments')[0].firstChild.nodeValue;   
    var DeletedBy= ComboTable[0].getElementsByTagName('DeletedBy')[0].firstChild.nodeValue;   
    
    // bt is object of server side button for executing the onclick event from client side.
    var bt = document.getElementById('btnFromClientSide');      
    var val = _src.id.split('_');        
    
    //code for set value in hdIndex hidden field
    var index1 = val[1].substring(3);    
    var index = parseInt(index1) - 2;
    // set value of row index in hidden field
    document.getElementById('hdIndex').value = index;
     
    //code for action as user click on any button
    if(_ActionName == 'Accept')
    {
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'Accept';
        
        if(_OfferCommentsCount != CountComments)  
        {              
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();                             
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }           
        else
        {
            if(Amount == '0.0000')
            {
                alert('You did not receive an offer yet.');               
            }
            else
            {             
                 if(_hdSameVehicleCount>1)
                    {
                        if(confirm('You are about to accept this offer, Once its is confirmed by the buyer, all other buyers who were offered this vehicle will be notified and the offers will be retracted automatically'))
                        {
                             //call a click event of a server side button 
                            bt.click(); 
                        }
                    }
                    else if(confirm('You are about to accept this offer in the amount of: ' + Amount))
                    {
                        bt.click(); 
                    }
                
                
                
                              
            }            
        }
    }
    //code for action as user click for final accept
    if(_ActionName == 'FinalAccept')
    {        
//        alert(OfferStatus);
//        alert(_OfferCommentsCount);
//        alert(CountComments);
        
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'FinalAccept';
        
        if(_OfferCommentsCount != CountComments)  
        {              
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();                             
        }
        else if(OfferStatus != 'TA')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else
        {
            //call a click event of a server side button 
            bt.click(); 
        }           
    }
    
    if(_ActionName == 'Decline')
    {
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'Decline';
    
        if(_OfferCommentsCount != CountComments)   
        {             
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();              
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else
        {
            if(Amount == '0.0000')
            {
                alert('You did not receive an offer yet.');               
            }
            else
            {
                var Flag = confirm('By clicking OK you will end this communication and the offer will be declined. Click CANCEL to make a counter offer or leave a comment.');     
                if(Flag)
                {                   
                    //call a click event of a server side button     
                    bt.click();                    
                }         
            }  
        }            
    }
    //code for action as user click for final decline
    if(_ActionName == 'FinalDecline')
    {
//        alert(OfferStatus);
//        alert(_OfferCommentsCount);
//        alert(CountComments);
    
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'FinalDecline';
    
        if(_OfferCommentsCount != CountComments)   
        {             
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();              
        }
        else if(OfferStatus != 'TA')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else
        {
            var Flag = confirm('You are about to decline this offer and end all communication! Click OK or Cancel.');     
            if(Flag)
            {                   
                //call a click event of a server side button     
                bt.click();                    
            }           
        }            
    }
    if(_ActionName == 'Retract')
    {
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'Retract';
    
        if(_OfferCommentsCount != CountComments)  
        {             
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();
            
        }
        else if(OfferStatus=='A'||OfferStatus=='D')
        {
              alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else
        {
            var Flag = confirm('You are about to retract your offer.');     
            if(Flag)
            {        
                 //call a click event of a server side button  
                 bt.click();                                
            }
            
        }            
    }
    if(_ActionName == 'MoreInfo')
    {            
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'MoreInfo';
    
        if(_OfferCommentsCount != CountComments)   
        {             
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button
            bt.click();                               
        }
        else if(OfferStatus=='A'||OfferStatus=='D')
        {
              alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        } 
        else
        {
             var txtComments = val[0] + "_" + val[1] + "_txtComments";                       
             if(document.getElementById(txtComments).value == '')
             {                    
                alert("Enter Comments.");
                document.getElementById(txtComments).focus();                                                        
             }
             else
             {             
                //call a click event of a server side button 
                bt.click();                                                                
             }                
        }            
    }
    if(_ActionName == 'CounterOffer')
    {              
        // set value of Action in hidden field
        document.getElementById('hdActionName').value = 'CounterOffer';
    
         var txtCounterOffer = val[0] + "_" + val[1] + "_txtCounterOffer";   
         if(document.getElementById(txtCounterOffer).value=='')
         {                         
                alert("Please Enter Offer Amount.");
                document.getElementById(txtCounterOffer).focus();                                             
         }
        //if(_OfferStatus == 'A' || _OfferStatus == 'D' || _IsAutoRetractedOrDeclined == '1' || _IsAutoRetractedOrDeclined == '2')  
        else if(_OfferCommentsCount != CountComments)   
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button
            bt.click();           
        }
        else if(DeletedBy=='S' || DeletedBy=='B')
        {
            alert('The offer status has been changed by ' + UserDisplayName + ' prior to \n your action. Click OK to see current status and make \n a new selection.');
            
            //call a click event of a server side button 
            bt.click();  
        }
        else
        {    
             var txtCounterOffer = val[0] + "_" + val[1] + "_txtCounterOffer";   
                 
                 var flag = confirm('you are about to make an offer in the amount of: $'+ document.getElementById(txtCounterOffer).value);
                 if(flag)
                 {                                            
                                         
                     
                 
                        //call a click event of a server side button                  
                        bt.click();                                 
                 
                 }
                         
        }            
    }
          
}

function OnGettingValues2() 
{    
     if(mobjXMLRequest.readyState == 4)
     {       
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeAction2(DSTag);
        }
    }
}  

function OnGettingValuesForOfferStatus() 
{    
     if(mobjXMLRequest.readyState == 4)
     {       
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeActionForOfferStatus(DSTag);
        }
    }
}  

function TakeActionForOfferStatus(DSTag)
{      
    var ComboTable = DSTag.getElementsByTagName('Table');   
   
    var CurrentOfferStatus = ComboTable[0].getElementsByTagName('CurrentOfferStatus')[0].firstChild.nodeValue;
    var CurrentOfferStatusOfCurrentLogger = ComboTable[0].getElementsByTagName('CurrentOfferStatusOfCurrentLogger')[0].firstChild.nodeValue;
     var DeletedBy = ComboTable[0].getElementsByTagName('DeletedBy')[0].firstChild.nodeValue;
        
    // bt is object of server side button for executing the onclick event from client side.
    var bt = document.getElementById('btnDdlSelectedIndexChanged');      
    
    if(CurrentOfferStatus=="D" || CurrentOfferStatus=="A" || DeletedBy!='ZZ')
    {
         var flag=confirm('You are about to delete this offer.');   
         if(flag)
            bt.click();  
    }
    else if (CurrentOfferStatusOfCurrentLogger=='TA' && DeletedBy=='ZZ')
    {
         alert('You must retract your offer to delete.');   
        return false;
    }
    else
    {
        var flag=confirm('You are about to delete this offer and end the communication.');   
        if(flag)
         bt.click(); 
    }
      
       
          
}

// --------------------end here---------------------------------------------------------------------

// calling a method from buyinginterestadd.aspx for bind model through ajax on make change.
function BindModelThroughAjax(strcat,strsubcat,pagePath,hdName,pageName)
{      
     //debugger;
     //set value in global variable 
     _pageName = pageName;
     
    //set model value to 0
    document.getElementById(hdName).value = 0;
    
    subCat=strsubcat;
    var pobjid = document.getElementById(strcat);
    var pobjidvalue = pobjid.value;
    if(pobjid.value == '' || pobjid.value == null)
    {
        pobjidvalue = -1; 
    }   
    if(pobjid.value == 'O')
    { 
        pobjidvalue = -1; 
        document.getElementById('txtMake').style.display = 'block';
        document.getElementById('txtModel').style.display = 'block';
        document.getElementById('txtMake').disabled=false;
        document.getElementById('txtModel').disabled=false;
        
        if(_pageName=='BuyingInterestAdd' || _pageName=='UploadVehicle')
        {
            var cmbModel=document.getElementById('ddlModel');
            document.getElementById('ddlModel').length = 0;
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Choose One';
            oOption1.value = '0';
            cmbModel.options.add(oOption1);  
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Other';
            oOption1.value = 'O';
            cmbModel.options.add(oOption1);        
            cmbModel.value='O';        
        }        
    }
    else
    {   
          SendRequest5(pobjidvalue,pagePath,pageName);                    
          
          if(_pageName=='BuyingInterestAdd' || _pageName=='UploadVehicle')
          {
                document.getElementById('txtMake').style.display = 'none';
                document.getElementById('txtModel').style.display = 'none';
          } 
    }    
}

function SendRequest5(SelectedId,pagePath)
{    
    var lstrURL = pagePath + "?IdPassed=" + SelectedId;
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValues5;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);
       
    }    
}

//To Get the response of XML
function OnGettingValues5() 
{    
     if(mobjXMLRequest.readyState == 4)
     {        
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeAction5(DSTag,subCat);
        }
    }
}   
  
//To Fill The SubCategory DropDownList
function TakeAction5(DSTag, subCat)
{     
    var lobjCombo = document.getElementById(subCat);
    var ComboTable = DSTag.getElementsByTagName('Table'); 
     
    if(_pageName=='BuyingInterestAdd' || _pageName=='UploadVehicle')
    { 
        lobjCombo.options.length = 0;
        var oOption1 = document.createElement('OPTION');
        oOption1.text = 'Any Model';//To add "Select SubCategory" at 0th Index 
        oOption1.value = '0';
        lobjCombo.options.add(oOption1);
    }   
    
    //Adding Combo other option 
    for(var i=0;i<ComboTable.length;i++)
    {
          var Value = ComboTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ComboTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          lobjCombo.options.add(oOption);          
    }
    if(_pageName=='BuyingInterestAdd' || _pageName=='UploadVehicle')
    {
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Other';
        oOption1.value = 'O';
        lobjCombo.options.add(oOption1);           
    }    
}

//calling method for enable the model text box when user select other from model combo and set the selected value
//in hidden field
function EnableModelTextBox()
{   
    if(document.getElementById('ddlModel').value == "O")
    {
        document.getElementById('hdModelId').value = "O";
        
        document.getElementById('txtModel').style.display = 'block'
        document.getElementById('txtModel').disabled=false;
        return false;
    }
    else 
    {
        if(document.getElementById('ddlModel').value=='00')
        {
            document.getElementById('ddlModel').selectedIndex=0;
        }
            document.getElementById('txtModel').style.display = 'none'
            document.getElementById('hdModelId').value =  document.getElementById('ddlModel').value;        
            return false;
    }
}

// calling a method from setalert.aspx for bind model through ajax on make change.
function BindSetAlertPageModel(strcat,strsubcat,pagePath,hdName)
{       
    //set model value to 0
    document.getElementById(hdName).value = 0;
    
    subCat=strsubcat;
    var pobjid = document.getElementById(strcat);
    var pobjidvalue = pobjid.value;
    if(pobjid.value == '' || pobjid.value == null)
    {
        pobjidvalue = -1; 
    }       
    SendRequest6(pobjidvalue,pagePath);          
}

function SendRequest6(SelectedId,pagePath)
{    
    var lstrURL = pagePath + "?IdPassed=" + SelectedId;
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValues6;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);       
    }    
}

//To Get the response of XML
function OnGettingValues6() 
{    
     if(mobjXMLRequest.readyState == 4)
     {        
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeAction6(DSTag,subCat);
        }
    }
}   
  
//To Fill The SubCategory DropDownList
function TakeAction6(DSTag, subCat)
{     
    var lobjCombo = document.getElementById(subCat);
    var ComboTable = DSTag.getElementsByTagName('Table');      
    
    //Adding Combo other option 
    for(var i=0;i<ComboTable.length;i++)
    {
          var Value = ComboTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ComboTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo                  
             
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          lobjCombo.options.add(oOption);          
    }   
}
// End calling a method from setalert.aspx for bind model through ajax on make change.

// method for set the selected modelid in hidden field.
function SelectModel(ddModelId, HdModel)
{   
    var ModelSelectedValue =  document.getElementById(ddModelId).value; 
    
    if(document.getElementById(ddModelId).value=='00')
    {
        document.getElementById(ddModelId).selectedIndex=0;
    }
    else
    document.getElementById(HdModel).value = ModelSelectedValue;
}

//calling method for enable the model text box when user select other from model combo and set the selected value
//in hidden field in Set Alerts
function EnableModelTextBoxForSetAlerts()
{   
    if(document.getElementById('ddModel').value == "O")
    {
        document.getElementById('hdModelId').value = "O";
        
        document.getElementById('txtModel').style.display = 'block'
        document.getElementById('txtModel').disabled=false;
        return false;
    }
    else 
    {
        if(document.getElementById('ddModel').value=='00')
        {
            document.getElementById('ddModel').selectedIndex=0;
        }
            document.getElementById('txtModel').style.display = 'none'
            document.getElementById('hdModelId').value =  document.getElementById('ddModel').value;        
            return false;
    }
}

//calling a method from manualupload.aspx page for bind the model and exterior color and interior color combos
function BindComboManualUploadPage(MakeId,ModelId,ExtColorId,IntColorId,HdModel,HdExtColor,HdIntColor,pagePath,pageName)
{   
    var categoryid=document.getElementById("HdVehicleId").value;
    
    //set value of vehiclecategory    
    _VehicleCategoryId=categoryid;
    
    //set page name in global variable.   
    _pageName=pageName;
       
    //set model value to 0
    document.getElementById(HdModel).value = 0;
    document.getElementById(HdExtColor).value = 0;
    document.getElementById(HdIntColor).value = 0;       
        
    var MakeValue = document.getElementById(MakeId).value; 
    var ddModel = document.getElementById(ModelId);
    
    //set make value in global variable.
    _MakeValue=MakeValue;   
    _OtherMake=MakeValue;
    
    if(_MakeValue == '' || _MakeValue == null)
    {
        _MakeValue = '0'; 
    }   
    if(_MakeValue == 'O')
    { 
        _MakeValue = '0';
         
        document.getElementById('txtMake').style.display = 'block';
        document.getElementById('txtModel').style.display = 'block';
        document.getElementById('txtMake').disabled=false;
        document.getElementById('txtModel').disabled=false;        
        
        //code for bind choose one and other option in model drop down
        
        document.getElementById(ModelId).length = 0;
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Choose One';
        oOption1.value = '0';
        ddModel.options.add(oOption1);  
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Other';
        oOption1.value = 'O';
        ddModel.options.add(oOption1);        
        ddModel.value='O';
        
        //calling a method to sendrequest.        
        SendRequestManualUpload(_MakeValue,pagePath, _VehicleCategoryId);                      
    }
    else
    {   
        //calling a method to sendrequest.
        SendRequestManualUpload(_MakeValue,pagePath,_VehicleCategoryId);                              

        document.getElementById('txtMake').style.display = 'none';
        document.getElementById('txtModel').style.display = 'none';          
    }    
    
}

function SendRequestManualUpload(_MakeValue,pagePath, CategoryId)
{    
    var lstrURL = pagePath + "?IdPassed=" + _MakeValue + "&PageName=" + _pageName + "&CatId=" + _VehicleCategoryId;
   
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesManualUpload;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);
       
    }    
}

//To Get the response of XML
function OnGettingValuesManualUpload() 
{    
     if(mobjXMLRequest.readyState == 4)
     {        
        if(mobjXMLRequest.status == 200)
        {       
            var DataSet = mobjXMLRequest.responseXML.documentElement;
            TakeActionManualUpload(DataSet);
        }
    }
}   

//To Fill The SubCategory DropDownList
function TakeActionManualUpload(DataSet)
{  

    var boolAddModel;
    boolAddModel=0;
    var OldMakeId=document.getElementById("hdMakeId").value;
    var OldModelId=document.getElementById("hdSelectedModelId").value;
    var OldModelTitle=document.getElementById("hdSelectedModelTitle").value;
   
    var ddModelCombo = document.getElementById('ddlModel');    
    var ddExtColorCombo = document.getElementById('ddlExteriorColor');
    var ddIntColorCombo = document.getElementById('ddlInteriorColor'); 
       
    //codde for model
    if(_MakeValue != 'O')
    {            
        var ModelTable = DataSet.getElementsByTagName('Table'); 
        ddModelCombo.options.length = 0;
        //set Choose One in model combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Choose One';
        oOption1.value = '0';
        ddModelCombo.options.add(oOption1);
        ddModelCombo.value='0';
        //Adding Combo other option 
        for(var i=0;i<ModelTable.length;i++)
        {
              //code for bind records in model combo  
              var Value = ModelTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ModelTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';                // assigning class as used for interior exterior class
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddModelCombo.options.add(oOption);                   
              if(OldMakeId==_MakeValue)
               {
                    if (Value == OldModelId)
                        boolAddModel=1;
               }
    } 
    if((_VehicleCategoryId!=1 && _OtherMake!="0")|| _OtherMake == 'O')
    {
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Other';
            oOption1.value = 'O';
            ddModelCombo.options.add(oOption1); 
            if(_OtherMake == 'O')
            {
                ddModelCombo.selectedIndex=1;
                document.getElementById('hdModelId').value = "O";
            }
    }
   if(OldMakeId==_MakeValue && boolAddModel==0 && OldMakeId!=0)
    {
        var oOption2 = document.createElement('OPTION')
        oOption2.text = OldModelTitle;
        oOption2.value = OldModelId;
        ddModelCombo.options.add(oOption2);        
            
    }  
        //set other in model combo at the last.
        //var oOption1 = document.createElement('OPTION')
        //oOption1 = document.createElement('OPTION');
        //oOption1.text = 'Other';
        //oOption1.value = 'O';
        //ddModelCombo.options.add(oOption1);
    }    
        
    
    //code for exterior color
    if(_VehicleCategoryId==2 || _VehicleCategoryId==5 || _VehicleCategoryId==7 || _VehicleCategoryId==8 || _VehicleCategoryId==10 || _VehicleCategoryId==1 || _VehicleCategoryId==6 || _VehicleCategoryId==11 || _VehicleCategoryId==12)
    {           
        var ExtColorTable = DataSet.getElementsByTagName('Table1'); 
        ddExtColorCombo.options.length = 0;
        //set Choose One in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Choose One';
        oOption1.value = '0';
        ddExtColorCombo.options.add(oOption1); 
        ddExtColorCombo.value='0';
        for(var i=0;i<ExtColorTable.length;i++)
        {          
              //code for bind records in exterior color combo
              var Value = ExtColorTable[i].getElementsByTagName('ExteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ExtColorTable[i].getElementsByTagName('ExteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddExtColorCombo.options.add(oOption);
        } 
        //set other in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Other Exterior Color';
        oOption1.value = 'Other Exterior Color';
        ddExtColorCombo.options.add(oOption1);
    }        
    
    // code for interior color
    if(_VehicleCategoryId==1 || _VehicleCategoryId==6 || _VehicleCategoryId==11 || _VehicleCategoryId==12)
    {           
        var IntColorTable = DataSet.getElementsByTagName('Table2');    
        ddIntColorCombo.options.length = 0;        
        //set Choose One in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Choose One';
        oOption1.value = '0';
        ddIntColorCombo.options.add(oOption1);  
        ddIntColorCombo.value='0';                  
        for(var i=0;i<IntColorTable.length;i++)
        {          
              //code for bind records in interior color combo
              var Value = IntColorTable[i].getElementsByTagName('InteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = IntColorTable[i].getElementsByTagName('InteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddIntColorCombo.options.add(oOption);
        }   
        //set other in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Other Interior Color';
        oOption1.value = 'Other Interior Color';
        ddIntColorCombo.options.add(oOption1);  
    }
}
//till here

//function for chk the open the other exterior color textbox and other interior color textbox.
function chkOtherExteriorColor()
{
    if(document.getElementById('ddlExteriorColor').value=='00')
    {
        document.getElementById('ddlExteriorColor').selectedIndex=0;
    }
    else
    {
        if(document.getElementById('ddlExteriorColor').value == "Other Exterior Color")
        {   
            //alert('hi');        
            document.getElementById('hdExtColorId').value = document.getElementById('ddlExteriorColor').value; 
            document.getElementById('txtOtherExtColor').style.display = "block";
        }
        else
        {    
            document.getElementById('txtOtherExtColor').style.display = "none";     
            document.getElementById('hdExtColorId').value = document.getElementById('ddlExteriorColor').value;             
        }
    }
}

function chkOtherInteriorColor()
{
    if(document.getElementById('ddlInteriorColor').value=='00')
    {
        document.getElementById('ddlInteriorColor').selectedIndex=0;
    }
    else
    {
        if(document.getElementById('ddlInteriorColor').value == "Other Interior Color")
        {
            document.getElementById('hdIntColorId').value = document.getElementById('ddlInteriorColor').value; 
            document.getElementById('txtOtherIntColor').style.display = "block";
        }
        else
        {
            document.getElementById('txtOtherIntColor').style.display = "none";       
            document.getElementById('hdIntColorId').value = document.getElementById('ddlInteriorColor').value;            
        }
    }    
}
//till here

//calling a method from manualupload.aspx page for bind the model and exterior color and interior color combos
function BindComboSearchVehiclePage(CategoryId,MakeId,ModelId,ExtColorId,IntColorId,HdModel,HdExtColor,HdIntColor,pagePath,pageName)
{   
    
     var categoryid=document.getElementById(CategoryId).value;
     //alert(categoryid);
     
     //set value in gloabal variables.  
    _VehicleCategoryId=categoryid;    
    _pageName=pageName;
    _ddModel=ModelId;
    _ddExteriorColor=ExtColorId;
    _ddInteriorColor=IntColorId;
   // _ddBodyType= BodyType   
       
    //set model value to 0
    document.getElementById(HdModel).value = "All Models";
    //document.getElementById(HdBodyType).value = 0;
    document.getElementById(HdExtColor).value = 0;
    document.getElementById(HdIntColor).value = 0;        
    
    var MakeValue = document.getElementById(MakeId).value; 
    
    //set make value in global variable.
    _MakeValue=MakeValue;   
    
    if(_MakeValue == '' || _MakeValue == null)
    {
        _MakeValue = '0'; 
    }       
    else
    {   
        //calling a method to sendrequest.
        SendRequestSearchVehiclePage(_MakeValue,pagePath,categoryid);                 
    }    
}

function SendRequestSearchVehiclePage(_MakeValue,pagePath, CategoryId)
{    
    var lstrURL = pagePath + "?IdPassed=" + _MakeValue + "&PageName=" + _pageName + "&CatId=" + CategoryId;
   
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesSearchVehiclePage;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);       
    }    
}

//To Get the response of XML
function OnGettingValuesSearchVehiclePage() 
{    
     if(mobjXMLRequest.readyState == 4)
     {        
        if(mobjXMLRequest.status == 200)
        {       
            var DataSet = mobjXMLRequest.responseXML.documentElement;
            TakeActionSearchVehiclePage(DataSet);
        }
    }
}   

//To Fill The SubCategory DropDownList
function TakeActionSearchVehiclePage(DataSet)
{  
    var ddModelCombo = document.getElementById(_ddModel);    
    var ddExtColorCombo = document.getElementById(_ddExteriorColor);
    var ddIntColorCombo = document.getElementById(_ddInteriorColor);  
    var ddBodyTypeCombo = document.getElementById(_ddBodyType);  
    
    //codde for model              
    var ModelTable = DataSet.getElementsByTagName('Table'); 
    ddModelCombo.options.length = 0;
    //set Choose One in model combo at the beginning.
    var oOption1 = document.createElement('OPTION')
    oOption1 = document.createElement('OPTION');
    oOption1.text = 'All Models';
    oOption1.value = '0';
    ddModelCombo.options.add(oOption1);
    ddModelCombo.value='0';
    //Adding Combo other option 
    for(var i=0;i<ModelTable.length;i++)
    {
          //code for bind records in model combo  
          var Value = ModelTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ModelTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';                // assigning class as used for interior exterior class
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
          ddModelCombo.options.add(oOption);                   
    }        
    

    //code for exterior color
    if(_VehicleCategoryId==2 || _VehicleCategoryId==5 || _VehicleCategoryId==7 || _VehicleCategoryId==8 || _VehicleCategoryId==10 || _VehicleCategoryId==1 || _VehicleCategoryId==6 || _VehicleCategoryId==11 || _VehicleCategoryId==12)
    {           
        var ExtColorTable = DataSet.getElementsByTagName('Table1'); 
        ddExtColorCombo.options.length = 0;
        //set Choose One in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Exterior Colors';
        oOption1.value = '0';
        ddExtColorCombo.options.add(oOption1); 
        ddExtColorCombo.value='0';
        for(var i=0;i<ExtColorTable.length;i++)
        {          
              //code for bind records in exterior color combo
              var Value = ExtColorTable[i].getElementsByTagName('ExteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ExtColorTable[i].getElementsByTagName('ExteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddExtColorCombo.options.add(oOption);
        }         
    }        
    
    // code for interior color
    if(_VehicleCategoryId==1 || _VehicleCategoryId==6 || _VehicleCategoryId==11 || _VehicleCategoryId==12)
    {           
        var IntColorTable = DataSet.getElementsByTagName('Table2');    
        ddIntColorCombo.options.length = 0;        
        //set Choose One in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Interior Colors';
        oOption1.value = '0';
        
        ddIntColorCombo.options.add(oOption1);  
        ddIntColorCombo.value='0';                  
        for(var i=0;i<IntColorTable.length;i++)
        {          
              //code for bind records in interior color combo
              var Value = IntColorTable[i].getElementsByTagName('InteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = IntColorTable[i].getElementsByTagName('InteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddIntColorCombo.options.add(oOption);
        }           
    }
}
//till here


////methods for set Bodytype, exterior and interior color value in hidden filelds.
function SetBodyStyleInHiddenField(ddBodyStyleId,hdBodyStyleId)
{
    if(document.getElementById(ddBodyStyleId).value=='00')
    {
        document.getElementById(ddBodyStyleId).selectedIndex=0;
    }
    else
    {
        if(document.getElementById(ddBodyStyleId).value == "Other Body Type")
        {   
            //alert('hi');        
            document.getElementById(hdBodyStyleId).value = document.getElementById(ddBodyStyleId).value; 
            document.getElementById('txtOtherBodyType').style.display = "block";
        }
        else
        {    if(document.getElementById('txtOtherBodyType')!=null)
                document.getElementById('txtOtherBodyType').style.display = "none";     
            
            document.getElementById(hdBodyStyleId).value = document.getElementById(ddBodyStyleId).value;             
        }
    }
      
}


function SetExteriorColorInHiddenField(ddExtColorId,hdExtColorId)
{
    if(document.getElementById(ddExtColorId).value=='00')
    {
        document.getElementById(ddExtColorId).selectedIndex=0;
    }
    else
        document.getElementById(hdExtColorId).value = document.getElementById(ddExtColorId).value;     
}
function SetInteriorColorInHiddenField(ddIntColorId,hdIntColorId)
{
    if(document.getElementById(ddIntColorId).value=='00')
    {
        document.getElementById(ddIntColorId).selectedIndex=0;
    }
    else
    document.getElementById(hdIntColorId).value = document.getElementById(ddIntColorId).value;     
}
//till here

//calling a method from quick search vehicle control and home.aspx page for bind the model as per selection of make
function SendRequestThroughAjaxQuickSearch(strcat,strsubcat,pagePath,hdName,pageName)
{         
     //set value in global variable 
     _pageName = pageName;
     
    //set model value to 0
    document.getElementById(hdName).value = 0;
    
    subCat=strsubcat;
    var pobjid = document.getElementById(strcat);
    var pobjidvalue = pobjid.value;
    if(pobjid.value == '' || pobjid.value == null)
    {
        pobjidvalue = -1; 
    }
   
    if(pobjid.value == 'O')
    { 
        pobjidvalue = -1;                         
        
        var cmbModel=document.getElementById('ddModel');
        document.getElementById('ddModel').length = 0;
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Models';
        oOption1.value = '0';
        cmbModel.options.add(oOption1);            
    }
    else
    {   
          SendRequestQuickSearch(pobjidvalue,pagePath,pageName);
         
          FillHiddenField(strcat,hdName,_pageName) 
    }    
}

function SendRequestQuickSearch(SelectedId,pagePath)
{    
    var lstrURL = pagePath + "?IdPassed=" + SelectedId + "&PageName=" + _pageName;
         
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesQuickSearch;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);       
    }    
}

//To Get the response of XML
function OnGettingValuesQuickSearch() 
{    
     if(mobjXMLRequest.readyState == 4)
     {        
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeActionQuickSearch(DSTag,subCat);
        }
    }
}   
  
//To Fill The SubCategory DropDownList
function TakeActionQuickSearch(DSTag, subCat)
{        
    var lobjCombo = document.getElementById(subCat);
    var ComboTable = DSTag.getElementsByTagName('Table');
 
    if(_pageName=='QuickSearch' || _pageName=='Home')
    {
        lobjCombo.options.length = 0;
        var oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Models';//To add "Select SubCategory" at 0th Index 
        oOption1.value = '0';
        lobjCombo.options.add(oOption1);         
    }
     
    for(var i=0;i<ComboTable.length;i++)
    {
          var Value = ComboTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ComboTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';                // assigning class as used for interior exterior class
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
          lobjCombo.options.add(oOption);          
    }    
}

function FillHiddenField(ctrName,hdName,pageName)
{
    if(document.getElementById(ctrName).value=='O')
    {
       document.getElementById(hdName).value =0;
    }
    else
    {
       document.getElementById(hdName).value =  document.getElementById(ctrName).value;
    }     
}
//End here

// calling a method from buyingInterteadd.aspx and setalerts.aspx page for bind exterior and interior color on make selection
function BindComboBuyingInterest(CategoryId,MakeId,ModelId,ExtColorId,IntColorId,HdModel,HdExtColor,HdIntColor,pagePath,pageName)
{     
    //debugger;

    //alert('hello');   
     var categoryid=document.getElementById(CategoryId).value;   
    
              
     //set value in gloabal variables.  
    _VehicleCategoryId=categoryid;    
    _pageName=pageName;
    _ddModel=ModelId;
    _ddExteriorColor=ExtColorId;
    _ddInteriorColor=IntColorId;
    //_ddBodyType=BodyType    
    
    //three choice of exterior color.
    _ddExteriorColor1='ddExteriorColor1';
    _ddExteriorColor2='ddExteriorColor2';
    _ddExteriorColor3='ddExteriorColor3';
    
    //three choice of interior colors
    _ddInteriorColor1='ddInteriorColor1';
    _ddInteriorColor2='ddInteriorColor2';
    _ddInteriorColor3='ddInteriorColor3';
       
    //set model value to 0
    document.getElementById(HdModel).value = 0;
    document.getElementById(HdExtColor).value = 0;
    document.getElementById(HdIntColor).value = 0; 
    
    
    //set value 0 of three exterior color choice
    document.getElementById('hdExtColorId1').value = 0;
    document.getElementById('hdExtColorId2').value = 0;
    document.getElementById('hdExtColorId3').value = 0; 
    
    //set value 0 of three interior color choice
    document.getElementById('hdIntColorId1').value = 0;
    document.getElementById('hdIntColorId2').value = 0;
    document.getElementById('hdIntColorId3').value = 0;        
    
    var MakeValue = document.getElementById(MakeId).value; 
    var ddModel=document.getElementById(ModelId);
    
    //set make value in global variable.
    _MakeValue=MakeValue;  
    _OtherMake=MakeValue; 
    
    if(_MakeValue == '' || _MakeValue == null)
    {
        _MakeValue = '0'; 
    }  
    if(_MakeValue == 'O')
    { 
        _MakeValue = '0';
         
        document.getElementById('txtMake').style.display = 'block';
        document.getElementById('txtModel').style.display = 'block';
        document.getElementById('txtMake').disabled=false;
        document.getElementById('txtModel').disabled=false;        
        
        //code for bind choose one and other option in model drop down
        
        document.getElementById(ModelId).length = 0;
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Models';
        oOption1.value = '0';
        ddModel.options.add(oOption1);  
        
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'Other';
        oOption1.value = 'O';
        ddModel.options.add(oOption1);        
        ddModel.value='O';
        
       //calling a method to sendrequest.
       SendRequestBuyingInterest(_MakeValue,pagePath,categoryid);                    
    }     
    else
    {   
        //calling a method to sendrequest.
        SendRequestBuyingInterest(_MakeValue,pagePath,categoryid);   
        
        if(_pageName == 'BuyingInterestAdd' || _pageName == 'SetAlerts')
        {
            document.getElementById('txtMake').style.display = 'none';
            document.getElementById('txtModel').style.display = 'none';               
        }
    }  
   
}

function SendRequestBuyingInterest(_MakeValue,pagePath, CategoryId)
{    
    var lstrURL = pagePath + "?IdPassed=" + _MakeValue + "&PageName=" + _pageName + "&CatId=" + CategoryId;
   
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesBuyingInterest;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);       
    }    
}

//To Get the response of XML
function OnGettingValuesBuyingInterest() 
{    
     if(mobjXMLRequest.readyState == 4)
     {        
        if(mobjXMLRequest.status == 200)
        {       
            var DataSet = mobjXMLRequest.responseXML.documentElement;
            TakeActionBuyingInterest(DataSet);
        }
    }
}   

//To Fill The SubCategory DropDownList
function TakeActionBuyingInterest(DataSet)
{  
    var boolAddModel;
    boolAddModel=0;
    if(_pageName=='BuyingInterestAdd' ||_pageName == 'SetAlerts' )
        {
            var OldMakeId=document.getElementById("hdMakeId").value;
            var OldModelId=document.getElementById("hdSelectedModelId").value;
            var OldModelTitle=document.getElementById("hdSelectedModelTitle").value;
        }
     else
     var OldMakeId=0;
    
    var ddModelCombo = document.getElementById(_ddModel);    
    var ddExtColorCombo = document.getElementById(_ddExteriorColor);
    var ddIntColorCombo = document.getElementById(_ddInteriorColor); 
    var ddBodyTypeCombo = document.getElementById(_ddBodyType); 
    
    //three choice of exterior color 
    var ddExtColorCombo1 = document.getElementById(_ddExteriorColor1);
    var ddExtColorCombo2 = document.getElementById(_ddExteriorColor2);
    var ddExtColorCombo3 = document.getElementById(_ddExteriorColor3);
    
    //three choice of interior colors
    var ddIntColorCombo1 = document.getElementById(_ddInteriorColor1);
    var ddIntColorCombo2 = document.getElementById(_ddInteriorColor2);
    var ddIntColorCombo3 = document.getElementById(_ddInteriorColor3);       
    
    //codde for model              
    var ModelTable = DataSet.getElementsByTagName('Table'); 
    ddModelCombo.options.length = 0;
    //set Choose One in model combo at the beginning.
    var oOption1 = document.createElement('OPTION')
    oOption1 = document.createElement('OPTION');
    oOption1.text = 'All Models';
    oOption1.value = '0';
    ddModelCombo.options.add(oOption1);
    ddModelCombo.value='0';
    //Adding Combo other option 
    for(var i=0;i<ModelTable.length;i++)
    {
          //code for bind records in model combo  
          var Value = ModelTable[i].getElementsByTagName('ModelId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
          var Text = ModelTable[i].getElementsByTagName('ModelTitle')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
          var oOption = document.createElement('OPTION');
          oOption.text = Text;
          oOption.value = Value;
          if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';                // assigning class as used for interior exterior class
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
          ddModelCombo.options.add(oOption);                   
          
           if(OldMakeId==_MakeValue)
           {
                if (Value == OldModelId)
                    boolAddModel=1;
           }
    } 
    if((_VehicleCategoryId!=1 && _MakeValue!="0") || _OtherMake == 'O')
    {
            var oOption1 = document.createElement('OPTION')
            oOption1 = document.createElement('OPTION');
            oOption1.text = 'Other';
            oOption1.value = 'O';
            ddModelCombo.options.add(oOption1); 
            if(_OtherMake == 'O')
            {
                ddModelCombo.selectedIndex=1;
                document.getElementById('hdModelId').value = "O";
            }
    }
   if(OldMakeId==_MakeValue && boolAddModel==0 && OldMakeId!=0)
    {
        var oOption2 = document.createElement('OPTION')
        oOption2.text = OldModelTitle;
        oOption2.value = OldModelId;
        ddModelCombo.options.add(oOption2);        
        
    }  
     
    //set other in model combo at the last.
//    if(_pageName == 'BuyingInterestAdd')
//    {                
//        var oOption1 = document.createElement('OPTION')
//        oOption1 = document.createElement('OPTION');
//        oOption1.text = 'Other';
//        oOption1.value = 'O';
//        ddModelCombo.options.add(oOption1);    
//    } 
    
       
    //code for exterior color
    if(_VehicleCategoryId==2 || _VehicleCategoryId==5 || _VehicleCategoryId==7 || _VehicleCategoryId==8 || _VehicleCategoryId==10 || _VehicleCategoryId==6 || _VehicleCategoryId==11 || _VehicleCategoryId==12)
    {           
        var ExtColorTable = DataSet.getElementsByTagName('Table1'); 
        ddExtColorCombo.options.length = 0;
        //set Choose One in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Exterior Colors';
        oOption1.value = '0';
        ddExtColorCombo.options.add(oOption1); 
        ddExtColorCombo.value='0';
        for(var i=0;i<ExtColorTable.length;i++)
        {          
              //code for bind records in exterior color combo
              var Value = ExtColorTable[i].getElementsByTagName('ExteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ExtColorTable[i].getElementsByTagName('ExteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddExtColorCombo.options.add(oOption);
        }         
    } 
    
    if(_VehicleCategoryId==1)       
    {
        // code for bind exterior color
        var ExtColorTable = DataSet.getElementsByTagName('Table1'); 
        
        ddExtColorCombo1.options.length = 0;
        ddExtColorCombo2.options.length = 0;
        ddExtColorCombo3.options.length = 0;
        
        //set Choose One in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Exterior Colors';
        oOption1.value = '0';
        ddExtColorCombo1.options.add(oOption1); 
        ddExtColorCombo1.value='0';
        
        //set Choose One in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Exterior Colors';
        oOption1.value = '0';
        ddExtColorCombo2.options.add(oOption1); 
        ddExtColorCombo2.value='0';
        
        //set Choose One in exterior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Exterior Colors';
        oOption1.value = '0';
        ddExtColorCombo3.options.add(oOption1); 
        ddExtColorCombo3.value='0';
        
        for(var i=0;i<ExtColorTable.length;i++)
        {          
              //code for bind records in exterior color combo
              var Value = ExtColorTable[i].getElementsByTagName('ExteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ExtColorTable[i].getElementsByTagName('ExteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddExtColorCombo1.options.add(oOption);
              
              //code for bind records in exterior color combo
              var Value = ExtColorTable[i].getElementsByTagName('ExteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ExtColorTable[i].getElementsByTagName('ExteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddExtColorCombo2.options.add(oOption);
              
              //code for bind records in exterior color combo
              var Value = ExtColorTable[i].getElementsByTagName('ExteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = ExtColorTable[i].getElementsByTagName('ExteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddExtColorCombo3.options.add(oOption);
        }
        
        // code for bind interior color
        var IntColorTable = DataSet.getElementsByTagName('Table2'); 
           
        ddIntColorCombo1.options.length = 0; 
        ddIntColorCombo2.options.length = 0; 
        ddIntColorCombo3.options.length = 0; 
               
        //set Choose One in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Interior Colors';
        oOption1.value = '0';
        ddIntColorCombo1.options.add(oOption1);  
        ddIntColorCombo1.value='0';  
        
         //set Choose One in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Interior Colors';
        oOption1.value = '0';
        ddIntColorCombo2.options.add(oOption1);  
        ddIntColorCombo2.value='0';       
        
         //set Choose One in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Interior Colors';
        oOption1.value = '0';
        ddIntColorCombo3.options.add(oOption1);  
        ddIntColorCombo3.value='0';  
                             
        for(var i=0;i<IntColorTable.length;i++)
        {          
              //code for bind records in interior color combo
              var Value = IntColorTable[i].getElementsByTagName('InteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = IntColorTable[i].getElementsByTagName('InteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddIntColorCombo1.options.add(oOption);
              
              //code for bind records in interior color combo
              var Value = IntColorTable[i].getElementsByTagName('InteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = IntColorTable[i].getElementsByTagName('InteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddIntColorCombo2.options.add(oOption);
              
              //code for bind records in interior color combo
              var Value = IntColorTable[i].getElementsByTagName('InteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = IntColorTable[i].getElementsByTagName('InteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddIntColorCombo3.options.add(oOption);
        }                     
    }
    
    // code for interior color
    if(_VehicleCategoryId==6 || _VehicleCategoryId==11 || _VehicleCategoryId==12)
    {           
        var IntColorTable = DataSet.getElementsByTagName('Table2');    
        ddIntColorCombo.options.length = 0;        
        //set Choose One in interior color combo at the last.
        var oOption1 = document.createElement('OPTION')
        oOption1 = document.createElement('OPTION');
        oOption1.text = 'All Interior Colors';
        oOption1.value = '0';
        ddIntColorCombo.options.add(oOption1);  
        ddIntColorCombo.value='0';                  
        for(var i=0;i<IntColorTable.length;i++)
        {          
              //code for bind records in interior color combo
              var Value = IntColorTable[i].getElementsByTagName('InteriorColorId')[0].firstChild.nodeValue;//To set the Value field of Subcategory Combo
              var Text = IntColorTable[i].getElementsByTagName('InteriorColorName')[0].firstChild.nodeValue;//To set the Text field of Subcategory Combo
              var oOption = document.createElement('OPTION');
              oOption.text = Text;
              oOption.value = Value;
              if(Value=='0')
              {
                z=document.createAttribute('class');
                z.value = 'IntExtColor';
                oOption.setAttributeNode(z);
                oOption.value='00';
              }
              ddIntColorCombo.options.add(oOption);
        }           
    }
}
// Till Here


//function to set value of model in hidden field

function FillModelField(ctrName,hdName,pageName)
{
    if(document.getElementById(ctrName).value=='00')
    {
        document.getElementById(ctrName).selectedIndex=0;
    }
    else
    {
        if(document.getElementById(ctrName).value=='0')
        {
           document.getElementById(hdName).value='All Models';
        }
        else
        {
           document.getElementById(hdName).value =  document.getElementById(ctrName).options[document.getElementById(ctrName).selectedIndex].text;
        }
    }     
}
//--------------- calling a method on click ShowInterest from vehciledetails page -------------------------//
function MatchBuyerBuyingInterestWithVehicle(sellerid, buyerid, vehicleid, pagePath,source)
{   
   _source = source; // set value of source
   _BuyerId = buyerid; // set value of buyerid
    
   var lstrURL = pagePath + "?SellerId=" + sellerid + "&BuyerId=" + buyerid + "&VehicleId=" + vehicleid;   
   
   GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesShowInterest;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);      
    }
}
//---------------------------------Function Ends here---------------------------------------------- 

function OnGettingValuesShowInterest() 
{    
     if(mobjXMLRequest.readyState == 4)
     {
        //alert(mobjXMLRequest.status); 
        if(mobjXMLRequest.status == 200)
        {       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeActionShowInterest(DSTag);
        }
    }
}  
function TakeActionShowInterest(DSTag)
{     
    
    var ComboTable = DSTag.getElementsByTagName('Table'); 
       
    var lblShowInterest=document.getElementById("lblShowInterest");
    var tdShowInterestHeight=document.getElementById("tdShowInterestHeight");
    
    if(ComboTable.length == 0)
    {  
        tdShowInterestHeight.height="280px";
       document.getElementById("hdBuyingInterest").value="";      
       lblShowInterest.innerHTML='Great! Click the "Send" button, and an email will be sent out to seller asking them to offer you the vehicle. To allow the seller to offer you the vehicle a buying interest will automatically be generated and will be displayed in your profile page.';
    }
    else
    {
        tdShowInterestHeight.height="240px";
        var BuyingInterestID= ComboTable[0].getElementsByTagName('BuyingVehicleId')[0].firstChild.nodeValue;   
        document.getElementById("hdBuyingInterest").value=BuyingInterestID;
        lblShowInterest.innerHTML='Great! Click the "Send" button, and an email will be sent out to seller asking them to offer you the vehicle.';
    }
    showConfirm(_source,'ShowInterest');
    
}

function SetSessionValuesForFooter()
{
    var Urlpath=location.href.toLowerCase();
    
    var lstrURL="";
    if(Urlpath.indexOf("user")>0 ||Urlpath.indexOf("buyers")>0 || Urlpath.indexOf("profile")>0 || Urlpath.indexOf("Vehicle")>0 || Urlpath.indexOf("Results")>0)
    {
         lstrURL = "../User/AjaxFooterLinksSetting.aspx";
    }
    else
    {
        lstrURL = "User/AjaxFooterLinksSetting.aspx";
    }
    
    GetXmlRequest();//Get Response From AjaxReturnDS.aspx
             
    if(mobjXMLRequest)
    { 
        mobjXMLRequest.onreadystatechange = OnGettingValuesFooter;
        mobjXMLRequest.open("GET",lstrURL,true);
        mobjXMLRequest.send(null);
       
    }
}
function OnGettingValuesFooter() 
{
   
      if(mobjXMLRequest.readyState == 4)
     {
        //alert(mobjXMLRequest.status); 
        if(mobjXMLRequest.status == 200)
        {
       
            var DSTag = mobjXMLRequest.responseXML.documentElement;
            TakeActionFooter(DSTagFooter);
        }
    }
}  
function TakeActionFooter(DSTag, subCat)
{    
}
