<style>
.newoption
{
	background-color:#CCCCCC !important; 
	font-weight:bold !important;
}

</style>



<select class="selectx1 wdt100" name="client" id="client" >
            			
				
				
                  {assign var=u value=1} 
          		
			{foreach $clientData as $client}
            
             {if {$u} eq 2}
            <option  value="-2"  class="newoption">اضافة عميل جديد</option>
              {/if}
                                    
      <option {if {$clientid} eq {$client->clientid}}  selected="selected"  {/if} value="{$client->clientid}">{$client->clientname}</option> 
      
      {capture assign=u}{$u+1}{/capture}
        
           {/foreach}
           
           
             
			
								      </select>
                                      
                                      
                                    
                                    
                                    
                                    
                                    
                                    
                                    
  {literal}                                  
                                    
  <script>                                  
                                    
                                    
    $(document).ready(function(e) {
	
	
	
    $("#supplier").select2().change( function() {
		
			
	  var theselectedvalue = $(this).val();
	  
		
			
												
			if(theselectedvalue == "-2")
			{   
				//e.preventDefault();
		
				var elemposition = $(this).data('position');
				$("#myModal1").find(".savemodel1").attr('data-position', elemposition);
				$('#myModal1').modal('show');
			}
					
					
					else
					{
						
						  $("#debt").html('<img src="../views/default/images/6.gif" alt="">');	
							  
	  $('#debt').load(''+supplierpagename+'?do=getclientdebt&clientid='+theselectedvalue+'',function() {


			document.getElementById("hidden_debt").value = $('#debt').html();
			
			$("#tempclientName").val($("#supplier option[value='"+theselectedvalue+"']").text());
			
			
			////////////add by sara//////////////////
			therestofdebt();
			
			if(theselectedvalue == "1")
			{
				 $('#genpay').attr('readonly', true);
			}
			else
			{
				 $('#genpay').attr('readonly', false);
			}
			
		  	//$("#editdebt").css("display", "block");


	  					}); 
					}
												
								
					return false;
					
		

	});
	
});

</script>

  {/literal} 