<?php
    
class attr_url extends attr {


    function render_text( $crop = false ) {
	    	return $this->getCurVal();
   }
   
   function render_input() {
        
        if ( $this->getCurVal() && $this->obj->id ) {
        	return '<input id="' . $this->attr_name . '" type="hidden" name="' . $this->attr_name . '" value="' .$this->getCurVal() . '">'.$this->getCurVal();    	
//            return '<input id="' . $this->attr_name . '" type="text" name="' . $this->attr_name . '" value="' .$this->getCurVal() . '">';
        } else {
	    	return '<input id="' . $this->attr_name . '" type="text" name="' . $this->attr_name . '" class="form-control" value="' .$this->getCurVal() . '">'."
<script>
 $(document).ready( function() {
    $('#title').keyup( function() {
        if ( $('#url').attr('type') == 'hidden' ) return true;
        $('#url').val( translateStr( $('#title').val() )  + '-' + Math.floor((Math.random()*10000)+1));
        return true;
    });
 });
</script>";    	
        }
    }
    


}

?>