// JScript File
 var pageRequest=false;
  var dataToSend = null;
  var vDetailTypemodel = null;
    
  //var url = 'http://dev.epsilonium.com/dashdesign/Admin/ajaxfeatures.aspx';
 //var url='http://' + location.host + '/dashdesign/Admin/ajaxfeatures.aspx';
 
// var url='http://' + location.host + '/www/Admin/ajaxfeatures.aspx';
//var url = 'http://localhost:1233/www/ajaxfeatures.aspx';

//var url = 'http://140.99.52.17/dashdesignnew/ajaxfeatures.aspx';

//var url ='http://www.dashdesigns.com/ajaxfeatures.aspx'
var url ='ajaxfeatures.aspx'
 
  
function fetchData(url,dataToSend,objectID)
{  

    if(window.XMLHttpRequest) 
    {
         pageRequest=new XMLHttpRequest();
    }    
       
   
    else if(window.ActiveXObject)
    {
        try {pageRequest = new ActiveXObject("Msxml2.XMLHTTP");} 
        catch (e) 
        {
            try {pageRequest = new ActiveXObject("Microsoft.XMLHTTP");} 
            catch (e) {}
         }
    }
    else  return false;              
    
     if (!pageRequest) 
     {   alert('Cannot create XMLHTTP instance');
         return false;
      }
      
    if (dataToSend)
    {       
        var sendData=dataToSend; 
       
        pageRequest.open('POST',url,true);
        pageRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');        
        pageRequest.send(sendData);
    }
    else
    {
        pageRequest.open('GET',url,true);
        pageRequest.send(null);
    }
    
    pageRequest.onreadystatechange=function()
    {       
       if(objectID!='ctl00_ContentPlaceHolder1_lbldesc')
       {
        filterData(pageRequest,objectID);
     

        
        
        }
        else
        {
          filterData1(pageRequest,objectID);

        }
        
          if (pageRequest.readyState==4)
    {
    
 
 
             if(objectID=='ctl00_ContentPlaceHolder1_drpsubmodel')
             {
            var prodid =  document.getElementById("ctl00_ContentPlaceHolder1_hdproductId").value;
                            if(prodid!=2)
                            {
             
                            if(pageRequest.responseText!="<option   value='No Sub Model'>No Sub Model</option>")
                            {
                            document.getElementById("ctl00_ContentPlaceHolder1_divsubmodel").style.display=""
                            }
                            else
                            {
                               document.getElementById("ctl00_ContentPlaceHolder1_divsubmodel").style.display="none"
                            }
                    
                  }  

              
                       
                    FillOptionBySubModel('ctl00_ContentPlaceHolder1_drpsubmodel','ctl00_ContentPlaceHolder1_drpoptions') 

             }
             
               if(objectID=='ctl00_ContentPlaceHolder1_drpoptions')
             {
             
             
             var prodid =  document.getElementById("ctl00_ContentPlaceHolder1_hdproductId").value;
                            if(prodid==1)
                            {
                                if(pageRequest.responseText!="<option   value='No Option'>No Option</option>")
                                {
                                document.getElementById("ctl00_ContentPlaceHolder1_divoption").style.display=""
                                }
                                
                                            else
                                        {
                                           document.getElementById("ctl00_ContentPlaceHolder1_divoption").style.display="none";
                                        }
                                
                            }  
             //need to remove confirmation according to ticket no 32820 
             if (!(prodid=='1' || prodid=='2' || prodid=='6'))
             {
//alert(prodid);
             
                Filldescription('ctl00_ContentPlaceHolder1_lbldesc')
			 }
               
                }
             
         }
        
        
    }
}


function filterData1(pageRequest,objectID)
{
 
    var object=document.getElementById(objectID);
          
    if (pageRequest.readyState==4)
    {
        if(pageRequest.status==200) 
        {
            if(pageRequest.responseText!="")
            {
           
                object.disabled=false;               
                if(document.all)
                {
                
                    var inner = pageRequest.responseText;
                  

                    object.innerHTML=inner
                    
                }
                else
                {
                        object.innerHTML= pageRequest.responseText;  
                }              
            }
            else
            {
                object.disabled=true;
            }
        }
    }                
}




function filterData(pageRequest,objectID)
{

   if(objectID.id!='ctl00_ContentPlaceHolder1_hdrecordcount')
    {
    var object=document.getElementById(objectID);


    if (pageRequest.readyState==4)
    {
        if(pageRequest.status==200) 
        {
            if(pageRequest.responseText!="")
            {
                object.disabled=false;               
                if(document.all)
                {
                
                    var inner = pageRequest.responseText;
                    
                    select_innerHTML(object,inner);
                }
                else
                {
                     object.innerHTML=pageRequest.responseText;  
                     
                
                     
                }              
            }
            else
            {
                object.disabled=true;
            }
        }
    } 
    
    }
    
                   
}
function select_innerHTML(objeto,innerHTML)
{    
    objeto.innerHTML = ""
      
      objeto.innerHTML="Test";
      
    var selTemp = document.createElement("micoxselect")
    var opt;
    selTemp.id="micoxselect1"
    document.body.appendChild(selTemp)
    selTemp = document.getElementById("micoxselect1")
    selTemp.style.display="none"
    if(innerHTML.indexOf("<option")<0){//se não é option eu converto
        innerHTML = "<option>" + innerHTML + "</option>"
    }
    innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span")
    selTemp.innerHTML = innerHTML
  
     
//      var uname='<%=Session["vdesc"]%>';
    
    for(var i=0;i<selTemp.childNodes.length;i++){
  var spantemp = selTemp.childNodes[i];
  
        if(spantemp.tagName){     
            opt = document.createElement("OPTION")
    
   if(document.all){ //IE
    objeto.add(opt)
   }else{
    objeto.appendChild(opt)
   }       
    
   //getting attributes
   for(var j=0; j<spantemp.attributes.length ; j++){
    var attrName = spantemp.attributes[j].nodeName;
    var attrVal = spantemp.attributes[j].nodeValue;
    if(attrVal){
     try{
      opt.setAttribute(attrName,attrVal);
      opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));
     }catch(e){}
    }
   }
   //getting styles
   if(spantemp.style){
    for(var y in spantemp.style){
     try{opt.style[y] = spantemp.style[y];}catch(e){}
    }
   }
   //value and text
   opt.value = spantemp.getAttribute("value")
   opt.text = spantemp.getAttribute("value")
  // opt.text = spantemp.innerHTML
  
   //IE
   opt.selected = spantemp.getAttribute('selected');
   opt.className = spantemp.className;
  } 
 }    
 document.body.removeChild(selTemp)
 selTemp = null
}
 function sleep(delay)
 {
     var start = new Date().getTime();
     
     while (new Date().getTime() < start + delay);
 }
 

//-------For Make------
function FillMakeByYear(drpyear,drpmake,drpmodel,drpsubmodel,drpoption,hdyear)
{

		var prodid =  document.getElementById("ctl00_ContentPlaceHolder1_hdproductId").value;
//		alert(prodid);
		if (prodid=='2' || prodid=='6' || prodid=='3' || prodid=='4' || prodid=='29')
		{
			document.getElementById('ctl00_ContentPlaceHolder1_spdashcover').style.display="none";
		}
		else
		{

			document.getElementById('ctl00_ContentPlaceHolder1_spdashcover').style.display="";
		}
     var dataToSend = null;
    var vYear = null;
    
    var Index = document.getElementById(drpyear).selectedIndex;  
    if(document.all)
    {
        vYear=document.getElementById(drpyear).options(Index).value;   
        document.getElementById('ctl00_ContentPlaceHolder1_spyear').innerText=vYear  
        document.getElementById('ctl00_ContentPlaceHolder1_spmake').innerText="SELECT MAKE"
        document.getElementById('ctl00_ContentPlaceHolder1_spmodel').innerText="SELECT MODEL"  
        document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').innerText="SELECT SUB MODEL" 
          document.getElementById('ctl00_ContentPlaceHolder1_spoption').innerText="SELECT OPTION";  

    }
    else
    {
        vYear=document.getElementById(drpyear).options[Index].value;  
         
        document.getElementById('ctl00_ContentPlaceHolder1_spyear').textContent=vYear 
        document.getElementById('ctl00_ContentPlaceHolder1_spmake').textContent="SELECT MAKE" 
        document.getElementById('ctl00_ContentPlaceHolder1_spmodel').textContent="SELECT MODEL" 
        document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').textContent="SELECT SUB MODEL"  
          document.getElementById('ctl00_ContentPlaceHolder1_spoption').textContent="SELECT OPTION";   
    }
      
   vDetailTypemodel=vYear
  
   

    document.getElementById(hdyear).value=vDetailTypemodel;
  
  
    var oList = document.getElementById(drpmake);
    for (var i=oList.options.length-1;i>=0;i--)
	{
		oList.options[i] = null;
	}
	
	 var oList1 = document.getElementById(drpmodel);
    for (var i=oList1.options.length-1;i>=0;i--)
	{
		oList1.options[i] = null;
	}
	var oList2 = document.getElementById(drpsubmodel);
    for (var i=oList2.options.length-1;i>=0;i--)
	{
		oList2.options[i] = null;
	}
	var oList3 = document.getElementById(drpoption);
    for (var i=oList3.options.length-1;i>=0;i--)
	{
		oList3.options[i] = null;
	}
	
	
	
	

    var optn = document.createElement("OPTION");
    optn.text = "None";
    optn.value = "";
    oList.options.add(optn);
   dataToSend = "sAction=filteryear&vYear="+escape(vYear)+"&Makeid="+escape(Index);  
   

    fetchData(url,dataToSend,drpmake) 
   
     
     
}


//-------For Model------
function FillModelByMake(drpmake,drpmodel,drpsubmodel,drpoption,hdmake)
{
  

    var dataToSend = null;
    var vmake = null;
    
    var Index = document.getElementById(drpmake).selectedIndex;  
    if(document.all)
    {
        vmake=document.getElementById(drpmake).options(Index).value; 
         document.getElementById('ctl00_ContentPlaceHolder1_spmake').innerText=vmake   
          document.getElementById('ctl00_ContentPlaceHolder1_spmodel').innerText="SELECT MODEL" 
           document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').innerText="SELECT SUB MODEL"
          document.getElementById('ctl00_ContentPlaceHolder1_spoption').innerText="SELECT OPTION";  
                  
    }
    else
    {
        vmake=document.getElementById(drpmake).options[Index].value;   
         document.getElementById('ctl00_ContentPlaceHolder1_spmake').textContent=vmake  
          document.getElementById('ctl00_ContentPlaceHolder1_spmodel').textContent="SELECT MODEL"  
           document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').textContent ="SELECT SUB MODEL" 
          document.getElementById('ctl00_ContentPlaceHolder1_spoption').textContent="SELECT OPTION";       
    }
          
   vDetailTypemodel=vmake
  
   
  
    document.getElementById(hdmake).value=vDetailTypemodel;
  
  
    var oList = document.getElementById(drpmodel);
    for (var i=oList.options.length-1;i>=0;i--)
	{
		oList.options[i] = null;
	}
	
	
	var oList1 = document.getElementById(drpsubmodel);
    for (var i=oList1.options.length-1;i>=0;i--)
	{
		oList1.options[i] = null;
	}
	var oList2 = document.getElementById(drpoption);
    for (var i=oList2.options.length-1;i>=0;i--)
	{
		oList2.options[i] = null;
	}
	
	
	
	
	
   
    var optn = document.createElement("OPTION");
    optn.text = "None";
    optn.value = "";
    oList.options.add(optn);
   dataToSend = "sAction=filtermake&vmake="+escape(vmake)+"&Makeid="+escape(Index);  
   
   
    fetchData(url,dataToSend,drpmodel)  
     
     
}


//-------For SubModel------
function FillSubModelByModel(drpmodel,drpsubmodel,drpoption,hdmodel,lbldesc)
{
   

   document.getElementById('ctl00_ContentPlaceHolder1_spdashcover').style.display="none";
    var dataToSend = null;
    var vmodel = null;
   
    var Index = document.getElementById(drpmodel).selectedIndex;  
    if(document.all)
    {
        vmodel=document.getElementById(drpmodel).options(Index).value; 
          document.getElementById('ctl00_ContentPlaceHolder1_spmodel').innerText=vmodel  ; 
           document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').innerText="SELECT SUB MODEL"
          document.getElementById('ctl00_ContentPlaceHolder1_spoption').innerText="SELECT OPTION";    
    }
    else
    {
        vmodel=document.getElementById(drpmodel).options[Index].value;   
          document.getElementById('ctl00_ContentPlaceHolder1_spmodel').textContent=vmodel ;
           document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').textContent ="SELECT SUB MODEL" 
          document.getElementById('ctl00_ContentPlaceHolder1_spoption').textContent="SELECT OPTION";     
    }
 
   vDetailTypemodel=vmodel
  
   
  
    document.getElementById(hdmodel).value=vDetailTypemodel;
  
  
    var oList = document.getElementById(drpsubmodel);
    for (var i=oList.options.length-1;i>=0;i--)
	{
		oList.options[i] = null;
	}
   
   
   var oList1 = document.getElementById(drpoption);
    for (var i=oList1.options.length-1;i>=0;i--)
	{
		oList1.options[i] = null;
	}
   
   
   
    var optn = document.createElement("OPTION");
    optn.text = "None";
    optn.value = "";
    oList.options.add(optn);
   dataToSend = "sAction=filtermodel&vmodel="+escape(vmodel)+"&Makeid="+escape(Index);     
   
    fetchData(url,dataToSend,drpsubmodel)  
    
   // FillOptionBySubModel(drpsubmodel,drpoption) 
    
  
  
     
}





//For Sub model

function Selectsubmodel(drpsubmodel,hdsubmodelvalue)
{

var voption;
var hdvalue=document.getElementById(hdsubmodelvalue);
 var Index = document.getElementById(drpsubmodel).selectedIndex; 
 var suboption; 
 if(document.all)
    {
        voption=document.getElementById(drpsubmodel).options(Index).value;  
         
          if(voption.length>22)
          {
                       document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').innerText=voption.substring(0,22); 
          }
          else
          {
            document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').innerText=voption; 
          }
           hdvalue.value = voption;       
    }
    else
    {
        voption=document.getElementById(drpsubmodel).options[Index].value;
                 
           if(voption.length>22)
          {
                       document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').textContent=voption.substring(0,22); 
          }
          else
          {
            document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').textContent=voption; 
          }
          
     
          
           hdvalue.value = voption      
    }




   //added by ashish on 15 july
    var oList = document.getElementById(drpsubmodel);
    for (var i=oList.options.length-1;i>=0;i--)
	{
		oList.options[i] = null;
	}
   
    var optn = document.createElement("OPTION");
    optn.text = "None";
    optn.value = "";
    oList.options.add(optn);
    
    dataToSend = "sAction=filterparttype&vparttype="+escape(voption)+"&Makeid="+escape(Index);   
  
    fetchData(url,dataToSend,drpsubmodel)

//added by ashish on 15 july

return false;
}
   
//-------For Option------
function FillOptionBySubModel(drpsubmodel,drpoptions)
{
 
    var dataToSend = null;
    var vsubmodel = null;
    
    var Index = document.getElementById(drpsubmodel).selectedIndex;  
    if(document.all)
    {
        vsubmodel=document.getElementById(drpsubmodel).options(Index).value;  
        // document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').innerText=vsubmodel        
    }
    else
    {
        vsubmodel=document.getElementById(drpsubmodel).options[Index].value;
        // document.getElementById('ctl00_ContentPlaceHolder1_spsubmodel').textContent=vsubmodel         
    }
      
   vDetailTypemodel=vsubmodel
  
   
  
    //document.getElementById(hdsubmodel).value=vDetailTypemodel;
  
  
    var oList = document.getElementById(drpoptions);
    for (var i=oList.options.length-1;i>=0;i--)
	{
		oList.options[i] = null;
	}
   
    var optn = document.createElement("OPTION");
    optn.text = "None";
    optn.value = "";
    oList.options.add(optn);
   dataToSend = "sAction=filtersubmodel&vsubmodel="+escape(vsubmodel)+"&Makeid="+escape(Index); 
  // Filldescription(lbldesc) 
   fetchData(url,dataToSend,drpoptions) 
   
  
     
}


//-------For Description------
function Filldescription(lbldesc)
{

   dataToSend ="sAction=filterdesc";      
   fetchData(url,dataToSend,lbldesc)  
   
     
}







//For Option
function SelectOption(drpoptions,hdoptionvalue)
{
var voption ="";
var hdvalue=document.getElementById(hdoptionvalue);
var chkoptval;


sel = document.getElementById(drpoptions);

	for(x=0; x<sel.length; x++)
	
	{
	
		
	if(sel.options[x].selected==true)
	{




	        if(voption!="")
	        {
	       
		        if(voption!="NO OPTION")
               {
		        
		        voption= voption + ", " + sel.options[x].value;
		        
		        }
		        
		        
	        }// if(voption!="")
	        else
	        {
		        voption=sel.options[x].value;
	        }
	        
	    
	    
            if(document.all)
            {
          
                    if(voption.length>22)
                    {
                    document.getElementById('ctl00_ContentPlaceHolder1_spoption').innerText=voption.substring(0,22); 
                    }
                    else
                    {
                    document.getElementById('ctl00_ContentPlaceHolder1_spoption').innerText=voption
                    }
            
     
             
            hdvalue.value = voption
            }

            else
            {
                    if(voption.length>22)
                    {
                    document.getElementById('ctl00_ContentPlaceHolder1_spoption').textContent=voption.substring(0,22); 
                    }
                    else
                    {
                    document.getElementById('ctl00_ContentPlaceHolder1_spoption').textContent=voption
                    }
       
            hdvalue.value =voption; 

            }
	    
	
	
	}//if(sel.options[x].selected==true)
	
   
   }//for(x=0; x<sel.length; x++)





  


return false;
}
function FillFebric(ddlfebrictype,ddlfebric)
{

  
   var dataToSend = null;
    var vFabricType = null;
    
    var Index = document.getElementById(ddlfebrictype).selectedIndex;  
    if(document.all)
    {
        vFabricType=document.getElementById(ddlfebrictype).options(Index).value;        
    }
    else
    {
        vFabricType=document.getElementById(ddlfebrictype).options[Index].value;       
    }
      
  
      
    var oList = document.getElementById(ddlfebric);
    for (var i=oList.options.length-1;i>=0;i--)
	{
		oList.options[i] = null;
	}
   
    var optn = document.createElement("OPTION");
    optn.text = "None";
    optn.value = "";
    oList.options.add(optn);
    
    dataToSend = "sAction=filterfebric&vfebrictype="+escape(vFabricType)+"&Makeid="+escape(Index);   
  
    fetchData(url,dataToSend,ddlfebric)     
   
  
   
}

function Selectfabricname(drpfabric,hdfabric)
{
var voption;

 var Index = document.getElementById(drpfabric).selectedIndex;  
 if(document.all)
    {
        voption=document.getElementById(drpfabric).options(Index).value;  
              
    }
    else
    {
        voption=document.getElementById(drpfabric).options[Index].value;
               
          
    }
     document.getElementById(hdfabric).value=voption; 
    

return false;
}


function Multiply()
{ 

var hdvalue=document.getElementById('ctl00_ContentPlaceHolder1_hdrecordcount');



var cnt=0;     
cnt = parseInt(hdvalue.value)

var k;
var rval =0;3
var a =0;
var subtotalvalue =0;
var myArray = new Array();

var  passheadrestvalue=0;
var  passarmrestvalue=0;


                     for (k=2;k<=cnt+1;k++)
                                {
                               
                       
var cph = "ctl00_ContentPlaceHolder1_dgShoppingCart_ctl" + (k<=9?"0":"") + k;                                                     
                       
var lbqty=document.getElementById(cph + '_lnkQty');
var hdqty=document.getElementById(cph + '_hdqty');
var txtqty=document.getElementById( cph + '_txtgvQty');
//var price=document.getElementById(cph + '_lblprice');
var price='$' + document.getElementById(cph + '_hdprice').value;
var totalprice=document.getElementById(cph +  '_lbltotalprice');
var lsubtotalprice=document.getElementById(cph +  '_lbldcsubtotprice');


var subtotal = document.getElementById('ctl00_ContentPlaceHolder1_lblsubtotal');
var hdalltotal = document.getElementById('ctl00_ContentPlaceHolder1_hdalltotal');
var lblmsg = document.getElementById('ctl00_ContentPlaceHolder1_lblmsg');
//added on 11 Nov
var Embroidaryprice= document.getElementById(cph + '_HdEmbroideryprice').value;
var Logoprice= document.getElementById(cph + '_hdlogoprice').value;
// end on 11 Nov

//added on 7 dec
var Seatheadrestprice = document.getElementById(cph + '_hdseatheadrestpirce').value;
var Seatarmrestprice = document.getElementById(cph + '_hdarmrestprice').value;
var lblheadrest=document.getElementById(cph + '_lnkheadrest');
var txtheadrest=document.getElementById( cph + '_txtheadrest');
var lblarmrest=document.getElementById(cph + '_lnkarmrest');
var txtarmrest=document.getElementById( cph + '_txtarmrest');
//added on 30march 2010
var vRowsunglide = document.getElementById('ctl00_ContentPlaceHolder1_trsunglide');
var vSunglidedcnt = document.getElementById('ctl00_ContentPlaceHolder1_lblsunglidediscount');
var vRowmemory = document.getElementById('ctl00_ContentPlaceHolder1_trmemory');
var vMemorydcnt = document.getElementById('ctl00_ContentPlaceHolder1_lblmemorydiscount');
var vProductname = document.getElementById(cph +  '_lbldashproductname');
var vDiscountprice =0.0
var vMdiscountprice =0.0






var TotalSeatheadrestprice =0
var TotalSeatarmrestprice =0
 var Seataccoriesprice =0


if(txtheadrest!=null)
{
TotalSeatheadrestprice=parseFloat(Seatheadrestprice) * txtheadrest.value;
passheadrestvalue =txtheadrest.value
}

if(txtarmrest!=null)
{
TotalSeatarmrestprice= parseFloat(Seatarmrestprice) * txtarmrest.value;
passarmrestvalue = txtarmrest.value
}

Seataccoriesprice =parseFloat(TotalSeatheadrestprice) + parseFloat(TotalSeatarmrestprice);


// end on  7 dec




if (txtqty.value<=0)
{

alert("You must enter a quantity greater than 0 OR click the shopping cart icon with the red 'x' to delete the item.")
document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display="none";
document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='inline';
txtqty.focus();
return false;
} 

if (isNaN(txtqty.value))

{

alert("Quantity should be only numeric.")
txtqty.focus();
return false;
} 

//added on 10 dec

if(txtheadrest!=null)
{

    if (txtheadrest.value<=0)
    {

    alert("You must enter a quantity greater than 0 OR click the shopping cart icon with the red 'x' to delete the item.")
		document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display="none";
document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='inline';
    txtheadrest.focus();
    return false;
    } 

    if (isNaN(txtheadrest.value))

    {

    alert("Quantity should be only numeric.")
    txtheadrest.focus();
    return false;
    } 

}


if(txtarmrest!=null)
{


        if (txtarmrest.value<=0)
        {

        alert("You must enter a quantity greater than 0 OR click the shopping cart icon with the red 'x' to delete the item.")
			document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display="none";
document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='inline';
        txtarmrest.focus();
        return false;
        } 

        if (isNaN(txtarmrest.value))

        {

        alert("Quantity should be only numeric.")
        txtarmrest.focus();
        return false;
        } 

}





// end on 10 dec

hdqty.value=txtqty.value;
myArray[k-2] = hdqty.value
if(document.all)
{
var price;
var tprice;

price=price.split("$");
//price=price.value.split("$");
tprice=totalprice.innerText.split("$");

if(Embroidaryprice=="")
{
Embroidaryprice=0;
}
if(Logoprice=="")
{
Logoprice=0;
}




tprice[1]= (parseFloat(price[1])+ parseFloat(Embroidaryprice) + parseFloat(Logoprice)+ parseFloat(Seataccoriesprice)) * txtqty.value;
totalprice.innerText='$' + tprice[1].toFixed(2);// price.innerText * txtqty.value;
lsubtotalprice.innerText='$' + tprice[1].toFixed(2);// price.innerText * txtqty.value;
lbqty.innerHTML =txtqty.value + " " + "<span style='color:#464d77;' >Edit</span>";
if(txtheadrest!=null)
{
lblheadrest.innerHTML=parseInt(txtheadrest.value)* parseInt(txtqty.value)+ " " + "<span style='color:#464d77;' >Edit</span>";
passheadrestvalue =parseInt(txtheadrest.value)* parseInt(txtqty.value)



}
if(txtarmrest!=null)
{
lblarmrest.innerHTML=parseInt(txtarmrest.value)* parseInt(txtqty.value)+ " " + "<span style='color:#464d77;' >Edit</span>";
passarmrestvalue =parseInt(txtarmrest.value)* parseInt(txtqty.value)
      
}
 


if(subtotalvalue==0)
{

var getprice;
getprice =totalprice.innerText.split("$");
subtotalvalue =getprice[1]
    //add on 30march
   
        if(vProductname.innerText=="Memory Foam Steering Wheel Cover™")
        {
        vRowsunglide.style.display="";
        vDiscountprice =parseFloat((getprice[1]*15)/100)

        }
        
         if(vProductname.innerText== "Memory Foam Seat Belt Cushion™")
        {
        vRowmemory.style.display="";
        vMdiscountprice =parseFloat((getprice[1]*15)/100)

        }
        
        
        //end on 30 march





}
else
{
var getprice;
getprice =totalprice.innerText.split("$");
subtotalvalue = parseFloat(subtotalvalue) + parseFloat(getprice[1])
subtotalvalue=Math.round(subtotalvalue * 100) / 100;

    //add on 30march
             if(vProductname.innerText=="Memory Foam Steering Wheel Cover™")
        {
        vRowsunglide.style.display="";
        vDiscountprice = vDiscountprice + parseFloat((getprice[1]*15)/100)

        }
        
          if(vProductname.innerText== "Memory Foam Seat Belt Cushion™")
        {
        vRowmemory.style.display="";
        vMdiscountprice = vMdiscountprice + parseFloat((getprice[1]*15)/100)

        }
        
        //end on 30 march


}





}
else //'  else of if(document.all)
{

var price;
var tprice;

if(Embroidaryprice=="")
{
Embroidaryprice=0;
}
if(Logoprice=="")
{
Logoprice=0;
}




price=price.split("$");
tprice=totalprice.textContent.split("$");
tprice[1]= (parseFloat(price[1])+ parseFloat(Embroidaryprice) + parseFloat(Logoprice)+ parseFloat(Seataccoriesprice)) * txtqty.value;

totalprice.textContent= '$'+ tprice[1].toFixed(2); //'$' + price.textContent * txtqty.value;
lsubtotalprice.textContent= '$'+ tprice[1].toFixed(2); //'$' + price.textContent * txtqty.value;
lbqty.innerHTML=txtqty.value + " " + "<span style='color:#464d77;' >Edit</span>";
if(txtheadrest!=null)
{
lblheadrest.innerHTML=parseInt(txtheadrest.value)* parseInt(txtqty.value)+  " " + "<span style='color:#464d77;' >Edit</span>";
passheadrestvalue =parseInt(txtheadrest.value)* parseInt(txtqty.value)

}
if(txtarmrest!=null)
{
lblarmrest.innerHTML=parseInt(txtarmrest.value)* parseInt(txtqty.value) + " " + "<span style='color:#464d77;' >Edit</span>";
passarmrestvalue = parseInt(txtarmrest.value)* parseInt(txtqty.value)
}


if(subtotalvalue==0)
{

var getprice;
getprice =totalprice.textContent.split("$");
subtotalvalue =getprice[1]

        //add on 30march
              if(vProductname.textContent=="Memory Foam Steering Wheel Cover™")
        {
        vRowsunglide.style.display="";
        vDiscountprice =parseFloat((getprice[1]*15)/100)

        }
        
               if(vProductname.textContent== "Memory Foam Seat Belt Cushion™")
        {
        vRowmemory.style.display="";
        vMdiscountprice =parseFloat((getprice[1]*15)/100)

        }
        
        //end on 30 march


}
else
{
var getprice;
getprice =totalprice.textContent.split("$");

subtotalvalue = parseFloat(subtotalvalue) + parseFloat(getprice[1])
subtotalvalue=Math.round(subtotalvalue * 100) / 100;

        //add on 30march
      if(vProductname.textContent=="Memory Foam Steering Wheel Cover™")
        {
        vRowsunglide.style.display="";
        vDiscountprice = vDiscountprice + parseFloat((getprice[1]*15)/100)

        }
        
        if(vProductname.textContent== "Memory Foam Seat Belt Cushion™")
        {
        vRowmemory.style.display="";
        vMdiscountprice = vMdiscountprice + parseFloat((getprice[1]*15)/100)

        }
        //end on 30 march


}









}


if(document.all)
{


//added on 30march
if (vDiscountprice!="0.0")
{
subtotalvalue =subtotalvalue - vDiscountprice
vSunglidedcnt.innerText ="$" + parseFloat(vDiscountprice).toFixed(2);

}

if (vMdiscountprice!="0.0")
{
subtotalvalue =subtotalvalue - vMdiscountprice
vMemorydcnt.innerText ="$" + parseFloat(vMdiscountprice).toFixed(2);

}



//end on 30march


subtotal.innerText ="$" + parseFloat(subtotalvalue).toFixed(2);
document.getElementById("ctl00_ContentPlaceHolder1_trmsg").style.display="";
lblmsg.innerText="Quantity has been updated."
document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display="inline";
document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='none';

}
else
{


//added on 30march
if (vDiscountprice!="0.0")
{
subtotalvalue =subtotalvalue - vDiscountprice
vSunglidedcnt.textContent ="$" + parseFloat(vDiscountprice).toFixed(2);

}

if (vMdiscountprice!="0.0")
{
subtotalvalue =subtotalvalue - vMdiscountprice
vMemorydcnt.textContent ="$" + parseFloat(vMdiscountprice).toFixed(2);

}
//end on 30march


subtotal.textContent ="$" + parseFloat(subtotalvalue).toFixed(2);
document.getElementById("ctl00_ContentPlaceHolder1_trmsg").style.display="";
lblmsg.textContent="Quantity has been updated."
document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display="inline";
document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='none';

}
totalprice.style.display="none"
hdalltotal.value= subtotalvalue;
lbqty.style.display="block";
txtqty.style.display="none";
if(txtheadrest!=null)
{
lblheadrest.style.display="block";
txtheadrest.style.display="none";
}
if(txtarmrest!=null)
{
lblarmrest.style.display="block";
txtarmrest.style.display="none"; 
}




//return false;


}
//alert(document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display);
 

dataToSend = "sAction=shoppingcart&arrqty=" + myArray + "&passheadrestvalue=" + passheadrestvalue + "&passarmrestvalue=" + passarmrestvalue + "&disountprice=" + vDiscountprice + "&Mdisountprice=" + vMdiscountprice;
  
    fetchData(url,dataToSend,hdvalue)   

  if (document.getElementById('ctl00_ContentPlaceHolder1_imgcheckout').style.display=='inline')
	{
  document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='none';
  }
  else
	{
  document.getElementById('ctl00_ContentPlaceHolder1_dvupdate').display='inline';
  }

return false;
}



