function getSeries()
{ 
  $.post(siteurl+"ajax.php", { 
         action : 'series', 
         brand  : $("#brand").val() 
        },
  function(data){
   if(data)
   {
       $("#series_td").html(data);
       $("#model_td").html('');
       $("#model_num_td").html('');
   }
  });
}
function getSeries_order()
{ 
  $.post(siteurl+"ajax.php", { 
         action : 'series', 
         brand  : $("#brand").val() 
        },
  function(data){
   if(data)
   {
       $("#series_td").html(data);
       $("#model_td").html('');
       $("#model_num_td").html('');
   }
  });
}

function getModel()
{ 
  $.post(siteurl+"ajax.php", { 
         action : 'model', 
         series  : $("#series").val() 
        },
  function(data){
   if(data)
   {
       getModelPrice()
       $("#model_td").html(data);
       $("#model_num_td").html('');
   }
  });
}
function getModelPrice()
{
  $.post(siteurl+"ajax.php", { 
         action : 'model_price', 
         model  : $("#model").val() 
        },
  function(data){
   if(data)
   {
       $("#price").attr("value",data);
   }
  });
}


function getModelNumber()
{
  $.post(siteurl+"ajax.php", { 
         action  : 'model_number', 
         model  : $("#model").val() 
        },
  function(data){
   if(data)
   {
        getModelPrice();
       $("#model_num_td").html(data);
   }
  });
}

function getCompatiableModelNumber()
{
  $.post(siteurl+"ajax.php", { 
         action  : 'compatiable_model_number', 
         model_num  : $("#model_num").val() 
        },
  function(data){
   if(data)
   {
       $("#com_model_num_td").html(data);
   }
  });
}


function addMore()
{ 
   
	count	= jQuery("#addmore_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#addmore_div").append("<tr id='addmore_"+ count+"'> <td class='list_head' width='30%'>KEY "+count+" :</td><td class ='normal_text'><input type='text'  name='key[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_ship("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#addmore_count").attr('value',count);
}

function add_outofstock()
{
	count	= jQuery("#add_outofstock_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#add_outofstock_div").append("<tr id='add_outofstock_"+ count+"'> <td class='list_head' width='30%'>KEY "+count+" :</td><td class ='normal_text'><input type='text'  name='key[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItemoutofstock("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#add_outofstock_count").attr('value',count);
}

function removeItemoutofstock(id)
{
     
	jQuery("#add_outofstock_"+id).remove();  
	
} 
function removeItem_ship(id)
{
   
    count	= jQuery("#addmore_count").val();
    var kk = parseInt(count)-parseInt(1);
	jQuery("#addmore_"+id).remove();  
	jQuery("#addmore_count".replace("replace-", "")).val(kk);
	
  
} 
function closeRefresh()
{
    window.close();
    if (window.opener && !window.opener.closed) {
        window.opener.location.reload();
    } 
}
function removeItem_stock(id)
{
	jQuery("#addstockmore_"+id).remove();  
	
} 

function addStockMore()
{
	count	= jQuery("#addstockmore_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#addstockmore_div").append("<tr id='addstockmore_"+ count+"'> <td class='list_head' width='30%'>KEY "+count+" :</td><td class ='normal_text'><input type='text'  name='stockkey[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_stock("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#addstockmore_count").attr('value',count);
}

function removeItem_fur(id)
{
	jQuery("#addfurmore_"+id).remove();  
	
} 

function addMorePhotos()
{ 
   	count	= jQuery("#addmorephotos_count").val();  
   	if(count <3)
   	{
	count = parseInt(count)+parseInt(1);
	jQuery("#addmorephotos_div").append("<tr id='addmorephotos_"+ count+"'><td class='list_head' width='30%' nowrap='nowrap'>Photo :</td><td class ='normal_text'><input type='file'  name='photo[]' size='5'  /></td><td align='left' ><img src='images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removePhoto("+count+")' style='cursor:pointer'/></tr>");
	jQuery("#addmorephotos_count").attr('value',count);
   	}
   	else
   	{
   	    alert("Sorry.You cannot upload more than 3 photos.")
   	}
	
}

function removePhoto(id)
{
	jQuery("#addmorephotos_"+id).remove();  
} 


function addMoreModels() // in  multi duplicate in models
{
	count	= jQuery("#addmoremodels_count").val();
	count = parseInt(count)+parseInt(1);	
	jQuery("#addmoremodels_div").append("<tr id='addmoremodels_"+ count+"' height='30'><td align='right' class='leftlabel'  >Enter Model Name :&nbsp;</td><td align='left' width='20%'><input type='text' name='cupnamedup[]' id='cupnamedup' ></td><td align='right' class='leftlabel'  >Select Listing:&nbsp;</td><td align='left' width='20%' ><select name='browse_type_dup[]'><option value='1'> Browse 1</option><option value='2'> Browse 2</option></select></td><td width='10%' align='left'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeMultiduplicate("+count+")' style='cursor:pointer'/></td><td width='20%'>&nbsp;</td></tr>");	
	jQuery("#addmoremodels_count").attr('value',count);
}

function removeMultiduplicate(id)
{
	jQuery("#addmoremodels_"+id).remove();  
} 


function addMoreModelsinModlnum() // in  multi duplicate in models
{
	count	= jQuery("#addmoremodelsmnum_count").val();
	count = parseInt(count)+parseInt(1);	
	jQuery("#addmoremodelsmnum_div").append("<tr id='addmoremodelsmnum_"+ count+"' height='30'><td align='right' class='leftlabel' width='30%' >Enter Model Name :&nbsp;</td><td align='left' width='70%'><input type='text' name='cupnamedup[]' id='cupnamedup' ><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removemoremodelsmnum("+count+")' style='cursor:pointer'/></td></tr>");	
	jQuery("#addmoremodelsmnum_count").attr('value',count);
}

function removemoremodelsmnum(id)
{
	jQuery("#addmoremodelsmnum_"+id).remove();  
} 

function addMoreHinges()
{
	count	= jQuery("#addmorehinges_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#addmorehinges_div").append("<tr id='addmorehinges_"+ count+"'> <td class='list_head' width='30%'>SET "+count+" :</td><td class ='normal_text'><input type='text'  name='hinges[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItemHinge("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#addmorehinges_count").attr('value',count);
}

function removeItemHinge(id)
{
     
	jQuery("#addmorehinges_"+id).remove();  
		
}

function add_outofstock_hinges()
{
	count	= jQuery("#add_outofstock_hinges_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#add_outofstock_hinges_div").append("<tr id='add_outofstock_hinges_"+ count+"'> <td class='list_head' width='30%'>SET "+count+" :</td><td class ='normal_text'><input type='text'  name='hinges[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItemoutofstock_hinges("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#add_outofstock_hinges_count").attr('value',count);
}

function removeItemoutofstock_hinges(id)
{
     
	jQuery("#add_outofstock_hinges_"+id).remove();  
		
}

function addStockMoreHinges()
{
	count	= jQuery("#addstockmore_hinges_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#addstockmore_hinges_div").append("<tr id='addstockmore_hinges_"+ count+"'> <td class='list_head' width='30%'>SET "+count+" :</td><td class ='normal_text'><input type='text'  name='stockhinge[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_stock_hinges("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#addstockmore_hinges_count").attr('value',count);
}

function removeItem_stock_hinges(id)
{
	jQuery("#addstockmore_hinges_"+id).remove();  
	
} 

function removeItem_fur_hinges(id)
{
	jQuery("#addfurmore_hinges_"+id).remove();  
	
} 

function add_keys_edit_shoppingcart()
{
                    	count	= jQuery("#key_count").val();
                    	count = parseInt(count)+parseInt(1);
                    	jQuery("#add_key_shoppingcart_div").append("<tr id='add_key_shopcart_"+ count+"'> <td class='list_head' width='30%'>KEY "+count+" :</td><td class ='normal_text'><input type='text'  name='key[]'  style='width:35%' /></td><td align='left' width='10%'><img src='./images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_shoppingcart("+count+")' style='cursor:pointer'/></td></tr>");
                    	jQuery("#key_count").attr('value',count);
}
                    
function removeItem_shoppingcart(id)
{                         
    count	= jQuery("#key_count").val();
    var kk = parseInt(count)-parseInt(1);
   	jQuery("#add_key_shopcart_"+id).remove();  
   	jQuery("#key_count".replace("replace-", "")).val(kk);
}                    	
function removeItem(id)
{                        
    count	= jQuery("#key_count").val();
    var kk = parseInt(count)-parseInt(1);
   	jQuery("#add_key_shopcart_"+id).remove();  
   	jQuery("#key_count".replace("replace-", "")).val(kk);
} 







function addMore_shipinCorrect(varid)
{ 
   
	count	= jQuery("#addmore_count_"+varid).val();
	count = parseInt(count)+parseInt(1);
	jQuery("#addmore_div_"+varid).append("<tr id='addmore_"+ count+"_"+varid+"'> <td class='list_head' width='30%'>KEY "+count+" :</td><td class ='normal_text'><input type='text'  name='key_"+varid+"[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_shipincorr("+count+","+varid+")' style='cursor:pointer'/></td></tr>");
	jQuery("#addmore_count_"+varid).attr('value',count);
}

function removeItem_shipincorr(id,varid)
{
  
    count	= jQuery("#addmore_count_"+varid).val();
    var kk = parseInt(count)-parseInt(1);
	jQuery("#addmore_"+id+"_"+varid).remove();  
	jQuery(("#addmore_count_"+varid).replace("replace-", "")).val(kk);
	
  
} 


function getSeries_shipincorrect(varid)
{ 
    
  $.post(siteurl+"ajax_shipincorr.php", { 
         action : 'series_'+varid, 
         varid : varid ,
         brand  : $("#brand_"+varid).val() 
        },
  function(data){
   if(data)
   {
       $("#series_td_"+varid).html(data);
       $("#model_td_"+varid).html('');
       $("#model_num_td_"+varid).html('');
   }
  });
}




function getModel_shipincorrect(varid)
{ 
  
  $.post(siteurl+"ajax_shipincorr.php", { 
         action : 'model_'+varid, 
         varid : varid ,
         series  : $("#series_"+varid).val() 
        },
  function(data){
   if(data)
   {
      
       $("#model_td_"+varid).html(data);
       $("#model_num_td_"+varid).html('');
   }
  });
}




function getModelNumber_shipincorrect(varid)
{
  $.post(siteurl+"ajax_shipincorr.php", { 
         action  : 'model_number_'+varid, 
         varid : varid ,
         model  : $("#model_"+varid).val() 
        },
  function(data){
   if(data)
   {
      
       $("#model_num_td_"+varid).html(data);
   }
  });
}





function add_hinges_edit_shoppingcart()
{
                    	count	= jQuery("#hinges_count").val();
                    	count = parseInt(count)+parseInt(1);
                    	jQuery("#add_hinges_shoppingcart_div").append("<tr id='add_hinge_shopcart_"+ count+"'> <td class='list_head' width='30%'>SET "+count+" :</td><td class ='normal_text'><input type='text'  name='hinges[]'  style='width:35%' /></td><td align='left' width='10%'><img src='./images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItemHinge_shoppingcart("+count+")' style='cursor:pointer'/></td></tr>");
                    	jQuery("#hinges_count").attr('value',count);
}
                    
function removeItemHinge_shoppingcart(id)
{                         
    count	= jQuery("#hinges_count").val();
    var kk = parseInt(count)-parseInt(1);
   	jQuery("#add_hinge_shopcart_"+id).remove();  
   	jQuery("#hinges_count".replace("replace-", "")).val(kk);
}




function add_keys_edit_cart_hingesoffer() // image path different
{
                    	count	= jQuery("#key_count").val();
                    	count = parseInt(count)+parseInt(1);
                    	jQuery("#add_key_shoppingcart_div").append("<tr id='add_key_shopcart_"+ count+"'> <td class='list_head' width='30%'>KEY "+count+" :</td><td class ='normal_text'><input type='text'  name='key[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_shoppingcart("+count+")' style='cursor:pointer'/></td></tr>");
                    	jQuery("#key_count").attr('value',count);
}


function add_hinges_edit_cart_hingesoffer()// image path different
{
                    	count	= jQuery("#hinges_count").val();
                    	count = parseInt(count)+parseInt(1);
                    	jQuery("#add_hinges_shoppingcart_div").append("<tr id='add_hinge_shopcart_"+ count+"'> <td class='list_head' width='30%'>SET "+count+" :</td><td class ='normal_text'><input type='text'  name='hinges[]'  style='width:35%' /></td><td align='left' width='10%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItemHinge_shoppingcart("+count+")' style='cursor:pointer'/></td></tr>");
                    	jQuery("#hinges_count").attr('value',count);
}



function getMNumFromBrand()
{ 
   
  $.post(siteurl+"ajax.php", { 
         action : 'model_number_from_brand', 
         brand  : $("#brand").val() 
        },
  function(data){
   if(data)
   {
       $("#model_num_td").html(data);
   }
  });
}




function add_lowstock()
{
	count	= jQuery("#add_lowstock_count").val();
	count = parseInt(count)+parseInt(1);
	jQuery("#add_lowstock_div").append("<tr id='add_lowstock_"+ count+"'> <td class='list_head' width='30%'>Part Number :</td><td class ='normal_text' width='40%'><input type='text'  name='key[]'  /></td><td align='left' width='20%'><img src='../images/btn_delete.gif'  alt='Delete' title='Delete' onclick='removeItem_lowstock("+count+")' style='cursor:pointer'/></td></tr>");
	jQuery("#add_lowstock_count").attr('value',count);
}

function removeItem_lowstock(id)
{
     
	jQuery("#add_lowstock_"+id).remove();  
	
}